mirror of
https://github.com/dkam/paapi.git
synced 2025-12-28 07:04:53 +00:00
Merge branch 'add_condition' into master
This commit is contained in:
@@ -11,6 +11,7 @@ module Paapi
|
|||||||
SEARCH_PARAMS = %i[keywords actor, artist, author, brand title].freeze
|
SEARCH_PARAMS = %i[keywords actor, artist, author, brand title].freeze
|
||||||
DEFAULT_PARTNER_TYPE = 'Associates'
|
DEFAULT_PARTNER_TYPE = 'Associates'
|
||||||
DEFAULT_MARKET = :us
|
DEFAULT_MARKET = :us
|
||||||
|
DEFAULT_CONDITION = 'Any'
|
||||||
DEFAULT_RESOURCES = [
|
DEFAULT_RESOURCES = [
|
||||||
'Images.Primary.Large',
|
'Images.Primary.Large',
|
||||||
'ItemInfo.ByLineInfo',
|
'ItemInfo.ByLineInfo',
|
||||||
@@ -72,6 +73,7 @@ module Paapi
|
|||||||
:partner_type,
|
:partner_type,
|
||||||
:market,
|
:market,
|
||||||
:partner_market,
|
:partner_market,
|
||||||
|
:condition,
|
||||||
:resources,
|
:resources,
|
||||||
:test_mode
|
:test_mode
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ require 'aws-sigv4'
|
|||||||
module Paapi
|
module Paapi
|
||||||
class Client
|
class Client
|
||||||
|
|
||||||
attr_accessor :partner_tag, :marketplace, :resources
|
attr_accessor :partner_tag, :marketplace, :resources, :condition
|
||||||
attr_reader :partner_type, :access_key, :secret_key, :market
|
attr_reader :partner_type, :access_key, :secret_key, :market
|
||||||
|
|
||||||
def initialize(access_key: Paapi.access_key,
|
def initialize(access_key: Paapi.access_key,
|
||||||
secret_key: Paapi.secret_key,
|
secret_key: Paapi.secret_key,
|
||||||
partner_tag: Paapi.partner_tag,
|
partner_tag: Paapi.partner_tag,
|
||||||
market: Paapi.market || DEFAULT_MARKET,
|
market: Paapi.market || DEFAULT_MARKET,
|
||||||
|
condition: Paapi.condition || DEFAULT_CONDITION,
|
||||||
resources: Paapi.resources || DEFAULT_RESOURCES,
|
resources: Paapi.resources || DEFAULT_RESOURCES,
|
||||||
partner_type: DEFAULT_PARTNER_TYPE
|
partner_type: DEFAULT_PARTNER_TYPE
|
||||||
)
|
)
|
||||||
@@ -20,7 +21,7 @@ module Paapi
|
|||||||
@secret_key = secret_key
|
@secret_key = secret_key
|
||||||
@partner_type = partner_type
|
@partner_type = partner_type
|
||||||
@resources = resources unless resources.nil?
|
@resources = resources unless resources.nil?
|
||||||
|
@condition = condition
|
||||||
self.market = market
|
self.market = market
|
||||||
@partner_tag = partner_tag if !partner_tag.nil?
|
@partner_tag = partner_tag if !partner_tag.nil?
|
||||||
end
|
end
|
||||||
@@ -72,6 +73,7 @@ module Paapi
|
|||||||
}
|
}
|
||||||
|
|
||||||
default_payload = {
|
default_payload = {
|
||||||
|
'Condition' => condition,
|
||||||
'PartnerTag' => partner_tag,
|
'PartnerTag' => partner_tag,
|
||||||
'PartnerType' => partner_type,
|
'PartnerType' => partner_type,
|
||||||
'Marketplace' => marketplace.site
|
'Marketplace' => marketplace.site
|
||||||
|
|||||||
Reference in New Issue
Block a user