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:



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

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

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

#taxonomyObject



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

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

#upc_lookup(upc, params = {}) ⇒ Object



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

def upc_lookup(upc, params = {})
  connection.request(Requests::UpcLookup.new(upc, params))
end