Class: FaradayMiddleware::YoutubeOAuth2

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/tubeclip/middleware/faraday_oauth2.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, access_token) ⇒ YoutubeOAuth2

Returns a new instance of YoutubeOAuth2.



9
10
11
# File 'lib/tubeclip/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/tubeclip/middleware/faraday_oauth2.rb', line 3

def call(env)
  env[:request_headers]['Authorization'] = "Bearer #{@access_token.token}"

  @app.call(env)
end