Class: ViglinkApi::Client
- Inherits:
-
Object
- Object
- ViglinkApi::Client
- Extended by:
- Forwardable
- Defined in:
- lib/viglink_api/client.rb
Instance Attribute Summary collapse
-
#api_full_response ⇒ Object
readonly
Returns the value of attribute api_full_response.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
Instance Method Summary collapse
-
#connection ⇒ Faraday::Connection
Create a Faraday::Connection object.
-
#initialize(options = {}) ⇒ Client
constructor
Create a new Vig:Client object.
Methods included from Country
Methods included from Merchant
#find_merchant_types, #find_merchants
Methods included from Deal
Methods included from Product
Methods included from Request
Constructor Details
#initialize(options = {}) ⇒ Client
Create a new Vig:Client object
25 26 27 28 29 |
# File 'lib/viglink_api/client.rb', line 25 def initialize(={}) @api_key = [:api_key] || ViglinkApi.api_key @api_url = [:api_url] || ViglinkApi.api_url @api_full_response = [:api_full_response] || ViglinkApi.api_full_response end |
Instance Attribute Details
#api_full_response ⇒ Object (readonly)
Returns the value of attribute api_full_response.
19 20 21 |
# File 'lib/viglink_api/client.rb', line 19 def api_full_response @api_full_response end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
19 20 21 |
# File 'lib/viglink_api/client.rb', line 19 def api_key @api_key end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
19 20 21 |
# File 'lib/viglink_api/client.rb', line 19 def api_url @api_url end |
Instance Method Details
#connection ⇒ Faraday::Connection
Create a Faraday::Connection object
35 36 37 38 39 40 41 42 43 |
# File 'lib/viglink_api/client.rb', line 35 def connection params = {} @connection = Faraday.new(url: api_url, params: params, headers: default_headers) do |faraday| faraday.use FaradayMiddleware::Mashify faraday.use FaradayMiddleware::ParseXml, content_type: /\bxml$/ # faraday.request :url_encoded faraday.adapter Faraday.default_adapter end end |