Class: RubyMyq::Device::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_myq/device/base.rb

Direct Known Subclasses

Gateway, LightSwitch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby_myq/device/base.rb', line 6

def initialize(device)
  @cached_hash = device_hash
  @parent_system = parent_system
  @id = device_hash["DeviceId"]
  device_hash["Attributes"].each do |elem|
    @name = elem["Value"] if elem["Name"] == "desc"
  end
  @myq_id = device_hash["MyQDeviceId"]
  @myq_name = device_hash["DeviceName"]
  @device_type = device_hash["MyQDeviceTypeName"]
end

Instance Attribute Details

#cached_hashObject (readonly)

Returns the value of attribute cached_hash.



4
5
6
# File 'lib/ruby_myq/device/base.rb', line 4

def cached_hash
  @cached_hash
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/ruby_myq/device/base.rb', line 4

def id
  @id
end

#myq_idObject (readonly)

Returns the value of attribute myq_id.



4
5
6
# File 'lib/ruby_myq/device/base.rb', line 4

def myq_id
  @myq_id
end

#myq_nameObject (readonly)

Returns the value of attribute myq_name.



4
5
6
# File 'lib/ruby_myq/device/base.rb', line 4

def myq_name
  @myq_name
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/ruby_myq/device/base.rb', line 4

def name
  @name
end

#parent_systemObject (readonly)

Returns the value of attribute parent_system.



4
5
6
# File 'lib/ruby_myq/device/base.rb', line 4

def parent_system
  @parent_system
end