Sha256: ea8c6d122cbfbf82af6723c0c423aaa0c192a70282fafa370612a8ceeb6f5bf5

Contents?: true

Size: 484 Bytes

Versions: 32

Compression:

Stored size: 484 Bytes

Contents

require 'base64'
require 'openssl'
require 'stringio'
require 'zlib'

module Adyen
  module Encoding
    def self.hmac_base64(hmac_key, message)
      digest = OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), hmac_key, message)
      Base64.encode64(digest).strip
    end

    def self.gzip_base64(message)
      sio = StringIO.new
      gz  = Zlib::GzipWriter.new(sio)
      gz.write(message)
      gz.close
      Base64.encode64(sio.string).gsub("\n", "")
    end
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
wvanbergen-adyen-0.1.0 lib/adyen/encoding.rb
wvanbergen-adyen-0.1.1 lib/adyen/encoding.rb
wvanbergen-adyen-0.1.5 lib/adyen/encoding.rb
adyen-1.4.0 lib/adyen/encoding.rb
adyen-1.3.2 lib/adyen/encoding.rb
adyen-1.3.1 lib/adyen/encoding.rb
adyen-1.3.0 lib/adyen/encoding.rb
adyen-1.2.0 lib/adyen/encoding.rb
adyen-1.1.0 lib/adyen/encoding.rb
adyen-1.0.0 lib/adyen/encoding.rb
fingertips-adyen-0.3.8.20101015 lib/adyen/encoding.rb
fingertips-adyen-0.3.8.20101007 lib/adyen/encoding.rb
fingertips-adyen-0.3.8.20100930.2 lib/adyen/encoding.rb
fingertips-adyen-0.3.8.20100930 lib/adyen/encoding.rb
fingertips-adyen-0.3.8.20100929 lib/adyen/encoding.rb
fingertips-adyen-0.3.8.20100924 lib/adyen/encoding.rb
adyen-0.3.8 lib/adyen/encoding.rb
fingertips-adyen-0.3.7.20100917 lib/adyen/encoding.rb
adyen-0.3.7 lib/adyen/encoding.rb
adyen-0.3.6 lib/adyen/encoding.rb