Class: Webmaster::Request::OAuth2
- Defined in:
- lib/webmaster/request/oauth2.rb
Constant Summary collapse
- AUTH_HEADER =
'Authorization'.freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, *args) ⇒ OAuth2
constructor
A new instance of OAuth2.
Constructor Details
#initialize(app, *args) ⇒ OAuth2
Returns a new instance of OAuth2.
19 20 21 22 23 |
# File 'lib/webmaster/request/oauth2.rb', line 19 def initialize(app, *args) super app @app = app @token = args.shift end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 |
# File 'lib/webmaster/request/oauth2.rb', line 13 def call(env) env[:request_headers].merge!(AUTH_HEADER => "OAuth #{@token}") if @token.present? @app.call env end |