lib/sucker/request.rb in sucker-0.9.0 vs lib/sucker/request.rb in sucker-0.9.1
- old
+ new
@@ -39,15 +39,12 @@
parameters["AssociateTag"] = token
end
# A reusable, configurable cURL object
def curl
- @curl ||= Curl::Easy.new
-
- yield @curl if block_given?
-
- @curl
+ yield curl_object if block_given?
+ curl_object
end
# Performs the request and returns a response object
def get
curl.url = uri.to_s
@@ -70,9 +67,13 @@
sort.
collect do |k, v|
"#{k}=" + CGI.escape(v.is_a?(Array) ? v.join(",") : v.to_s)
end.
join("&")
+ end
+
+ def curl_object
+ @curl ||= Curl::Easy.new
end
def host
HOSTS[locale.to_sym]
end