class PointClient::Client

Public Instance Methods

avg(deviceId) click to toggle source
# File lib/point_client/client.rb, line 9
def avg(deviceId)
  result = PointClient.jsonConnection.get "/draft1/devices/#{deviceId}/sound_avg_levels"
  convertValues result.body['values']
end
device(deviceId) click to toggle source
# File lib/point_client/client.rb, line 5
def device(deviceId)
  PointClient.jsonConnection.get "/draft1/devices/#{deviceId}"
end
peak(deviceId) click to toggle source
# File lib/point_client/client.rb, line 14
def peak(deviceId)
  result = PointClient.jsonConnection.get "/draft1/devices/#{deviceId}/sound_peak_levels"
  convertValues result.body['values']
end

Private Instance Methods

convertValues(rawValues) click to toggle source
# File lib/point_client/client.rb, line 21
def convertValues(rawValues)
  values = []
  rawValues.each do |x|
    values.push({datetime: Time.parse(x['datetime']).localtime, value: x['value'].to_i})
  end
  return values
end