Class: Request::OAuth2
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Request::OAuth2
- Defined in:
- lib/youtube_it/middleware/faraday_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.
9 10 11 |
# File 'lib/youtube_it/middleware/faraday_oauth2.rb', line 9 def initialize(app, access_token) @app, @access_token = app, access_token end |
Instance Method Details
#call(env) ⇒ Object
3 4 5 6 7 |
# File 'lib/youtube_it/middleware/faraday_oauth2.rb', line 3 def call(env) env[:request_headers]['Authorization'] = "Bearer #{@access_token.token}" @app.call(env) end |