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)
14 15 16 |
# File 'lib/vacuum/request.rb', line 14 def client @client end |
#operation ⇒ Operation (readonly)
20 21 22 |
# File 'lib/vacuum/request.rb', line 20 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
47 48 49 50 |
# File 'lib/vacuum/request.rb', line 47 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
68 69 70 71 |
# File 'lib/vacuum/request.rb', line 68 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
91 92 93 |
# File 'lib/vacuum/request.rb', line 91 def get_variations(**params) request('GetVariations', params) end |
#persistent(timeout: 5) ⇒ self
Flags as persistent
131 132 133 134 135 136 |
# File 'lib/vacuum/request.rb', line 131 def persistent(timeout: 5) host = "https://#{locale.host}" @client = client.persistent(host, timeout: 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
123 124 125 |
# File 'lib/vacuum/request.rb', line 123 def search_items(**params) request('SearchItems', params) end |
#use(*features) ⇒ self
Turn on HTTP features
150 151 152 153 154 |
# File 'lib/vacuum/request.rb', line 150 %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
150 151 152 153 154 |
# File 'lib/vacuum/request.rb', line 150 %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 |