class TempoIQ::BulkWrite

Used to write DataPoints into your TempoIQ backend.

Public Class Methods

new() click to toggle source
# File lib/tempoiq/models/bulk_write.rb, line 4
def initialize
  @writes = Hash.new do |sensors, device_key|
    sensors[device_key] = Hash.new do |points, sensor_key|
      points[sensor_key] = []
    end
  end
end

Public Instance Methods

<<(device_key, sensor_key, datapoint) click to toggle source

Alias for add

# File lib/tempoiq/models/bulk_write.rb, line 13
def <<(device_key, sensor_key, datapoint)
  add(device_key, sensor_key, datapoint)
end
add(device_key, sensor_key, datapoint) click to toggle source

Add a DataPoint to the request

  • device_key [String] - The device key to write to

  • sensor_key [String] - The sensor key within the device to write to

  • datapoint [DataPoint] - The datapoint to write

# File lib/tempoiq/models/bulk_write.rb, line 22
def add(device_key, sensor_key, datapoint)
  @writes[device_key][sensor_key] << datapoint.to_hash
end
to_hash() click to toggle source
# File lib/tempoiq/models/bulk_write.rb, line 26
def to_hash
  @writes
end