Class: Vacuum::Request
- Inherits:
-
Object
- Object
- Vacuum::Request
- Defined in:
- lib/vacuum/request.rb
Overview
A request to the Amazon Product Advertising API
Instance Attribute Summary collapse
- #client ⇒ HTTP::Client readonly
- #locale ⇒ Locale readonly
- #operation ⇒ Operation readonly
Instance Method Summary collapse
-
#get_browse_nodes(browse_node_ids: , languages_of_preference: nil, marketplace: nil, partner_tag: nil, partner_type: nil, resources: nil) ⇒ Response
Returns details about specified browse nodes.
-
#get_items(condition: nil, currency_of_preference: nil, item_id_type: nil, item_ids: , languages_of_preference: nil, marketplace: nil, merchant: nil, offer_count: nil, partner_tag: nil, partner_type: nil, resources: nil) ⇒ Response
Returns the attributes of one or more items.
-
#get_variations(asin: , condition: nil, currency_of_preference: nil, languages_of_preference: nil, marketplace: nil, merchant: nil, offer_count: nil, partner_tag: nil, partner_type: nil, resources: nil, variation_count: nil, variation_page: nil) ⇒ Response
Returns a set of items that are the same product, but differ according to a consistent theme.
-
#initialize(marketplace: :us, access_key: , secret_key: , partner_tag: , partner_type: ) ⇒ Request
constructor
Creates a new request.
-
#persistent(timeout: 5) ⇒ self
Flags as persistent.
-
#search_items(actor: nil, artist: nil, author: nil, availability: nil, brand: nil, browse_node_id: nil, condition: nil, currency_of_preference: nil, delivery_flags: nil, item_count: nil, item_page: nil, keywords: nil, languages_of_preference: nil, marketplace: nil, max_price: nil, merchant: nil, min_price: nil, min_reviews_rating: nil, min_savings_percent: nil, offer_count: nil, partner_tag: nil, partner_type: nil, resources: nil, search_index: nil, sort_by: nil, title: nil) ⇒ Response
Searches for items on Amazon based on a search query.
-
#use(*features) ⇒ self
Turn on HTTP features.
-
#via(*proxy) ⇒ self
Make a request through an HTTP proxy.
Constructor Details
Instance Attribute Details
#client ⇒ HTTP::Client (readonly)
13 14 15 |
# File 'lib/vacuum/request.rb', line 13 def client @client end |
#operation ⇒ Operation (readonly)
19 20 21 |
# File 'lib/vacuum/request.rb', line 19 def operation @operation end |
Instance Method Details
#get_browse_nodes(browse_node_ids: , languages_of_preference: nil, marketplace: nil, partner_tag: nil, partner_type: nil, resources: nil) ⇒ Response
Returns details about specified browse nodes
46 47 48 49 |
# File 'lib/vacuum/request.rb', line 46 def get_browse_nodes(browse_node_ids:, **params) params.update(browse_node_ids: Array(browse_node_ids)) request('GetBrowseNodes', params) end |
#get_items(condition: nil, currency_of_preference: nil, item_id_type: nil, item_ids: , languages_of_preference: nil, marketplace: nil, merchant: nil, offer_count: nil, partner_tag: nil, partner_type: nil, resources: nil) ⇒ Response
Returns the attributes of one or more items
67 68 69 70 |
# File 'lib/vacuum/request.rb', line 67 def get_items(item_ids:, **params) params.update(item_ids: Array(item_ids)) request('GetItems', params) end |
#get_variations(asin: , condition: nil, currency_of_preference: nil, languages_of_preference: nil, marketplace: nil, merchant: nil, offer_count: nil, partner_tag: nil, partner_type: nil, resources: nil, variation_count: nil, variation_page: nil) ⇒ Response
Returns a set of items that are the same product, but differ according to a consistent theme
90 91 92 |
# File 'lib/vacuum/request.rb', line 90 def get_variations(**params) request('GetVariations', params) end |
#persistent(timeout: 5) ⇒ self
Flags as persistent
130 131 132 133 134 135 |
# File 'lib/vacuum/request.rb', line 130 def persistent(timeout: 5) host = "https://#{locale.host}" @client = client.persistent(host, timeout:) self end |
#search_items(actor: nil, artist: nil, author: nil, availability: nil, brand: nil, browse_node_id: nil, condition: nil, currency_of_preference: nil, delivery_flags: nil, item_count: nil, item_page: nil, keywords: nil, languages_of_preference: nil, marketplace: nil, max_price: nil, merchant: nil, min_price: nil, min_reviews_rating: nil, min_savings_percent: nil, offer_count: nil, partner_tag: nil, partner_type: nil, resources: nil, search_index: nil, sort_by: nil, title: nil) ⇒ Response
Searches for items on Amazon based on a search query
122 123 124 |
# File 'lib/vacuum/request.rb', line 122 def search_items(**params) request('SearchItems', params) end |
#use(*features) ⇒ self
Turn on HTTP features
149 150 151 152 153 |
# File 'lib/vacuum/request.rb', line 149 %i[timeout via through headers use].each do |method_name| define_method(method_name) do |*args, &block| @client = client.send(method_name, *args, &block) end end |
#via(*proxy) ⇒ self
Make a request through an HTTP proxy
149 150 151 152 153 |
# File 'lib/vacuum/request.rb', line 149 %i[timeout via through headers use].each do |method_name| define_method(method_name) do |*args, &block| @client = client.send(method_name, *args, &block) end end |