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'
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
9 10 11 12 |
# File 'lib/restforce/middleware/authorization.rb', line 9 def call(env) env[:request_headers][AUTH_HEADER] = %(OAuth #{token}) @app.call(env) end |
#token ⇒ Object
14 15 16 |
# File 'lib/restforce/middleware/authorization.rb', line 14 def token @options[:oauth_token] end |