lib/pagarme/util.rb in pagarme-1.9.8 vs lib/pagarme/util.rb in pagarme-1.9.9
- old
+ new
@@ -24,11 +24,11 @@
response
end
end
def self.url_encode(key)
- URI.escape(key.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
+ URI.encode_www_form_component(key.to_s)
end
def self.normalize_params(parameters, parent = nil)
ret = []
@@ -38,11 +38,11 @@
when Hash
ret += normalize_params(v, current_key)
when Array
ret += normalize_array_params(v, current_key)
else
- ret << [current_key, v]
+ ret << [current_key, url_encode(v)]
end
end
ret
end
@@ -53,10 +53,10 @@
when Hash
ret += normalize_params(element, current_key)
when Array
ret += normalize_array_params(element, current_key)
else
- ret << ["#{current_key}[]", element]
+ ret << ["#{current_key}[]", url_encode(element)]
end
end
ret
end
end