Sha256: 8ac0ed46d5c3be1a52ae47a67069db714d41dff75374bdd5da1e49c7a80f19a5
Contents?: true
Size: 676 Bytes
Versions: 4
Compression:
Stored size: 676 Bytes
Contents
require 'ey-hmac' require 'faraday' if Faraday.respond_to? :register_middleware Faraday.register_middleware(:request, {:hmac => lambda { Ey::Hmac::Faraday }}) end # Request middleware that performs HMAC request signing class Ey::Hmac::Faraday < Faraday::Middleware dependency do require 'ey-hmac' unless defined?(Ey::Hmac) end 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
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ey-hmac-0.1.3 | lib/ey-hmac/faraday.rb |
ey-hmac-0.1.2 | lib/ey-hmac/faraday.rb |
ey-hmac-0.1.1 | lib/ey-hmac/faraday.rb |
ey-hmac-0.0.5 | lib/ey-hmac/faraday.rb |