Class: Boxcutter::LoadBalancer::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/boxcutter/load_balancer/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api, attrs) ⇒ Service

Returns a new instance of Service.



5
6
7
8
# File 'lib/boxcutter/load_balancer/service.rb', line 5

def initialize(api, attrs)
  @api = api
  @attrs = attrs
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



3
4
5
# File 'lib/boxcutter/load_balancer/service.rb', line 3

def api
  @api
end

Instance Method Details

#backendsObject



38
39
40
# File 'lib/boxcutter/load_balancer/service.rb', line 38

def backends
  api.backends(id).map {|attrs| Backend.new(api, attrs)}
end

#http?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/boxcutter/load_balancer/service.rb', line 30

def http?
  service_type == 'http'
end

#https?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/boxcutter/load_balancer/service.rb', line 34

def https?
  service_type == 'https'
end

#idObject



22
23
24
# File 'lib/boxcutter/load_balancer/service.rb', line 22

def id
  @attrs["id"]
end

#nameObject



14
15
16
# File 'lib/boxcutter/load_balancer/service.rb', line 14

def name
  @attrs["name"]
end

#portObject



18
19
20
# File 'lib/boxcutter/load_balancer/service.rb', line 18

def port
  @attrs["port"]
end

#service_typeObject



26
27
28
# File 'lib/boxcutter/load_balancer/service.rb', line 26

def service_type
  @attrs["service_type"]
end

#to_sObject



10
11
12
# File 'lib/boxcutter/load_balancer/service.rb', line 10

def to_s
  "#<Service id:'#{id}' name:'#{name}' port:'#{port}' service_type:'#{service_type}'>"
end