Class: BaseCRM::Middlewares::OAuthBearerToken

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/basecrm/middlewares/oauth_bearer_token.rb

Instance Method Summary collapse

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