Module: EZPaypal::Helper
- Defined in:
- lib/core/helper.rb
Class Method Summary (collapse)
- + (Object) ConvertHashToQueryString(hash)
-
+ (Hash) ConvertParamToHash(object)
Helper method to convert query string to hash also convert hash to encoded hash.
Class Method Details
+ (Object) ConvertHashToQueryString(hash)
29 30 31 |
# File 'lib/core/helper.rb', line 29 def self.ConvertHashToQueryString (hash) hash.map { |k, v| CGI::escape(k.to_s)+"="+CGI::escape(v.to_s) }.join("&") end |
+ (Hash) ConvertParamToHash(object)
Helper method to convert query string to hash also convert hash to encoded hash
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/core/helper.rb', line 10 def self.ConvertParamToHash (object) hash_obj = HashWithIndifferentAccess.new() if (object.class.to_s == "String") object.split("&").each do |e| key = CGI::unescape(e.split("=")[0]) value = CGI::unescape(e.split("=")[1]) hash_obj.merge!(key => value) end else object.each do |key, value| key = CGI::unescape(key) value = CGI::unescape(value) hash_obj.merge!(key.upcase => value) end end return hash_obj end |