Class: ConsulSyncer::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/consul_syncer/endpoint.rb

Instance Method Summary collapse

Constructor Details

#initialize(service_hash) ⇒ Endpoint

Returns a new instance of Endpoint.



4
5
6
# File 'lib/consul_syncer/endpoint.rb', line 4

def initialize(service_hash)
  @hash = service_hash
end

Instance Method Details

#ipObject



32
33
34
# File 'lib/consul_syncer/endpoint.rb', line 32

def ip
  @hash.fetch('Node').fetch('Address')
end

#nameObject



8
9
10
# File 'lib/consul_syncer/endpoint.rb', line 8

def name
  @hash.fetch('Service').fetch('Service')
end

#nodeObject



20
21
22
# File 'lib/consul_syncer/endpoint.rb', line 20

def node
  @hash.fetch('Node').fetch('Node')
end

#portObject



24
25
26
# File 'lib/consul_syncer/endpoint.rb', line 24

def port
  @hash.fetch('Service').fetch('Port')
end

#service_addressObject



16
17
18
# File 'lib/consul_syncer/endpoint.rb', line 16

def service_address
  @hash.fetch('Service').fetch('Address')
end

#service_idObject



12
13
14
# File 'lib/consul_syncer/endpoint.rb', line 12

def service_id
  @hash.fetch('Service').fetch('ID')
end

#tagsObject



28
29
30
# File 'lib/consul_syncer/endpoint.rb', line 28

def tags
  @hash.fetch('Service').fetch('Tags', [])
end