lib/stripe/util.rb in stripe-1.7.2 vs lib/stripe/util.rb in stripe-1.7.3
- old
+ new
@@ -65,17 +65,17 @@
else
object
end
end
- def self.encode_key(key)
+ def self.url_encode(key)
URI.escape(key.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
end
def self.flatten_params(params, parent_key=nil)
result = []
params.each do |key, value|
- calculated_key = parent_key ? "#{parent_key}[#{encode_key(key)}]" : encode_key(key)
+ calculated_key = parent_key ? "#{parent_key}[#{url_encode(key)}]" : url_encode(key)
if value.is_a?(Hash)
result += flatten_params(value, calculated_key)
elsif value.is_a?(Array)
result += flatten_params_array(value, calculated_key)
else