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:



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

def initialize(config_attrs = {})
  @config = Config.new(config_attrs)
  @connection = ConnectionManager.new(self)

  yield config if block_given?
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



11
12
13
# File 'lib/walmart_open/client.rb', line 11

def config
  @config
end

#connectionObject (readonly)

Returns the value of attribute connection.



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

def connection
  @connection
end

Instance Method Details

#feed(type, category_id = nil) ⇒ Object



32
33
34
35
36
# File 'lib/walmart_open/client.rb', line 32

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



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

def lookup(item_id, params = {})
  connection.request(Requests::Lookup.new(item_id, params))
end

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



20
21
22
# File 'lib/walmart_open/client.rb', line 20

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

#taxonomyObject



28
29
30
# File 'lib/walmart_open/client.rb', line 28

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