Class: Netatmo::DashboardData::Noise
- Inherits:
-
Object
- Object
- Netatmo::DashboardData::Noise
- Defined in:
- lib/netatmo/dashboard_data/noise.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
Returns the value of attribute time.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(data) ⇒ Noise
constructor
A new instance of Noise.
- #noise ⇒ Object
- #status ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Noise
Returns a new instance of Noise.
8 9 10 11 12 13 14 |
# File 'lib/netatmo/dashboard_data/noise.rb', line 8 def initialize(data) return if data.nil? self.time = Time.at(data['time_utc']) self.value = data['Noise'].to_f self.unit = 'dB' end |
Instance Attribute Details
#time ⇒ Object
Returns the value of attribute time.
6 7 8 |
# File 'lib/netatmo/dashboard_data/noise.rb', line 6 def time @time end |
#unit ⇒ Object
Returns the value of attribute unit.
6 7 8 |
# File 'lib/netatmo/dashboard_data/noise.rb', line 6 def unit @unit end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/netatmo/dashboard_data/noise.rb', line 6 def value @value end |
Instance Method Details
#noise ⇒ Object
20 21 22 |
# File 'lib/netatmo/dashboard_data/noise.rb', line 20 def noise value end |
#status ⇒ Object
24 25 26 |
# File 'lib/netatmo/dashboard_data/noise.rb', line 24 def status # TODO: calculate status (quiet/load/...) end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/netatmo/dashboard_data/noise.rb', line 16 def to_s "#{value} #{unit}" end |