Class: WeatherLink::SensorDataCollection

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/weatherlink/sensor_data_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, sensors) ⇒ SensorDataCollection

Returns a new instance of SensorDataCollection.



9
10
11
12
# File 'lib/weatherlink/sensor_data_collection.rb', line 9

def initialize(client, sensors)
  @client = client
  super(sensors)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/weatherlink/sensor_data_collection.rb', line 7

def client
  @client
end

Instance Method Details

#archiveObject



26
27
28
# File 'lib/weatherlink/sensor_data_collection.rb', line 26

def archive
  SensorDataCollection.new(client, select(&:archive?))
end

#current_conditionsObject



22
23
24
# File 'lib/weatherlink/sensor_data_collection.rb', line 22

def current_conditions
  SensorDataCollection.new(client, select(&:current_conditions?))
end

#healthObject



34
35
36
# File 'lib/weatherlink/sensor_data_collection.rb', line 34

def health
  SensorDataCollection.new(client, select(&:health?))
end

#inspectObject



18
19
20
# File 'lib/weatherlink/sensor_data_collection.rb', line 18

def inspect
  to_s
end

#to_sObject



14
15
16
# File 'lib/weatherlink/sensor_data_collection.rb', line 14

def to_s
  "#<#{self.class.name} (#{size} sensors)>"
end

#weatherObject



30
31
32
# File 'lib/weatherlink/sensor_data_collection.rb', line 30

def weather
  SensorDataCollection.new(client, select(&:weather?))
end