Class: MoneyMover::Dwolla::ApiConnection
- Inherits:
-
Object
- Object
- MoneyMover::Dwolla::ApiConnection
- Defined in:
- lib/money_mover/dwolla/api_connection.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#initialize(access_token, url_provider = EnvironmentUrls.new) ⇒ ApiConnection
constructor
A new instance of ApiConnection.
Constructor Details
#initialize(access_token, url_provider = EnvironmentUrls.new) ⇒ ApiConnection
Returns a new instance of ApiConnection.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/money_mover/dwolla/api_connection.rb', line 6 def initialize(access_token, url_provider = EnvironmentUrls.new) @connection ||= Faraday.new(url: url_provider.api_url) do |faraday| faraday. :Bearer, access_token if access_token faraday.headers[:accept] = "application/vnd.dwolla.v1.hal+json" faraday.request :multipart faraday.request :json faraday.response :json, content_type: /\bjson$/ faraday.adapter Faraday.default_adapter end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
4 5 6 |
# File 'lib/money_mover/dwolla/api_connection.rb', line 4 def connection @connection end |