Class: Insnergy::Widget
- Inherits:
-
Object
- Object
- Insnergy::Widget
- Defined in:
- lib/insnergy-api-ruby-client.rb
Instance Attribute Summary collapse
-
#widget_alias ⇒ Object
readonly
Returns the value of attribute widget_alias.
-
#widget_dev_id ⇒ Object
readonly
Returns the value of attribute widget_dev_id.
-
#widget_dev_type_name ⇒ Object
readonly
Returns the value of attribute widget_dev_type_name.
-
#widget_status ⇒ Object
readonly
Returns the value of attribute widget_status.
Instance Method Summary collapse
- #co2_meter ⇒ Object
- #co_meter ⇒ Object
-
#initialize(opts = {}) ⇒ Widget
constructor
A new instance of Widget.
- #sensor_th_ty ⇒ Object
- #widget_info_value ⇒ Object
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_alias ⇒ Object (readonly)
Returns the value of attribute widget_alias.
109 110 111 |
# File 'lib/insnergy-api-ruby-client.rb', line 109 def @widget_alias end |
#widget_dev_id ⇒ Object (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 end |
#widget_dev_type_name ⇒ Object (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 end |
#widget_status ⇒ Object (readonly)
Returns the value of attribute widget_status.
109 110 111 |
# File 'lib/insnergy-api-ruby-client.rb', line 109 def @widget_status end |
Instance Method Details
#co2_meter ⇒ Object
130 131 132 |
# File 'lib/insnergy-api-ruby-client.rb', line 130 def co2_meter @infos['400600'] end |
#co_meter ⇒ Object
126 127 128 |
# File 'lib/insnergy-api-ruby-client.rb', line 126 def co_meter @infos['400700'] end |
#sensor_th_ty ⇒ Object
134 135 136 |
# File 'lib/insnergy-api-ruby-client.rb', line 134 def sensor_th_ty "#{@infos['400100']}|#{@infos['400200']}" end |
#widget_info_value ⇒ Object
122 123 124 |
# File 'lib/insnergy-api-ruby-client.rb', line 122 def @widget_dev_type_name end |