Class: Sensor::Actuator::AnalyticsRetrieval
- Inherits:
-
Object
- Object
- Sensor::Actuator::AnalyticsRetrieval
- Extended by:
- Garb::Model
- Defined in:
- lib/sensor/actuator/analytics_retrieval.rb
Instance Method Summary collapse
- #acquire ⇒ Object
-
#initialize(time_range) ⇒ AnalyticsRetrieval
constructor
A new instance of AnalyticsRetrieval.
Constructor Details
#initialize(time_range) ⇒ AnalyticsRetrieval
Returns a new instance of AnalyticsRetrieval.
16 17 18 |
# File 'lib/sensor/actuator/analytics_retrieval.rb', line 16 def initialize(time_range) @time_range = time_range end |
Instance Method Details
#acquire ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sensor/actuator/analytics_retrieval.rb', line 20 def acquire results = self.class.results(profile, start_date: @time_range.start_date, end_date: @time_range.end_date) if results map = results.to_a[0].marshal_dump.inject({}) do |map, key_values| map[key_values[0]] = key_values[1].to_f map end { analytics: map } else {} end end |