Class: ContainersManager::ConsulService

Inherits:
Object
  • Object
show all
Defined in:
lib/containers_manager/services/consul_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ ConsulService

Returns a new instance of ConsulService.



5
6
7
# File 'lib/containers_manager/services/consul_service.rb', line 5

def initialize(configuration)
  @configuration = configuration
end

Instance Method Details

#deregister(id) ⇒ Object



14
15
16
# File 'lib/containers_manager/services/consul_service.rb', line 14

def deregister(id)
  system("curl -XPUT #{@configuration.consul_deregister_url}/#{id}")
end

#services(url) ⇒ Object



9
10
11
12
# File 'lib/containers_manager/services/consul_service.rb', line 9

def services(url)
  resp = `curl -sSL #{url}`
  JSON.parse(resp)
end