Sha256: 0f76dcb7454151e20658b1fc3b43d00e7242c28a5d8c64c811c4d0a8eb375a56
Contents?: true
Size: 867 Bytes
Versions: 92
Compression:
Stored size: 867 Bytes
Contents
module HTTParty module HashConversions # @param key<Object> The key for the param. # @param value<Object> The value for the param. # # @return <String> This key value pair as a param # # @example normalize_param(:name, "Bob Jones") #=> "name=Bob%20Jones&" def self.normalize_param(key, value) normalized_keys = normalize_keys(key, value) normalized_keys.flatten.each_slice(2).inject('') do |string, (k, v)| # TODO: TJ - Our API needs nil params to be blank, aka '&someParam&' # and not '&someParam=', otherwise we take that as an empty string. # Monkey patch to get around this problem. if v.nil? string + "#{ERB::Util.url_encode(k)}&" else string + "#{ERB::Util.url_encode(k)}=#{ERB::Util.url_encode(v.to_s)}&" end end end end end
Version data entries
92 entries across 92 versions & 1 rubygems