Class: Boxcutter::LoadBalancer::Service
- Inherits:
-
Object
- Object
- Boxcutter::LoadBalancer::Service
- Defined in:
- lib/boxcutter/load_balancer/service.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
- #backends ⇒ Object
- #http? ⇒ Boolean
- #https? ⇒ Boolean
- #id ⇒ Object
-
#initialize(api, attrs) ⇒ Service
constructor
A new instance of Service.
- #name ⇒ Object
- #port ⇒ Object
- #service_type ⇒ Object
- #to_s ⇒ Object
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
#api ⇒ Object (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
#backends ⇒ Object
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
30 31 32 |
# File 'lib/boxcutter/load_balancer/service.rb', line 30 def http? service_type == 'http' end |
#https? ⇒ Boolean
34 35 36 |
# File 'lib/boxcutter/load_balancer/service.rb', line 34 def https? service_type == 'https' end |
#id ⇒ Object
22 23 24 |
# File 'lib/boxcutter/load_balancer/service.rb', line 22 def id @attrs["id"] end |
#name ⇒ Object
14 15 16 |
# File 'lib/boxcutter/load_balancer/service.rb', line 14 def name @attrs["name"] end |
#port ⇒ Object
18 19 20 |
# File 'lib/boxcutter/load_balancer/service.rb', line 18 def port @attrs["port"] end |
#service_type ⇒ Object
26 27 28 |
# File 'lib/boxcutter/load_balancer/service.rb', line 26 def service_type @attrs["service_type"] end |
#to_s ⇒ Object
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 |