Sha256: fc97ca31704d96a7416c09d2eceba0d337f2ff64e45c972d11f4db6973181efc
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
module Helium class Sensor attr_accessor :id, :name, :mac, :ports, :created_at, :updated_at def initialize(client:, params:) @client = client @id = params["id"] @name = params["attributes"]["name"] @mac = params["meta"]["mac"] @ports = params["meta"]["ports"] @created_at = params["meta"]["created"] @updated_at = params["meta"]["updated"] end def created_at DateTime.parse(@created_at) end def updated_at DateTime.parse(@updated_at) end def timeseries(size: 1000, port: nil, start_time: nil, end_time: nil, aggtype: nil, aggsize: nil) @client.sensor_timeseries(self, size: size, port: port, start_time: start_time, end_time: end_time, aggtype: aggtype, aggsize: aggsize ) end # TODO these kinds of methods should be generalized into a Resource object def update(name:) @client.update_sensor(self, name: name) end def destroy @client.delete_sensor(self) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
helium-ruby-0.3.0 | lib/helium/sensor.rb |