Sha256: 2ae549bd8594c558768db1c8754ea0af1b27827ebf002fd748b3f5acce685f20

Contents?: true

Size: 522 Bytes

Versions: 4

Compression:

Stored size: 522 Bytes

Contents

module Fpswax
  class IpnRequest
    include Mixins::HmacSignature

    def initialize(params, secret_key)
      @signature = params.delete('signature')
      strip_keys_from!(params, 'action', 'controller')
      @params = params
      @secret_key = secret_key
    end

    def valid?
      return false if !@signature
      generate_signature_for(@params, @secret_key) == @signature
    end

    private
    def strip_keys_from!(hash, *keys)
      keys.each do |key|
        hash.delete(key)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dbalatero-fpswax-0.0.1 lib/fpswax/ipn_request.rb
dbalatero-fpswax-0.0.2 lib/fpswax/ipn_request.rb
dbalatero-fpswax-0.0.3 lib/fpswax/ipn_request.rb
dbalatero-fpswax-0.0.4 lib/fpswax/ipn_request.rb