Method: Rest#initialize

Defined in:
lib/pf-command/rest.rb

#initialize(url, user = nil, password = nil) ⇒ Rest

Returns a new instance of Rest.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pf-command/rest.rb', line 17

def initialize(url, user = nil, password = nil)
  $user = user
  $password = password
  
  uri = URI(url)
  $http = Net::HTTP.new(uri.host, uri.port)
  
  if uri.scheme == 'https'
    $http.use_ssl = true
    $http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  else
    $http.use_ssl = false
  end
end