Class: Sterling::API::Client
- Inherits:
-
Object
- Object
- Sterling::API::Client
- Defined in:
- lib/sterling/api/client.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #products(user_location, query, requestor_id) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 |
# File 'lib/sterling/api/client.rb', line 7 def initialize @config = self.verify_config(Sterling.configuration) @base_url = "#{host}.retailigence.com/v#{version}/" @conn = Faraday.new(url: "http://#{@base_url}") end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
5 6 7 |
# File 'lib/sterling/api/client.rb', line 5 def base_url @base_url end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/sterling/api/client.rb', line 5 def config @config end |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
5 6 7 |
# File 'lib/sterling/api/client.rb', line 5 def conn @conn end |
Instance Method Details
#products(user_location, query, requestor_id) ⇒ Object
13 14 15 16 |
# File 'lib/sterling/api/client.rb', line 13 def products(user_location, query, requestor_id) params = { user_location: user_location, keywords: query, requestor_id: requestor_id } Product.search(self, params) end |