lib/wrest/curl/request.rb
# Makes a request and returns a Wrest::Native::Response.
# Data about the request is and logged to Wrest.logger
# The log entry contains the following information:
#
#   <- indicates a request
#   -> indicates a response
#
# The type of request is mentioned in caps, followed by a hash
# uniquely uniquely identifying a particular request/response pair.
# In a multi-process or multi-threaded scenario, this can be used
# to identify request-response pairs.
#
# The request hash is followed by a connection hash; requests using the
# same connection (effectively a keep-alive connection) will have the
# same connection hash.
#
# This is followed by the response code, the payload size and the time taken.
Makes a request and returns a Wrest::Native::Response.
Data about the request is and logged to Wrest.logger
The log entry contains the following information.

<- indicates a request
> indicates a response

The type of request is mentioned in caps, followed by a hash
uniquely uniquely identifying a particular request/response pair.
In a multi-process or multi-threaded scenario, this can be used
to identify request-response pairs.

The request hash is followed by a connection hash; requests using the
same connection (effectively a keep-alive connection) will have the
same connection hash.

This is followed by the response code, the payload size and the time taken.
Makes a request and returns a Wrest :: Native :: Response . Data about the request is and logged to Wrest . logger The log entry contains the following information . < - indicates a request > indicates a response The type of request is mentioned in caps followed by a hash uniquely uniquely identifying a particular request / response pair . In a multi - process or multi - threaded scenario this can be used to identify request - response pairs . The request hash is followed by a connection hash ; requests using the same connection ( effectively a keep - alive connection ) will have the same connection hash . This is followed by the response code the payload size and the time taken .
def invoke
        response = nil
        @connection ||= Patron::Session.new
        raise ArgumentError, "Empty URL" if http_request.url.empty?
        prefix = "#{http_request.action.to_s.upcase} #{http_request.hash} #{connection.hash}"
        Wrest.logger.debug "<- (#{prefix}) #{http_request.url}"
        time = Benchmark.realtime { response =  Wrest::Curl::Response.new(connection.handle_request(http_request))}
        Wrest.logger.debug "-> (#{prefix}) %s (%d bytes %.2fs)" % [response.message, response.body ? response.body.length : 0, time]
        response
      rescue Patron::TimeoutError => e
        raise Wrest::Exceptions::Timeout.new(e)
      end
def invoke response = nil @connection ||= Patron :: Session . new raise ArgumentError , "Empty URL" if http_request . url . empty? prefix = "#{http_request.action.to_s.upcase} #{http_request.hash} #{connection.hash}" Wrest . logger . debug "<- (#{prefix}) #{http_request.url}" time = Benchmark . realtime { response = Wrest :: Curl :: Response . new ( connection . handle_request ( http_request ) ) } Wrest . logger . debug "-> (#{prefix}) %s (%d bytes %.2fs)" % [ response . message , response . body ? response . body . length : 0 , time ] response rescue Patron :: TimeoutError => e raise Wrest :: Exceptions :: Timeout . new ( e ) end
Makes a request and returns a Wrest::Native::Response.
Makes a request and returns a Wrest :: Native :: Response .