Class: A2z::Client

Inherits:
Object show all
Includes:
Jeff
Defined in:
lib/a2z/client.rb

Constant Summary collapse

ErrorResponse =
Class.new(ArgumentError)
HOSTS =
{
    ca: 'ecs.amazonaws.ca',
    cn: 'webservices.amazon.cn',
    de: 'ecs.amazonaws.de',
    es: 'webservices.amazon.es',
    fr: 'ecs.amazonaws.fr',
    it: 'webservices.amazon.it',
    jp: 'ecs.amazonaws.jp',
    uk: 'ecs.amazonaws.co.uk',
    us: 'ecs.amazonaws.com',
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



28
29
30
31
32
33
# File 'lib/a2z/client.rb', line 28

def initialize(opts = {})
  self.country  = opts.fetch(:country, :us)
  self.key      = opts[:key]
  self.secret   = opts[:secret]
  self.tag      = opts[:tag]
end

Instance Attribute Details

#countryObject

Returns the value of attribute country.



10
11
12
# File 'lib/a2z/client.rb', line 10

def country
  @country
end

#tagObject

Returns the value of attribute tag.



10
11
12
# File 'lib/a2z/client.rb', line 10

def tag
  @tag
end

Instance Method Details

#browse_node_lookup(id, &block) ⇒ Object



51
52
53
54
# File 'lib/a2z/client.rb', line 51

def browse_node_lookup(id, &block)
  response = request(Requests::BrowseNodeLookup.new(id, &block))
  Responses::BrowseNodeLookup.from_response(response)
end

#item_lookup(&block) ⇒ Object



46
47
48
49
# File 'lib/a2z/client.rb', line 46

def item_lookup(&block)
  response = request(Requests::ItemLookup.new(&block))
  Responses::ItemLookup.from_response(response)
end

#item_search(&block) ⇒ Object



41
42
43
44
# File 'lib/a2z/client.rb', line 41

def item_search(&block)
  response = request(Requests::ItemSearch.new(&block))
  Responses::ItemSearch.from_response(response)
end