Class: Faraday::MogueraAuthentication
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::MogueraAuthentication
- Defined in:
- lib/faraday/moguera_authentication.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, access_key, secret_access_key) ⇒ MogueraAuthentication
constructor
A new instance of MogueraAuthentication.
Constructor Details
#initialize(app, access_key, secret_access_key) ⇒ MogueraAuthentication
Returns a new instance of MogueraAuthentication.
7 8 9 10 11 |
# File 'lib/faraday/moguera_authentication.rb', line 7 def initialize(app, access_key, secret_access_key) super(app) # @app = app @access_key = access_key @secret_access_key = secret_access_key end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/faraday/moguera_authentication.rb', line 13 def call(env) params = build_parameter(env) request = Moguera::Authentication::Request.new(params) headers = { 'Authorization' => request.token, 'Content-Type' => params[:content_type], 'Date' => params[:http_date] } env.request_headers.merge!(headers) @app.call(env) end |