Class: Insnergy::Widget

Inherits:
Object
  • Object
show all
Defined in:
lib/insnergy-api-ruby-client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Widget

Returns a new instance of Widget.



111
112
113
114
115
116
117
118
119
120
# File 'lib/insnergy-api-ruby-client.rb', line 111

def initialize(opts = {})
  @infos = Hash.new
  @widget_dev_id = opts['dev_id']
  @widget_dev_type_name = opts['dev_type_name']
  @widget_alias = opts['alias']
  @widget_status = opts['status']
  opts['widget_infos'].each do |ele|
    @infos[ele['info_name']] = ele['info_value']
  end
end

Instance Attribute Details

#widget_aliasObject (readonly)

Returns the value of attribute widget_alias.



109
110
111
# File 'lib/insnergy-api-ruby-client.rb', line 109

def widget_alias
  @widget_alias
end

#widget_dev_idObject (readonly)

Returns the value of attribute widget_dev_id.



109
110
111
# File 'lib/insnergy-api-ruby-client.rb', line 109

def widget_dev_id
  @widget_dev_id
end

#widget_dev_type_nameObject (readonly)

Returns the value of attribute widget_dev_type_name.



109
110
111
# File 'lib/insnergy-api-ruby-client.rb', line 109

def widget_dev_type_name
  @widget_dev_type_name
end

#widget_statusObject (readonly)

Returns the value of attribute widget_status.



109
110
111
# File 'lib/insnergy-api-ruby-client.rb', line 109

def widget_status
  @widget_status
end

Instance Method Details

#co2_meterObject



130
131
132
# File 'lib/insnergy-api-ruby-client.rb', line 130

def co2_meter
  @infos['400600']
end

#co_meterObject



126
127
128
# File 'lib/insnergy-api-ruby-client.rb', line 126

def co_meter
  @infos['400700']
end

#sensor_th_tyObject



134
135
136
# File 'lib/insnergy-api-ruby-client.rb', line 134

def sensor_th_ty
  "#{@infos['400100']}|#{@infos['400200']}"
end

#widget_info_valueObject



122
123
124
# File 'lib/insnergy-api-ruby-client.rb', line 122

def widget_info_value
  @widget_dev_type_name
end