Class: WalmartOpen::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/walmart_open/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_attrs = {}) {|config| ... } ⇒ Client

Returns a new instance of Client.

Yields:



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_tokenObject (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

#configObject (readonly)

Returns the value of attribute config.



13
14
15
# File 'lib/walmart_open/client.rb', line 13

def config
  @config
end

#connectionObject (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

#search(query, params = {}) ⇒ Object



23
24
25
# File 'lib/walmart_open/client.rb', line 23

def search(query, params = {})
  connection.request(Requests::Search.new(query, params))
end

#taxonomyObject



31
32
33
# File 'lib/walmart_open/client.rb', line 31

def taxonomy
  connection.request(Requests::Taxonomy.new)
end