Class: Truelayer::FaradayAuth
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Truelayer::FaradayAuth
- Defined in:
- lib/truelayer/faraday_auth.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, token, options = {}) ⇒ FaradayAuth
constructor
A new instance of FaradayAuth.
Constructor Details
#initialize(app, token, options = {}) ⇒ FaradayAuth
Returns a new instance of FaradayAuth.
8 9 10 11 12 |
# File 'lib/truelayer/faraday_auth.rb', line 8 def initialize(app, token, = {}) super(app) @token = token @options = end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/truelayer/faraday_auth.rb', line 14 def call(env) env[:request_headers]['Authorization'] = "Bearer #{@token}" env[:request_headers]['Content-Type'] = 'application/json' env[:request_headers]['User-Agent'] = "finpoint/#{Truelayer::VERSION}" @app.call(env) end |