Class: Ey::Hmac::Faraday

Inherits:
FaradayMiddleware::ResponseMiddleware
  • Object
show all
Defined in:
lib/ey-hmac/faraday.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, key_id, key_secret, options = {}) ⇒ Faraday

Returns a new instance of Faraday.



18
19
20
21
22
# File 'lib/ey-hmac/faraday.rb', line 18

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

Instance Attribute Details

#key_idObject (readonly)

Returns the value of attribute key_id.



16
17
18
# File 'lib/ey-hmac/faraday.rb', line 16

def key_id
  @key_id
end

#key_secretObject (readonly)

Returns the value of attribute key_secret.



16
17
18
# File 'lib/ey-hmac/faraday.rb', line 16

def key_secret
  @key_secret
end

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/ey-hmac/faraday.rb', line 16

def options
  @options
end

Instance Method Details

#call(env) ⇒ Object



24
25
26
27
# File 'lib/ey-hmac/faraday.rb', line 24

def call(env)
  Ey::Hmac.sign!(env, key_id, key_secret, {adapter: Ey::Hmac::Adapter::Faraday}.merge(options))
  @app.call(env)
end