class WeatherLink::SensorData

Attributes

client[R]
records[R]
sensor_data[R]

Public Class Methods

new(client, sensor_data) click to toggle source
Calls superclass method
# File lib/weatherlink/sensor_data.rb, line 9
def initialize(client, sensor_data)
  @client = client
  @sensor_data = HashWrapper.new(sensor_data)
  @records = @sensor_data['data'].map do |data|
    SensorRecord.new(client, client.attach_units(data))
  end
  super(@records.first)
end

Public Instance Methods

archive?() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 50
def archive?
  record_type.archive?
end
current_conditions?() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 46
def current_conditions?
  record_type.current_conditions?
end
description() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 58
def description
  record_type.description
end
health?() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 42
def health?
  record_type.health?
end
inspect() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 22
def inspect
  to_s
end
lsid() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 26
def lsid
  sensor_data.lsid
end
record_type() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 38
def record_type
  @record_type ||= client.api.class.record_type(sensor_data.data_structure_type)
end
sensor() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 30
def sensor
  @sensor ||= @client.sensors.select { |sensor| sensor.lsid == lsid }.first
end
sensor_type() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 34
def sensor_type
  sensor_data.sensor_type
end
to_s() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 18
def to_s
  "#<#{self.class.name} lsid=#{lsid} (#{record_type.description}, #{records.size} records)>"
end
weather?() click to toggle source
# File lib/weatherlink/sensor_data.rb, line 54
def weather?
  record_type.current_conditions? || record_type.archive?
end