Method: HTTP::Requestor#initialize

Defined in:
lib/http_requestor.rb

#initialize(domain, options = {}) ⇒ Requestor

Instance Methods ===================


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

def initialize(domain, options={})
  domain = "http://#{domain}" if domain.match(/^(http|https):\/\//).nil?
  
  @defaults = {:domain => domain}
  @uri = URI.parse(@defaults[:domain])
  if @uri.scheme == "http"
    @http = Net::HTTP.new(@uri.host, @uri.port)
  else
    @http = Net::HTTP.new(@uri.host, @uri.port)
    @http.use_ssl = true
    @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end
end