lib/sucker/request.rb in sucker-0.2.2 vs lib/sucker/request.rb in sucker-0.3.0
- old
+ new
@@ -1,9 +1,8 @@
-# = Sucker
-# Sucker is a thin Ruby wrapper to the {Amazon Product Advertising API}[http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/].
-#
module Sucker
+
+ # A wrapper around the API request
class Request
HOSTS = {
:us => 'ecs.amazonaws.com',
:uk => 'ecs.amazonaws.co.uk',
:de => 'ecs.amazonaws.de',
@@ -42,16 +41,15 @@
yield @curl if block_given?
@curl
end
- # Makes a request to Amazon and returns the response as a hash
- # Todo: Handle errors
+ # Performs the request and returns a response object
def get
curl.url = uri.to_s
curl.perform
- Crack::XML.parse(curl.body_str)
+ Response.new(curl)
end
# A helper method that sets the AWS Access Key ID
def key=(key)
parameters["AWSAccessKeyId"] = key