Class: Helium::Timeseries
- Inherits:
-
Object
- Object
- Helium::Timeseries
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/helium/timeseries.rb
Instance Attribute Summary collapse
-
#data_points ⇒ Object
Returns the value of attribute data_points.
-
#previous_link ⇒ Object
Returns the value of attribute previous_link.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(client:, params:, links:) ⇒ Timeseries
constructor
A new instance of Timeseries.
- #previous ⇒ Object
Constructor Details
#initialize(client:, params:, links:) ⇒ Timeseries
Returns a new instance of Timeseries.
10 11 12 13 14 15 16 |
# File 'lib/helium/timeseries.rb', line 10 def initialize(client:, params:, links:) @client = client @data_points = params.map { |data_point_params| DataPoint.new(client: client, params: data_point_params) } @previous_link = links["prev"] end |
Instance Attribute Details
#data_points ⇒ Object
Returns the value of attribute data_points.
8 9 10 |
# File 'lib/helium/timeseries.rb', line 8 def data_points @data_points end |
#previous_link ⇒ Object
Returns the value of attribute previous_link.
8 9 10 |
# File 'lib/helium/timeseries.rb', line 8 def previous_link @previous_link end |
Instance Method Details
#each(&block) ⇒ Object
18 19 20 |
# File 'lib/helium/timeseries.rb', line 18 def each(&block) @data_points.each(&block) end |
#previous ⇒ Object
22 23 24 25 |
# File 'lib/helium/timeseries.rb', line 22 def previous return false if @previous_link.nil? @client.sensor_timeseries_by_link(@previous_link) end |