Class: Dailymotion::FaradayMiddleware::OAuth2
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Dailymotion::FaradayMiddleware::OAuth2
- Defined in:
- lib/dailymotion/faraday_middleware/oauth2.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, access_token) ⇒ OAuth2
constructor
A new instance of OAuth2.
Constructor Details
#initialize(app, access_token) ⇒ OAuth2
Returns a new instance of OAuth2.
10 11 12 |
# File 'lib/dailymotion/faraday_middleware/oauth2.rb', line 10 def initialize(app, access_token) @app, @access_token = app, access_token end |
Instance Method Details
#call(env) ⇒ Object
4 5 6 7 8 |
# File 'lib/dailymotion/faraday_middleware/oauth2.rb', line 4 def call(env) env[:request_headers]['Authorization'] = "OAuth #{@access_token}" @app.call(env) end |