Sha256: ecc259ac1a1f5dc5f9e3c6c2eac864653a27567030857a6094931c8e4fbb6630

Contents?: true

Size: 522 Bytes

Versions: 6

Compression:

Stored size: 522 Bytes

Contents

require 'ey-hmac'
require 'faraday'

class Ey::Hmac::Faraday < Faraday::Response::Middleware
  dependency("ey-hmac")

  attr_reader :key_id, :key_secret, :options

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

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

Faraday::Middleware.register_middleware :hmac => Ey::Hmac::Faraday

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ey-hmac-2.3.0 lib/ey-hmac/faraday.rb
ey-hmac-2.2.0 lib/ey-hmac/faraday.rb
ey-hmac-2.1.0 lib/ey-hmac/faraday.rb
ey-hmac-2.0.2 lib/ey-hmac/faraday.rb
ey-hmac-2.0.1 lib/ey-hmac/faraday.rb
ey-hmac-2.0.0 lib/ey-hmac/faraday.rb