class Typhoeus::Request

@see (see #initialize)
response = Typhoeus.get(“www.example.com”)
@example Make a request with the shortcut.
@example (see #initialize)
This class represents a request.

def eql?(other)

Other tags:
    Api: - private

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.base_url == other.base_url &&
    fuzzy_hash_eql?(self.options, other.options)
end

def fuzzy_hash_eql?(left, right)

Returns:
  • (Boolean) - Returns true if hashes have

Parameters:
  • right (Hash) -- hash to check for equality
  • left (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

Other tags:
    Api: - private

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

def initialize(base_url, options = {})

Other tags:
    See: Typhoeus::Request::Actions -
    See: Typhoeus::Response -
    See: Typhoeus::Hydra -

Other tags:
    Note: - See {http://rubydoc.info/github/typhoeus/ethon/Ethon/Easy/Options Ethon::Easy::Options} for more options.

Returns:
  • (Typhoeus::Request) - The request.

Options Hash: (**options)
  • :body (Hash) -- Translated
  • :params (Hash) -- Translated

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

Other tags:
    Example: Create a request and allow follow redirections. -
    Example: Request with parameters and body. -
    Example: Request with a body. -
    Example: Request with url parameters. -
    Example: Simplest request. -
def initialize(base_url, options = {})
  @base_url = base_url
  @original_options = options
  @options = options.dup
  set_defaults
end

def set_defaults

Sets default header and verbose when turned on.
def set_defaults
  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 if @options[:verbose].nil? && !Typhoeus::Config.verbose.nil?
end

def url

Other tags:
    Since: - 0.5.5

Other tags:
    Example: Get the url. -
def url
  EasyFactory.new(self).get.url
end