Module: HabitatSupervisor::Connection

Included in:
Client
Defined in:
lib/habitat_supervisor/connection.rb

Instance Method Summary collapse

Instance Method Details

#get(path, options = {}) ⇒ Object



6
7
8
9
10
# File 'lib/habitat_supervisor/connection.rb', line 6

def get(path, options = {})
  req = Net::HTTP::Get.new(path, options)
  response = http.request(req)
  JSON.parse(response.body)
end

#httpObject



16
17
18
# File 'lib/habitat_supervisor/connection.rb', line 16

def http
  @http ||= Net::HTTP.new(url.host, url.port)
end

#urlObject



12
13
14
# File 'lib/habitat_supervisor/connection.rb', line 12

def url
  @url ||= URI.parse(api_endpoint)
end