Class: Sqoot::Client
- Inherits:
-
Object
- Object
- Sqoot::Client
- Extended by:
- Forwardable
- Defined in:
- lib/sqoot/client.rb
Instance Attribute Summary collapse
-
#affiliate_token ⇒ Object
readonly
Returns the value of attribute affiliate_token.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#authentication_token ⇒ Object
readonly
Returns the value of attribute authentication_token.
Instance Method Summary collapse
-
#connection ⇒ Faraday::Connection
Raw HTTP connection with Faraday::Connection.
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Request
#convert_params, #get, #request
Methods included from Click
Methods included from Commission
Methods included from Provider
Methods included from Category
Methods included from Offer
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
23 24 25 26 27 |
# File 'lib/sqoot/client.rb', line 23 def initialize(={}) @affiliate_token = [:affiliate_token] || Sqoot.affiliate_token @authentication_token = [:authentication_token] || Sqoot.authentication_token @api_url = [:api_url] || Sqoot.api_url end |
Instance Attribute Details
#affiliate_token ⇒ Object (readonly)
Returns the value of attribute affiliate_token.
21 22 23 |
# File 'lib/sqoot/client.rb', line 21 def affiliate_token @affiliate_token end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
21 22 23 |
# File 'lib/sqoot/client.rb', line 21 def api_url @api_url end |
#authentication_token ⇒ Object (readonly)
Returns the value of attribute authentication_token.
21 22 23 |
# File 'lib/sqoot/client.rb', line 21 def authentication_token @authentication_token end |
Instance Method Details
#connection ⇒ Faraday::Connection
Raw HTTP connection with Faraday::Connection
32 33 34 35 36 37 38 39 |
# File 'lib/sqoot/client.rb', line 32 def connection params = {} @connection = Faraday.new(:url => api_url, :params => params, :headers => default_headers) do |builder| builder.use Faraday::Response::ParseGzip builder.use FaradayMiddleware::FollowRedirects builder.adapter Faraday.default_adapter end end |