class Typhoeus::Response

This class represents the response.

Attributes

handled_response[W]

Set the handled response.

mock[W]

@api private

options[RW]

The provided options, which contain all the informations about the request.

@return [ Hash ]

request[RW]

Remembers the corresponding request.

@example Get request.

request = Typhoeus::Request.get("www.example.com")
response = request.run
request == response.request
#=> true

@return [ Typhoeus::Request ]

Public Class Methods

new(options = {}) click to toggle source

Create a new response.

@example Create a response.

Response.new

@param [ Hash ] options The options hash.

@return [ Response ] The new response.

# File lib/typhoeus/response.rb, line 45
def initialize(options = {})
  @options = options
  @headers = Header.new(options[:headers]) if options[:headers]
end

Public Instance Methods

handled_response() click to toggle source

Returns the #handled_response if it has been defined; otherwise, returns the response

@return [ Object ] The result of callbacks

done on the response or the original response.
# File lib/typhoeus/response.rb, line 64
def handled_response
  @handled_response || self
end
mock() click to toggle source

Returns whether this request is mocked or not.

@api private

# File lib/typhoeus/response.rb, line 54
def mock
  defined?(@mock) ? @mock : options[:mock]
end
Also aliased as: mock?
mock?()
Alias for: mock