Class: VCR::LibraryHooks::Typhoeus::RequestHandler

Inherits:
RequestHandler show all
Defined in:
lib/vcr/library_hooks/typhoeus.rb,
lib/vcr/library_hooks/typhoeus_0.4.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestHandler

#handle

Methods included from VCR::Logger::Mixin

#log, #request_summary, #response_summary

Constructor Details

#initialize(request) ⇒ RequestHandler

Returns a new instance of RequestHandler.



17
18
19
20
# File 'lib/vcr/library_hooks/typhoeus.rb', line 17

def initialize(request)
  @request = request
  request.block_connection = false if VCR.turned_on?
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



16
17
18
# File 'lib/vcr/library_hooks/typhoeus.rb', line 16

def request
  @request
end

Instance Method Details

#vcr_requestObject



22
23
24
25
26
27
28
# File 'lib/vcr/library_hooks/typhoeus.rb', line 22

def vcr_request
  @vcr_request ||= VCR::Request.new \
    request.options.fetch(:method, :get),
    request.url,
    request_body,
    request.options.fetch(:headers, {})
end