Class: RubyHome::Service
- Inherits:
-
Object
- Object
- RubyHome::Service
- Defined in:
- lib/ruby_home/hap/service.rb
Instance Attribute Summary collapse
-
#accessory ⇒ Object
readonly
Returns the value of attribute accessory.
-
#characteristics ⇒ Object
readonly
Returns the value of attribute characteristics.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#hidden ⇒ Object
readonly
Returns the value of attribute hidden.
-
#instance_id ⇒ Object
Returns the value of attribute instance_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#primary ⇒ Object
readonly
Returns the value of attribute primary.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #characteristic(characteristic_name) ⇒ Object
-
#initialize(accessory:, primary: false, hidden: false, name:, description:, uuid:) ⇒ Service
constructor
A new instance of Service.
- #inspect ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(accessory:, primary: false, hidden: false, name:, description:, uuid:) ⇒ Service
Returns a new instance of Service.
3 4 5 6 7 8 9 10 11 |
# File 'lib/ruby_home/hap/service.rb', line 3 def initialize(accessory: , primary: false, hidden: false, name:, description:, uuid:) @accessory = accessory @primary = primary @hidden = hidden @name = name @description = description @uuid = uuid @characteristics = [] end |
Instance Attribute Details
#accessory ⇒ Object (readonly)
Returns the value of attribute accessory.
13 14 15 |
# File 'lib/ruby_home/hap/service.rb', line 13 def accessory @accessory end |
#characteristics ⇒ Object (readonly)
Returns the value of attribute characteristics.
13 14 15 |
# File 'lib/ruby_home/hap/service.rb', line 13 def characteristics @characteristics end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
13 14 15 |
# File 'lib/ruby_home/hap/service.rb', line 13 def description @description end |
#hidden ⇒ Object (readonly)
Returns the value of attribute hidden.
13 14 15 |
# File 'lib/ruby_home/hap/service.rb', line 13 def hidden @hidden end |
#instance_id ⇒ Object
Returns the value of attribute instance_id.
14 15 16 |
# File 'lib/ruby_home/hap/service.rb', line 14 def instance_id @instance_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/ruby_home/hap/service.rb', line 13 def name @name end |
#primary ⇒ Object (readonly)
Returns the value of attribute primary.
13 14 15 |
# File 'lib/ruby_home/hap/service.rb', line 13 def primary @primary end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
13 14 15 |
# File 'lib/ruby_home/hap/service.rb', line 13 def uuid @uuid end |
Instance Method Details
#characteristic(characteristic_name) ⇒ Object
16 17 18 19 20 |
# File 'lib/ruby_home/hap/service.rb', line 16 def characteristic(characteristic_name) characteristics.find do |characteristic| characteristic.name == characteristic_name end end |
#inspect ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/ruby_home/hap/service.rb', line 27 def inspect { primary: primary, hidden: hidden, characteristics: characteristics } end |
#save ⇒ Object
22 23 24 25 |
# File 'lib/ruby_home/hap/service.rb', line 22 def save IdentifierCache.add_accessory(accessory) IdentifierCache.add_service(self) end |