Class: Tumbz::Middleware::Auth
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Tumbz::Middleware::Auth
- Defined in:
- lib/tumbz/middleware/auth.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize(app, options = {}) ⇒ Auth
Returns a new instance of Auth.
4 5 6 7 |
# File 'lib/tumbz/middleware/auth.rb', line 4 def initialize(app, ={}) @app = app @options = end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 |
# File 'lib/tumbz/middleware/auth.rb', line 9 def call(env) env[:request_headers]["Authorization"] = "OAuth #{Thread.current[:tumbz_access_token]}" unless Thread.current[:tumbz_access_token].nil? @app.call(env) end |