class Typhoeus::Request

This class represents a request.

def eql?(other)

Returns:
  • (Boolean) - Returns true if equals, else false.

Parameters:
  • other (Object) -- The object to check.

Other tags:
    Example: Are request equal? -
def eql?(other)
  self.class == other.class &&
    self.url == other.url &&
    fuzzy_hash_eql?(self.options, other.options)
end

def fuzzy_hash_eql?(left, right)

Returns:
  • (Boolean) - Returns true if hashes have same values for same keys and same length,

Parameters:
  • other (Hash) -- hash to check for equality
  • hash (Hash) --
def fuzzy_hash_eql?(left, right)
  return true if (left == right)
  (left.count == right.count) && left.inject(true) do |res, kvp|
    res && (kvp[1] == right[kvp[0]])
  end
end

def hash

Returns:
  • (Integer) - The integer representing the request.
def hash
  [ self.class, self.url, self.options ].hash
end

def initialize(url, options = {})

Parameters:
  • options (Hash) -- The options.
  • url (String) -- The url to request.

Other tags:
    Example: Create a request. -
def initialize(url, options = {})
  @url = url
  @options = options.dup
  if @options[:headers]
    @options[:headers] = {'User-Agent' => Typhoeus::USER_AGENT}.merge(options[:headers])
  else
    @options[:headers] = {'User-Agent' => Typhoeus::USER_AGENT}
  end
  @options[:verbose] = Typhoeus::Config.verbose unless @options[:verbose]
end