class WeatherLink::SensorRecord

Attributes

client[R]

Public Class Methods

new(client, data) click to toggle source
Calls superclass method WeatherLink::HashWrapper::new
# File lib/weatherlink/sensor_record.rb, line 7
def initialize(client, data)
  @client = client
  super(data)
end

Public Instance Methods

inspect() click to toggle source
# File lib/weatherlink/sensor_record.rb, line 16
def inspect
  to_s
end
time() click to toggle source
# File lib/weatherlink/sensor_record.rb, line 20
def time
  Time.at(ts)
end
to_s() click to toggle source
# File lib/weatherlink/sensor_record.rb, line 12
def to_s
  "#<#{self.class.name} time='#{time}' (#{data.size} values)>"
end

Private Instance Methods

method_missing(symbol, *args) click to toggle source
Calls superclass method WeatherLink::HashWrapper#method_missing
# File lib/weatherlink/sensor_record.rb, line 26
def method_missing(symbol, *args)
  return Time.at(data[symbol.to_s]) if symbol == :ts || symbol.to_s.end_with?('_at')
  return client.convert(symbol, super) if data.include?(symbol.to_s)

  super
end
respond_to_missing?(symbol, include_private = false) click to toggle source
# File lib/weatherlink/sensor_record.rb, line 33
def respond_to_missing?(symbol, include_private = false)
  return true if symbol == :ts || symbol.to_s.end_with?('_at')

  super
end