lib/amazon-associates/request.rb in amazon-associates-0.7.0 vs lib/amazon-associates/request.rb in amazon-associates-0.7.1

- old
+ new

@@ -31,30 +31,32 @@ opts.to_options! opts.reverse_merge! options.except(:caching_options, :caching_strategy) if opts[:aWS_access_key_id].blank? raise ArgumentError, "amazon-associates requires the :aws_access_key_id option" end + log_body = opts.delete(:log) request_url = prepare_url(opts) response = nil if cache_it = cacheable?(opts[:operation]) FilesystemCache.sweep response = FilesystemCache.get(request_url) end - if response.nil? + unless response log "Request URL: #{request_url}" response = Net::HTTP.get_response(URI::parse(request_url)) unless response.kind_of? Net::HTTPSuccess raise RequestError, "HTTP Response: #{response.inspect}" end cache_response(request_url, response) if cache_it end doc = ROXML::XML::Node.from(response.body) + log(doc) if log_body eval(doc.name).from_xml(doc, request_url) end BASE_ARGS = [:aWS_access_key_id, :operation, :associate_tag, :response_group] CART_ARGS = [:cart_id, :hMAC]