Class: Restforce::Middleware::Authorization
- Inherits:
-
Restforce::Middleware
- Object
- Faraday::Middleware
- Restforce::Middleware
- Restforce::Middleware::Authorization
- Defined in:
- lib/restforce/middleware/authorization.rb
Overview
Piece of middleware that simply injects the OAuth token into the request headers.
Constant Summary collapse
- AUTH_HEADER =
'Authorization'.freeze
Instance Method Summary collapse
Methods inherited from Restforce::Middleware
#client, #connection, #initialize
Constructor Details
This class inherits a constructor from Restforce::Middleware
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 |
# File 'lib/restforce/middleware/authorization.rb', line 8 def call(env) env[:request_headers][AUTH_HEADER] = %(OAuth #{token}) @app.call(env) end |
#token ⇒ Object
13 14 15 |
# File 'lib/restforce/middleware/authorization.rb', line 13 def token @options[:oauth_token] end |