Class: Ey::Hmac::Faraday

Inherits:
Faraday::Response::Middleware
  • 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.



9
10
11
12
13
# File 'lib/ey-hmac/faraday.rb', line 9

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.



7
8
9
# File 'lib/ey-hmac/faraday.rb', line 7

def key_id
  @key_id
end

#key_secretObject (readonly)

Returns the value of attribute key_secret.



7
8
9
# File 'lib/ey-hmac/faraday.rb', line 7

def key_secret
  @key_secret
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/ey-hmac/faraday.rb', line 7

def options
  @options
end

Instance Method Details

#call(env) ⇒ Object



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

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