Class: RubyHome::HTTP::CharacteristicSerializer

Inherits:
Object
  • Object
show all
Includes:
ObjectSerializer, UUIDHelper
Defined in:
lib/ruby_home/http/serializers/characteristic_serializer.rb

Constant Summary

Constants included from UUIDHelper

UUIDHelper::APPLE_BASE_UUID

Instance Method Summary collapse

Methods included from UUIDHelper

#apple_defined_uuid?, #trim_leading_zeros, #uuid_short_form

Methods included from ObjectSerializer

#initialize, #root, #serializable_hash, #serialized_json

Instance Method Details

#record_hash(characteristic) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby_home/http/serializers/characteristic_serializer.rb', line 10

def record_hash(characteristic)
  {
    'iid' => characteristic.instance_id,
    'type' => uuid_short_form(characteristic.uuid),
    'perms' => perms(characteristic),
    'format' => characteristic.format,
    'description' => characteristic.description,
  }
    .merge(value_hash(characteristic))
    .merge(valid_values_hash(characteristic))
end