Class: Affilinet::Client
- Inherits:
-
Object
- Object
- Affilinet::Client
- Defined in:
- lib/affilinet/client.rb
Constant Summary collapse
- HOST =
'product-api.affili.net/'
- SERVICE =
'productservice.svc/'
- API_TYPE =
'JSON'
- API_VERSION =
'V3/'
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#publisher_id ⇒ Object
readonly
Returns the value of attribute publisher_id.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #categories ⇒ Object
- #get(endpoint, args = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #products ⇒ Object
- #properties ⇒ Object
- #search ⇒ Object
- #shops ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/affilinet/client.rb', line 9 def initialize(={}) @options = {ssl: true, image_scales: [], logo_scales: [], shop_ids: [], category_ids: [], facets: []} @options.merge! uri = @options[:ssl] ? 'https://' : 'http://' uri.concat HOST @uri = URI.join uri, API_VERSION, SERVICE, API_TYPE @publisher_id = @options[:publisher_id] @password = @options[:password] @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
7 8 9 |
# File 'lib/affilinet/client.rb', line 7 def connection @connection end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/affilinet/client.rb', line 7 def @options end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
7 8 9 |
# File 'lib/affilinet/client.rb', line 7 def password @password end |
#publisher_id ⇒ Object (readonly)
Returns the value of attribute publisher_id.
7 8 9 |
# File 'lib/affilinet/client.rb', line 7 def publisher_id @publisher_id end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
7 8 9 |
# File 'lib/affilinet/client.rb', line 7 def uri @uri end |
Instance Method Details
#categories ⇒ Object
37 38 39 |
# File 'lib/affilinet/client.rb', line 37 def categories Affilinet::Category.new self end |
#get(endpoint, args = {}) ⇒ Object
33 34 35 |
# File 'lib/affilinet/client.rb', line 33 def get endpoint, args = {} connection.get(endpoint, args).body end |
#products ⇒ Object
45 46 47 |
# File 'lib/affilinet/client.rb', line 45 def products Affilinet::Product.new self end |
#properties ⇒ Object
41 42 43 |
# File 'lib/affilinet/client.rb', line 41 def properties Affilinet::Property.new self end |