Class: Amazon::AWS::Simple::APIWrapper
- Inherits:
-
Object
- Object
- Amazon::AWS::Simple::APIWrapper
- Defined in:
- lib/amazon/aws/simple.rb
Direct Known Subclasses
Constant Summary collapse
- @@logger =
Logger.new(nil)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key_id, secret_key_id, tag, locale, encoding, cache_dir) ⇒ APIWrapper
constructor
A new instance of APIWrapper.
- #item_lookup(type, params = {}) ⇒ Object
- #item_search(type, params = {}) ⇒ Object
- #request(query) ⇒ Object
Constructor Details
#initialize(key_id, secret_key_id, tag, locale, encoding, cache_dir) ⇒ APIWrapper
Returns a new instance of APIWrapper.
14 15 16 17 18 19 20 21 |
# File 'lib/amazon/aws/simple.rb', line 14 def initialize(key_id, secret_key_id, tag, locale, encoding, cache_dir) @key_id = key_id @secret_key_id = secret_key_id @tag = tag @locale = locale @encoding = encoding @cache_dir = cache_dir end |
Class Method Details
.logger=(logger) ⇒ Object
10 11 12 |
# File 'lib/amazon/aws/simple.rb', line 10 def self.logger=(logger) @@logger = logger end |
Instance Method Details
#item_lookup(type, params = {}) ⇒ Object
37 38 39 |
# File 'lib/amazon/aws/simple.rb', line 37 def item_lookup(type, params={}) request(Amazon::AWS::ItemLookup.new(type, params)).item_lookup_response.items.item end |
#item_search(type, params = {}) ⇒ Object
41 42 43 |
# File 'lib/amazon/aws/simple.rb', line 41 def item_search(type, params={}) request(Amazon::AWS::ItemSearch.new(type, params)).item_search_response.items.item end |
#request(query) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/amazon/aws/simple.rb', line 23 def request(query) req = Amazon::AWS::Search::Request.new(@key_id, @tag) req.config["cache_dir"] = @cache_dir req.config["secret_key_id"] = @secret_key_id req.locale = @locale req.encoding = @encoding req.cache = Amazon::AWS::Cache.new(@cache_dir) rg = Amazon::AWS::ResponseGroup.new(:Large) query.response_group = rg req.search(query) end |