Class: FaradayMiddleware::Invoice2goAuth
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- FaradayMiddleware::Invoice2goAuth
- Defined in:
- lib/faraday/auth.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, api_key) ⇒ Invoice2goAuth
constructor
A new instance of Invoice2goAuth.
Constructor Details
#initialize(app, api_key) ⇒ Invoice2goAuth
Returns a new instance of Invoice2goAuth.
4 5 6 7 |
# File 'lib/faraday/auth.rb', line 4 def initialize(app, api_key) @app = app @api_key = api_key end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 |
# File 'lib/faraday/auth.rb', line 9 def call(env) env[:request_headers] = env[:request_headers].merge('Authorization' => "Bearer #{@api_key}") @app.call env end |