mirror of
https://github.com/dkam/paapi.git
synced 2025-12-28 07:04:53 +00:00
Wrap requests in responses. Update response to make the original request available
This commit is contained in:
@@ -14,20 +14,20 @@ module Paapi
|
|||||||
@partner_type = partner_type
|
@partner_type = partner_type
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_items(item_ids: )[]
|
def get_items(item_ids:, **options)
|
||||||
Request.new(client: self).get_items(item_ids: item_ids)
|
Response.new(Request.new(client: self).get_items(item_ids: item_ids, **options))
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_variations(asin: )
|
def get_variations(asin:, **options )
|
||||||
Request.new(client: self).get_variations(asin: asin)
|
Response.new(Request.new(client: self).get_variations(asin: asin, **options))
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_items(keywords: )
|
def search_items(keywords:, **options )
|
||||||
Request.new(client: self).search_items(keywords: keywords)
|
Response.new(Request.new(client: self).search_items(keywords: keywords, **options))
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_browse_nodes
|
def get_browse_nodes(keywords:, **options)
|
||||||
Request.new(client: self).get_browse_nodes(keywords: keywords)
|
Response.new(Request.new(client: self).get_browse_nodes(keywords: keywords, **options))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ require 'json'
|
|||||||
|
|
||||||
module Paapi
|
module Paapi
|
||||||
class Response
|
class Response
|
||||||
attr_reader :status, :data
|
attr_reader :http_response, :data
|
||||||
def initialize(response)
|
def initialize(response)
|
||||||
@status = response.status.to_s
|
@http_response = response
|
||||||
@data = JSON.parse( response.body.to_s )
|
@data = JSON.parse( response.body.to_s )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user