Class: RestMan::Request::NetHTTPObject

Inherits:
ActiveMethod::Base
  • Object
show all
Defined in:
lib/restman/request/net_http_object.rb

Instance Method Summary collapse

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/restman/request/net_http_object.rb', line 8

def call
  p_uri = request.proxy_uri

  if p_uri.nil?
    # no proxy set
    Net::HTTP.new(hostname, port)
  elsif !p_uri
    # proxy explicitly set to none
    Net::HTTP.new(hostname, port, nil, nil, nil, nil)
  else
    Net::HTTP.new(hostname, port,
                  p_uri.hostname, p_uri.port, p_uri.user, p_uri.password)
  end
end