Class: Innologix::DeviceLog
- Inherits:
-
Object
- Object
- Innologix::DeviceLog
- Defined in:
- lib/innologix/device_log.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#error ⇒ Object
Returns the value of attribute error.
-
#id ⇒ Object
Returns the value of attribute id.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #get_total_logs(device_ids, from_time, to_time) ⇒ Object
-
#initialize(h = {}) ⇒ DeviceLog
constructor
A new instance of DeviceLog.
- #statistic_minutes(from_time, to_time, arrange, supervisor_id = 0) ⇒ Object
- #statistics(from_time, to_time) ⇒ Object
Constructor Details
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/innologix/device_log.rb', line 7 def client @client end |
#created_at ⇒ Object
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/innologix/device_log.rb', line 4 def created_at @created_at end |
#error ⇒ Object
Returns the value of attribute error.
8 9 10 |
# File 'lib/innologix/device_log.rb', line 8 def error @error end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/innologix/device_log.rb', line 3 def id @id end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
5 6 7 |
# File 'lib/innologix/device_log.rb', line 5 def updated_at @updated_at end |
Instance Method Details
#get_total_logs(device_ids, from_time, to_time) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# 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' = {query_params: {from_time: from_time, to_time: to_time, device_ids: device_ids}} result = client.call_api(path, method, ) if result[:error] == 0 result[:devices] else {} end end |
#statistic_minutes(from_time, to_time, arrange, supervisor_id = 0) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# 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' = {query_params: {from_time: from_time, to_time: to_time, arrange: arrange, supervisor_id: supervisor_id}} result = client.call_api(path, method, ) if result[:error] == 0 list = [] result[:statistics].each do |statistic| _statistic = OpenStruct.new _statistic. = statistic[:timestamp] _statistic. = statistic[:messages] _statistic.size = statistic[:size] _statistic.failures = statistic[:failures] list.push(_statistic) end list else [] end end |
#statistics(from_time, to_time) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/innologix/device_log.rb', line 15 def statistics(from_time, to_time) path = '/device_logs/statistics' method = 'get' = {query_params: {from_time: from_time, to_time: to_time}} result = client.call_api(path, method, ) if result[:error] == 0 = result[:statistics][:messages] size = result[:statistics][:size] failures = result[:statistics][:failures] result = OpenStruct.new result. = result.size = size result.failures = failures result else result = OpenStruct.new result. = 0 result.size = 0 result end end |