Class: Shoppr::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/shoppr/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sandboxed = false) ⇒ Client

Get your api_key found here developer.shopping.com/docs/Getting_Started



9
10
11
12
13
14
15
16
17
# File 'lib/shoppr/client.rb', line 9

def initialize(sandboxed=false)
  @api_key ||= Shoppr.api_key
  @tracking_id ||= Shoppr.tracking_id
  
  @sandboxed = sandboxed
  
  base_uri = (self.sandboxed? ? 'sandbox.api.shopping.com/publisher/3.0/rest' : 'publisher.usb.api.shopping.com/publisher/3.0/rest')
  self.class.base_uri base_uri
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key



6
7
8
# File 'lib/shoppr/client.rb', line 6

def api_key
  @api_key
end

#api_versionObject (readonly)

Returns the value of attribute api_version



6
7
8
# File 'lib/shoppr/client.rb', line 6

def api_version
  @api_version
end

#sandboxedObject (readonly)

Returns the value of attribute sandboxed



6
7
8
# File 'lib/shoppr/client.rb', line 6

def sandboxed
  @sandboxed
end

#tracking_idObject (readonly)

Returns the value of attribute tracking_id



6
7
8
# File 'lib/shoppr/client.rb', line 6

def tracking_id
  @tracking_id
end

Instance Method Details

#generic_responseObject



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

def generic_response
  @generic_response ||= GenericResponse.new()
end

#sandboxed?Boolean



19
20
21
# File 'lib/shoppr/client.rb', line 19

def sandboxed?
  !!@sandboxed
end

#search(options = {}) ⇒ Object



34
35
36
37
# File 'lib/shoppr/client.rb', line 34

def search(options={})
  # self.class.parser Proc.new {|response| GeneralSearchResponse.parse_search_results(response)}
  response = GeneralSearchResponse.new(default_options.merge(prep_query_options(options))) 
end