Class: NestConnect::Device::Structure
- Inherits:
-
Object
- Object
- NestConnect::Device::Structure
- Defined in:
- lib/nest_connect/devices/structure.rb
Constant Summary collapse
- AWAY_VALUES =
['home', 'away']
Instance Attribute Summary collapse
-
#away ⇒ Object
Returns the value of attribute away.
-
#co_alarm_state ⇒ Object
readonly
Returns the value of attribute co_alarm_state.
-
#country_code ⇒ Object
readonly
Returns the value of attribute country_code.
-
#eta_begin ⇒ Object
readonly
Returns the value of attribute eta_begin.
-
#name ⇒ Object
Returns the value of attribute name.
-
#peak_period_end_time ⇒ Object
readonly
Returns the value of attribute peak_period_end_time.
-
#peak_period_start_time ⇒ Object
readonly
Returns the value of attribute peak_period_start_time.
-
#postal_code ⇒ Object
readonly
Returns the value of attribute postal_code.
-
#rhr_enrollment ⇒ Object
readonly
Returns the value of attribute rhr_enrollment.
-
#smoke_alarm_state ⇒ Object
readonly
Returns the value of attribute smoke_alarm_state.
-
#structure_id ⇒ Object
readonly
Returns the value of attribute structure_id.
-
#time_zone ⇒ Object
readonly
Returns the value of attribute time_zone.
-
#wheres ⇒ Object
readonly
Returns the value of attribute wheres.
-
#wwn_security_state ⇒ Object
readonly
Returns the value of attribute wwn_security_state.
Class Method Summary collapse
Instance Method Summary collapse
- #cameras ⇒ Object
-
#initialize(api_class: NestConnect::API::Devices::Structure, **args) ⇒ Structure
constructor
A new instance of Structure.
- #protects ⇒ Object
- #reload ⇒ Object
- #thermostats ⇒ Object
Constructor Details
#initialize(api_class: NestConnect::API::Devices::Structure, **args) ⇒ Structure
Returns a new instance of Structure.
8 9 10 11 12 13 |
# File 'lib/nest_connect/devices/structure.rb', line 8 def initialize(api_class: NestConnect::API::Devices::Structure, **args) @api_class = api_class args.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#away ⇒ Object
Returns the value of attribute away.
56 57 58 |
# File 'lib/nest_connect/devices/structure.rb', line 56 def away @away end |
#co_alarm_state ⇒ Object (readonly)
Returns the value of attribute co_alarm_state.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def co_alarm_state @co_alarm_state end |
#country_code ⇒ Object (readonly)
Returns the value of attribute country_code.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def country_code @country_code end |
#eta_begin ⇒ Object (readonly)
Returns the value of attribute eta_begin.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def eta_begin @eta_begin end |
#name ⇒ Object
Returns the value of attribute name.
67 68 69 |
# File 'lib/nest_connect/devices/structure.rb', line 67 def name @name end |
#peak_period_end_time ⇒ Object (readonly)
Returns the value of attribute peak_period_end_time.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def peak_period_end_time @peak_period_end_time end |
#peak_period_start_time ⇒ Object (readonly)
Returns the value of attribute peak_period_start_time.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def peak_period_start_time @peak_period_start_time end |
#postal_code ⇒ Object (readonly)
Returns the value of attribute postal_code.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def postal_code @postal_code end |
#rhr_enrollment ⇒ Object (readonly)
Returns the value of attribute rhr_enrollment.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def rhr_enrollment @rhr_enrollment end |
#smoke_alarm_state ⇒ Object (readonly)
Returns the value of attribute smoke_alarm_state.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def smoke_alarm_state @smoke_alarm_state end |
#structure_id ⇒ Object (readonly)
Returns the value of attribute structure_id.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def structure_id @structure_id end |
#time_zone ⇒ Object (readonly)
Returns the value of attribute time_zone.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def time_zone @time_zone end |
#wheres ⇒ Object (readonly)
Returns the value of attribute wheres.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def wheres @wheres end |
#wwn_security_state ⇒ Object (readonly)
Returns the value of attribute wwn_security_state.
21 22 23 |
# File 'lib/nest_connect/devices/structure.rb', line 21 def wwn_security_state @wwn_security_state end |
Class Method Details
.from_hash_collection(hash) ⇒ Object
4 5 6 |
# File 'lib/nest_connect/devices/structure.rb', line 4 def self.from_hash_collection(hash) hash.values.map { |value| new(value) } end |
Instance Method Details
#cameras ⇒ Object
48 49 50 51 52 |
# File 'lib/nest_connect/devices/structure.rb', line 48 def cameras @cameras.to_a.map do |device_id| Device::Camera.new(device_id: device_id) end end |
#protects ⇒ Object
42 43 44 45 46 |
# File 'lib/nest_connect/devices/structure.rb', line 42 def protects @smoke_alarm_state.to_a.map do |device_id| Device::Protect.new(device_id: device_id) end end |
#reload ⇒ Object
15 16 17 18 19 |
# File 'lib/nest_connect/devices/structure.rb', line 15 def reload api_runner.get.body.each do |key, value| instance_variable_set("@#{key}", value) end end |
#thermostats ⇒ Object
36 37 38 39 40 |
# File 'lib/nest_connect/devices/structure.rb', line 36 def thermostats @thermostats.to_a.map do |device_id| Device::Thermostat.new(device_id: device_id) end end |