Class: ApiBucket::Amazon::Client
- Inherits:
-
Object
- Object
- ApiBucket::Amazon::Client
- Includes:
- Http
- Defined in:
- lib/api_bucket/amazon/client.rb,
lib/api_bucket/amazon/client/http.rb
Defined Under Namespace
Modules: Http
Constant Summary collapse
- REQUEST_URL =
'http://ecs.amazonaws.jp/onca/xml'
Instance Attribute Summary collapse
-
#a_w_s_access_key_id ⇒ Object
Returns the value of attribute a_w_s_access_key_id.
-
#a_w_s_secret_key ⇒ Object
Returns the value of attribute a_w_s_secret_key.
-
#associate_tag ⇒ Object
Returns the value of attribute associate_tag.
-
#count ⇒ Object
Returns the value of attribute count.
-
#country ⇒ Object
Returns the value of attribute country.
-
#item_page ⇒ Object
Returns the value of attribute item_page.
-
#service ⇒ Object
Returns the value of attribute service.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #categories ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #lookup(id, params = {}) ⇒ Object
- #search(keywords, params = {}) ⇒ Object
Methods included from Http
#camelize, #prepare_query, #send_request, #sign_request, #url_encode
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/api_bucket/amazon/client.rb', line 26 def initialize(={}) = ApiBucket::Amazon..merge() self.version = '2011-08-01' self.service = 'AWSECommerceService' self.a_w_s_access_key_id = [:a_w_s_access_key_id] self.a_w_s_secret_key = [:a_w_s_secret_key] self.associate_tag = [:associate_tag] self.country = 'ja' self.count = 20 self.item_page = 1 end |
Instance Attribute Details
#a_w_s_access_key_id ⇒ Object
Returns the value of attribute a_w_s_access_key_id.
5 6 7 |
# File 'lib/api_bucket/amazon/client.rb', line 5 def a_w_s_access_key_id @a_w_s_access_key_id end |
#a_w_s_secret_key ⇒ Object
Returns the value of attribute a_w_s_secret_key.
5 6 7 |
# File 'lib/api_bucket/amazon/client.rb', line 5 def a_w_s_secret_key @a_w_s_secret_key end |
#associate_tag ⇒ Object
Returns the value of attribute associate_tag.
5 6 7 |
# File 'lib/api_bucket/amazon/client.rb', line 5 def associate_tag @associate_tag end |
#count ⇒ Object
Returns the value of attribute count.
6 7 8 |
# File 'lib/api_bucket/amazon/client.rb', line 6 def count @count end |
#country ⇒ Object
Returns the value of attribute country.
6 7 8 |
# File 'lib/api_bucket/amazon/client.rb', line 6 def country @country end |
#item_page ⇒ Object
Returns the value of attribute item_page.
6 7 8 |
# File 'lib/api_bucket/amazon/client.rb', line 6 def item_page @item_page end |
#service ⇒ Object
Returns the value of attribute service.
5 6 7 |
# File 'lib/api_bucket/amazon/client.rb', line 5 def service @service end |
#version ⇒ Object
Returns the value of attribute version.
5 6 7 |
# File 'lib/api_bucket/amazon/client.rb', line 5 def version @version end |
Instance Method Details
#categories ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/api_bucket/amazon/client.rb', line 10 def categories { ALL: 'All', DVD: 'DVD / BD', Books: 'Books', ForeignBooks: 'ForeignBooks', VideoGames: 'VideoGames', Music: 'Music', Software: 'Software', Electronics: 'Electronics', Watches: 'Watches', KindleStore: 'KindleStore', Grocery: 'Grocery', } end |
#lookup(id, params = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/api_bucket/amazon/client.rb', line 57 def lookup(id, params={}) = { a_w_s_access_key_id: self.a_w_s_access_key_id, a_w_s_secret_key: self.a_w_s_secret_key, associate_tag: self.associate_tag, operation: 'ItemLookup', response_group: 'Large,EditorialReview,ItemAttributes', item_id: id, timestamp: Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"), } .merge!(params) ApiBucket::Amazon::Response.new(send_request()) end |
#search(keywords, params = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/api_bucket/amazon/client.rb', line 38 def search(keywords, params={}) = { a_w_s_access_key_id: self.a_w_s_access_key_id, a_w_s_secret_key: self.a_w_s_secret_key, associate_tag: self.associate_tag, operation: 'ItemSearch', response_group: 'Large,EditorialReview,ItemAttributes', item_page: @page, count: @limit, search_index: 'All', keywords: keywords, timestamp: Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"), } .merge!(params) ApiBucket::Amazon::Response.new(send_request()) end |