Class: Vend::Middleware::Auth

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/vend/middleware/auth.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Auth

Returns a new instance of Auth.



4
5
6
7
# File 'lib/vend/middleware/auth.rb', line 4

def initialize(app, options = {})
  @app = app
  @options = options
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
# File 'lib/vend/middleware/auth.rb', line 9

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