Class: Ey::Hmac::Faraday

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



11
12
13
14
15
16
# File 'lib/ey-hmac/faraday.rb', line 11

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

Instance Attribute Details

#key_idObject (readonly)

Returns the value of attribute key_id.



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

def key_id
  @key_id
end

#key_secretObject (readonly)

Returns the value of attribute key_secret.



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

def key_secret
  @key_secret
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#call(env) ⇒ Object



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

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