mirror of
https://github.com/dkam/paapi.git
synced 2025-12-28 07:04:53 +00:00
Include PartnerTag and PartnerType
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
## 0.1.7 ( Unreleased )
|
||||
## 0.1.9 (Unreleased)
|
||||
- Fix bug allowing non-title case Request Parameters
|
||||
- Add the required PartnerTag and PartnerType key values to the search body request
|
||||
|
||||
## 0.1.7
|
||||
- Add gem 'net-http-persistent' for connection persistance
|
||||
- Remove the code which would use other http clients if available
|
||||
## 0.1.3
|
||||
|
||||
@@ -8,7 +8,7 @@ require 'paapi/response'
|
||||
module Paapi
|
||||
class Error < StandardError; end
|
||||
class NotImplemented < StandardError; end
|
||||
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_MARKET = :us
|
||||
DEFAULT_CONDITION = 'Any'
|
||||
|
||||
@@ -37,7 +37,7 @@ module Paapi
|
||||
end
|
||||
|
||||
def get_items(item_ids:, **options)
|
||||
payload = { ItemIds: Array(item_ids), Resources: @resources }.merge(options)
|
||||
payload = { PartnerTag: partner_tag, PartnerType: 'Associates', ItemIds: Array(item_ids), Resources: @resources }.merge(options)
|
||||
request(op: :get_items, payload: payload)
|
||||
end
|
||||
|
||||
@@ -47,12 +47,12 @@ module Paapi
|
||||
end
|
||||
|
||||
# TODO: Currently we assume Keywords, but we need one of the following: [Keywords Actor Artist Author Brand Title ]
|
||||
def search_items(keywords: nil, **options )
|
||||
raise ArgumentError("Missing keywords") unless (options.keys | SEARCH_PARAMS).length.positive?
|
||||
def search_items(**options )
|
||||
raise ArgumentError.new("Missing keywords") unless (options.keys & SEARCH_PARAMS).length.positive?
|
||||
|
||||
search_index = options.dig(:SearchIndex) ||'All'
|
||||
|
||||
payload = { Keywords: keywords, Resources: @resources, ItemCount: 10, ItemPage: 1, SearchIndex: search_index }.merge(options)
|
||||
payload = { PartnerTag: partner_tag, PartnerType: 'Associates', Resources: @resources, ItemCount: 10, ItemPage: 1, SearchIndex: search_index }.merge(options)
|
||||
|
||||
request(op: :search_items, payload: payload)
|
||||
end
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Paapi
|
||||
VERSION = '0.1.8'
|
||||
VERSION = '0.1.9'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user