Class: HueResource
- Inherits:
-
Object
- Object
- HueResource
- Defined in:
- lib/ha/hue_resource.rb
Instance Method Summary collapse
- #gen_reskey(detail) ⇒ Object
-
#initialize(key, hash_value) ⇒ HueResource
constructor
A new instance of HueResource.
Constructor Details
#initialize(key, hash_value) ⇒ HueResource
Returns a new instance of HueResource.
2 3 4 5 6 7 8 |
# File 'lib/ha/hue_resource.rb', line 2 def initialize(key, hash_value) @hash_value = hash_value @lastupdated = @hash_value.dig("state", "lastupdated") @detail = hash_value["type"] @name = hash_value["name"] @state = { "key" => key, "lastupdated" => @lastupdated, "detail" => @detail, "name" => @name} end |
Instance Method Details
#gen_reskey(detail) ⇒ Object
10 11 12 |
# File 'lib/ha/hue_resource.rb', line 10 def gen_reskey(detail) @state.merge!({ "id" => detail + @state["key"]}) end |