Class: AbsorbApi::Api
- Inherits:
-
Object
- Object
- AbsorbApi::Api
- Defined in:
- lib/absorb_api/api.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize ⇒ Api
constructor
A new instance of Api.
Constructor Details
#initialize ⇒ Api
Returns a new instance of Api.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/absorb_api/api.rb', line 5 def initialize @token = AbsorbApi::Authorize.new.token @connection ||= Faraday.new(url: AbsorbApi.configuration.url, parallel_manager: Typhoeus::Hydra.new(max_concurrency: 200)) do |faraday| faraday.request :json faraday.response :json, content_type: /\bjson$/ faraday.adapter :typhoeus faraday.headers = { 'Authorization' => @token } end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/absorb_api/api.rb', line 3 def connection @connection end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
3 4 5 |
# File 'lib/absorb_api/api.rb', line 3 def token @token end |