class Innologix::DeviceLog
Attributes
client[RW]
created_at[RW]
error[RW]
id[RW]
updated_at[RW]
Public Class Methods
new(h = {})
click to toggle source
# File lib/innologix/device_log.rb, line 10 def initialize(h = {}) h.each { |k, v| public_send("#{k}=", v) } @client = Client.default end
Public Instance Methods
get_total_logs(device_ids, from_time, to_time)
click to toggle source
# File lib/innologix/device_log.rb, line 58 def get_total_logs(device_ids, from_time, to_time) path = '/device_logs/get_total_logs' method = 'post' options = {query_params: {from_time: from_time, to_time: to_time, device_ids: device_ids}} result = client.call_api(path, method, options) if result[:error] == 0 result[:devices] else {} end end
statistic_minutes(from_time, to_time, arrange, supervisor_id = 0)
click to toggle source
# File lib/innologix/device_log.rb, line 37 def statistic_minutes(from_time, to_time, arrange, supervisor_id = 0) path = '/device_logs/statistic_minutes' method = 'get' options = {query_params: {from_time: from_time, to_time: to_time, arrange: arrange, supervisor_id: supervisor_id}} result = client.call_api(path, method, options) if result[:error] == 0 list = [] result[:statistics].each do |statistic| _statistic = OpenStruct.new _statistic.timestamp = statistic[:timestamp] _statistic.messages = statistic[:messages] _statistic.size = statistic[:size] _statistic.failures = statistic[:failures] list.push(_statistic) end list else [] end end
statistics(from_time, to_time)
click to toggle source
# File lib/innologix/device_log.rb, line 15 def statistics(from_time, to_time) path = '/device_logs/statistics' method = 'get' options = {query_params: {from_time: from_time, to_time: to_time}} result = client.call_api(path, method, options) if result[:error] == 0 messages = result[:statistics][:messages] size = result[:statistics][:size] failures = result[:statistics][:failures] result = OpenStruct.new result.messages = messages result.size = size result.failures = failures result else result = OpenStruct.new result.messages = 0 result.size = 0 result end end