Class: SearsApi::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/sears-api.rb

Class Method Summary collapse

Class Method Details

.current_promotions(opt = {}) ⇒ Object



43
44
45
46
47
# File 'lib/sears-api.rb', line 43

def current_promotions(opt = {})
  def_opts = {:storeName => 'Sears'}
  def_opts[:storeName] = opt[:store] if opt[:store]
  kget('/CurrentPromotions', :query => def_opts.merge(opt))
end

.kget(path, opt = {}) ⇒ Object



22
23
24
25
26
27
# File 'lib/sears-api.rb', line 22

def kget(path,opt = {})
  opt[:query] ||= {}
  opt[:query].merge!({:apikey => SearsApi::Configuration.key, 
                      :store  => 'Sears'}) {|k,v1,v2| v1}
  Response.new(get(path, opt))
end

.product_details(part_number, opt = {}) ⇒ Object



33
34
35
# File 'lib/sears-api.rb', line 33

def product_details(part_number, opt = {})
  kget('/productdetails', :query => {:partNumber => part_number}.merge(opt))
end

.product_search_by_keyword(keyword, opt = {}) ⇒ Object



37
38
39
40
41
# File 'lib/sears-api.rb', line 37

def product_search_by_keyword(keyword, opt = {})
  kget('/productsearch', 
       :query => {:keyword => keyword,:searchType => 'keyword'}.
       merge(opt))
end

.store_locator(zip, opt = {}) ⇒ Object



29
30
31
# File 'lib/sears-api.rb', line 29

def store_locator(zip, opt = {})
  kget('/StoreLocator', :query => {:zipCode => '94132'}.merge(opt))
end