lib/stripe/util.rb in stripe-1.29.0 vs lib/stripe/util.rb in stripe-1.29.1

- old
+ new

@@ -1,7 +1,5 @@ -require "webrick" - module Stripe module Util def self.objects_to_ids(h) case h when APIResource @@ -93,13 +91,10 @@ object end end def self.url_encode(key) - # Unfortunately, URI.escape was deprecated. Here we use a method from - # WEBrick instead given that it's a fairly close approximation (credit to - # the AWS Ruby SDK for coming up with the technique). - WEBrick::HTTPUtils.escape(key.to_s).gsub('%5B', '[').gsub('%5D', ']') + 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|