Class: Net::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/ephemeral_response/net_http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



6
7
8
# File 'lib/ephemeral_response/net_http.rb', line 6

def uri
  @uri
end

Instance Method Details

#connect_without_ephemeral_responseObject



4
# File 'lib/ephemeral_response/net_http.rb', line 4

alias connect_without_ephemeral_response connect

#generate_uri(request) ⇒ Object



18
19
20
21
# File 'lib/ephemeral_response/net_http.rb', line 18

def generate_uri(request)
  scheme = use_ssl? ? "https" : "http"
  @uri = URI.parse("#{scheme}://#{conn_address}:#{conn_port}#{request.path}")
end

#request(request, body = nil, &block) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/ephemeral_response/net_http.rb', line 23

def request(request, body = nil, &block)
  generate_uri(request)
  request.set_body_internal body
  EphemeralResponse::Fixture.respond_to(uri, request, block) do
    do_start_with_ephemeral_response
    request_without_ephemeral_response(request, nil, &block)
  end
end

#request_without_ephemeral_responseObject



3
# File 'lib/ephemeral_response/net_http.rb', line 3

alias request_without_ephemeral_response request