Class: Bigcommerce::Middleware::Auth

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

Instance Method Summary collapse

Constructor Details

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


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

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

Instance Method Details

#call(env) ⇒ Object


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

def call(env)
  env[:request_headers]['X-Auth-Client'] = @options[:client_id]
  env[:request_headers]['X-Auth-Token'] = @options[:access_token]
  @app.call env
end