lib/etsy/request.rb in etsy-0.3.3 vs lib/etsy/request.rb in etsy-0.3.4
- old
+ new
@@ -20,18 +20,18 @@
def self.put(resource_path, parameters = {})
request = Request.new(resource_path, parameters)
Response.new(request.put)
end
-
+
def self.delete(resource_path, parameters = {})
request = Request.new(resource_path, parameters)
Response.new(request.delete)
end
-
-
+
+
# Create a new request for the resource with optional parameters
def initialize(resource_path, parameters = {})
parameters = parameters.dup
@token = parameters.delete(:access_token) || Etsy.credentials[:access_token]
@secret = parameters.delete(:access_secret) || Etsy.credentials[:access_secret]
@@ -73,11 +73,11 @@
end
def put
client.put(endpoint_url)
end
-
+
def delete
client.delete(endpoint_url)
end
def client # :nodoc:
@@ -102,10 +102,10 @@
elsif val.is_a? Hash
val.reject { |k, v|
k.nil? || v.nil? || (k.respond_to?(:empty?) && k.empty?) || (v.respond_to?(:empty?) && v.empty?)
}.map { |k, v| "#{to_url(k.to_s)}=#{to_url(v)}" }.join('&')
else
- URI.escape(val.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
+ URI.encode_www_form_component(val.to_s)
end
end
def association(options={}) # :nodoc:
s = options[:resource].dup