Class: BaseCRM::Middlewares::OAuthBearerToken
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- BaseCRM::Middlewares::OAuthBearerToken
- Defined in:
- lib/basecrm/middlewares/oauth_bearer_token.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, access_token) ⇒ OAuthBearerToken
constructor
A new instance of OAuthBearerToken.
Constructor Details
#initialize(app, access_token) ⇒ OAuthBearerToken
Returns a new instance of OAuthBearerToken.
5 6 7 8 |
# File 'lib/basecrm/middlewares/oauth_bearer_token.rb', line 5 def initialize(app, access_token) super app @access_token = access_token end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 |
# File 'lib/basecrm/middlewares/oauth_bearer_token.rb', line 11 def call(env) env[:request_headers]["Authorization"] = "Bearer #{@access_token}" @app.call(env) end |