Class: WalmartOpen::Client
- Inherits:
-
Object
- Object
- WalmartOpen::Client
- Defined in:
- lib/walmart_open/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #feed(type, category_id = nil) ⇒ Object
-
#initialize(config_attrs = {}) {|config| ... } ⇒ Client
constructor
A new instance of Client.
- #lookup(item_id, params = {}) ⇒ Object
- #search(query, params = {}) ⇒ Object
- #taxonomy ⇒ Object
- #upc_lookup(upc, params = {}) ⇒ Object
Constructor Details
#initialize(config_attrs = {}) {|config| ... } ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 |
# File 'lib/walmart_open/client.rb', line 14 def initialize(config_attrs = {}) @config = Config.new(config_attrs) @connection = ConnectionManager.new(self) yield config if block_given? end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/walmart_open/client.rb', line 12 def config @config end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
11 12 13 |
# File 'lib/walmart_open/client.rb', line 11 def connection @connection end |
Instance Method Details
#feed(type, category_id = nil) ⇒ Object
37 38 39 40 41 |
# File 'lib/walmart_open/client.rb', line 37 def feed(type, category_id = nil) params = {} params[:category_id] = category_id if category_id connection.request(Requests::Feed.new(type, params)) end |
#lookup(item_id, params = {}) ⇒ Object
25 26 27 |
# File 'lib/walmart_open/client.rb', line 25 def lookup(item_id, params = {}) connection.request(Requests::Lookup.new(item_id, params)) end |
#search(query, params = {}) ⇒ Object
21 22 23 |
# File 'lib/walmart_open/client.rb', line 21 def search(query, params = {}) connection.request(Requests::Search.new(query, params)) end |