Class: WalmartOpen::Client
- Inherits:
-
Object
- Object
- WalmartOpen::Client
- Defined in:
- lib/walmart_open/client.rb
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
readonly
Returns the value of attribute auth_token.
-
#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
- #order(order_info) ⇒ Object
- #search(query, params = {}) ⇒ Object
- #taxonomy ⇒ Object
Constructor Details
#initialize(config_attrs = {}) {|config| ... } ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 |
# File 'lib/walmart_open/client.rb', line 16 def initialize(config_attrs = {}) @config = Config.new(config_attrs) @connection = ConnectionManager.new(self) yield config if block_given? end |
Instance Attribute Details
#auth_token ⇒ Object (readonly)
Returns the value of attribute auth_token.
14 15 16 |
# File 'lib/walmart_open/client.rb', line 14 def auth_token @auth_token end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/walmart_open/client.rb', line 13 def config @config end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
12 13 14 |
# File 'lib/walmart_open/client.rb', line 12 def connection @connection end |
Instance Method Details
#feed(type, category_id = nil) ⇒ Object
35 36 37 38 39 |
# File 'lib/walmart_open/client.rb', line 35 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
27 28 29 |
# File 'lib/walmart_open/client.rb', line 27 def lookup(item_id, params = {}) connection.request(Requests::Lookup.new(item_id, params)) end |
#order(order_info) ⇒ Object
41 42 43 44 45 |
# File 'lib/walmart_open/client.rb', line 41 def order(order_info) authenticate! connection.request(Requests::PlaceOrder.new(order_info)) end |