Module: Typhoeus::Request::Operations

Included in:
Typhoeus::Request
Defined in:
lib/typhoeus/request/operations.rb

Overview

This module contains everything what is necessary to make a single request.

Since:

  • 0.5.0

Instance Method Summary collapse

Instance Method Details

#finish(response, bypass_memoization = nil) ⇒ Typhoeus::Response

Sets a response, the request on the response and executes the callbacks.

Parameters:

  • response (Typhoeus::Response)

    The response.

  • bypass_memoization (Boolean) (defaults to: nil)

    Wether to bypass memoization or not. Decides how the response is set.

Returns:

Since:

  • 0.5.0



28
29
30
31
32
33
34
35
36
37
# File 'lib/typhoeus/request/operations.rb', line 28

def finish(response, bypass_memoization = nil)
  if bypass_memoization
    @response = response
  else
    self.response = response
  end
  self.response.request = self
  execute_callbacks
  response
end

#runResponse

Run a request.

Examples:

Run a request.

Typhoeus::Request.new("www.example.com").run

Returns:

Since:

  • 0.5.0



14
15
16
17
18
# File 'lib/typhoeus/request/operations.rb', line 14

def run
  easy = EasyFactory.new(self).get
  easy.perform
  response
end