Sha256: 26dac5fded6a80d7c64731c48e284f64dfe8145b31144895e1966080beb6c8b5

Contents?: true

Size: 424 Bytes

Versions: 2

Compression:

Stored size: 424 Bytes

Contents

module Tenpay
  module Utils
    def self.stringify_keys(hash)
      new_hash = {}
      hash.each do |key, value|
        new_hash[(key.to_s rescue key) || key] = value
      end
      new_hash
    end

    def self.make_query_string(options)
      options.merge('sign' => Tenpay::Sign.generate(options)).map do |key, value|
        "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
      end.join('&')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jasl_tenpay-1.0.0 lib/tenpay/utils.rb
jasl_tenpay-0.0.2 lib/tenpay/utils.rb