class Typhoeus::Request
This class represents a request.
def eql?(other)
-
(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)
-
(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
-
(Integer)
- The integer representing the request.
def hash [ self.class, self.url, self.options ].hash end
def initialize(url, options = {})
-
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