Class: BuildEval::Http

Inherits:
Object
  • Object
show all
Defined in:
lib/build_eval/http.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Http

Returns a new instance of Http.


5
6
7
8
9
# File 'lib/build_eval/http.rb', line 5

def initialize(config)
  @username        = config[:username]
  @password        = config[:password]
  @ssl_verify_mode = config[:ssl_verify_mode]
end

Instance Method Details

#get(uri_string) ⇒ Object


11
12
13
14
15
16
17
18
# File 'lib/build_eval/http.rb', line 11

def get(uri_string)
  uri = URI.parse(uri_string)
  Net::HTTP.start(uri.host, uri.port, ssl_options(uri)) do |http|
    request = Net::HTTP::Get.new(uri.request_uri)
    request.basic_auth(@username, @password) if @username && @password
    http.request(request)
  end
end