Sha256: 316875291db3a1eadb47addc80c0be1161bf21473e8b07afe4a014f8f2c18a8e

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

require 'ey-hmac'
require 'faraday'

class Ey::Hmac::Faraday < Faraday::Middleware
  dependency('ey-hmac') if respond_to?(:dependency)

  attr_reader :key_id, :key_secret, :options

  def initialize(app, key_id, key_secret, options = {})
    super(app)
    @key_id = key_id
    @key_secret = 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

2 entries across 2 versions & 1 rubygems

Version Path
ey-hmac-2.4.0 lib/ey-hmac/faraday.rb
ey-hmac-2.3.1 lib/ey-hmac/faraday.rb