Class: Bigcommerce::Middleware::Auth
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Bigcommerce::Middleware::Auth
- Defined in:
- lib/bigcommerce/middleware/auth.rb
Constant Summary collapse
- X_AUTH_CLIENT_HEADER =
'X-Auth-Client'- X_AUTH_TOKEN_HEADER =
'X-Auth-Token'
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.
9 10 11 12 13 |
# File 'lib/bigcommerce/middleware/auth.rb', line 9 def initialize(app, = {}) @app = app @options = super(app) end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 |
# File 'lib/bigcommerce/middleware/auth.rb', line 15 def call(env) env[:request_headers][X_AUTH_CLIENT_HEADER] = @options[:client_id] env[:request_headers][X_AUTH_TOKEN_HEADER] = @options[:access_token] @app.call env end |