innologix 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 848ecf6750f941168edf6a67e722473b30d31cf4
4
- data.tar.gz: 68b4b6511c9e0a05fbd0dba61fe3289d40525696
3
+ metadata.gz: 5c4006dc6836aa2c194a16aa291312675318a88e
4
+ data.tar.gz: cf108dc1e5498dbebc8720f8a0e27b58a9cdcf76
5
5
  SHA512:
6
- metadata.gz: 1280d82baad3fe47f818cc67903d90f557c8da40fbd8c003fe2b6e75efa6344468d7521c2e7330e96529ab30d6dfc6e0787a280989529fee77027a8466eb0f44
7
- data.tar.gz: 67fb7b20db0fc70828f907282a3657c511d4007e6da78748b6e3aac3309e85b52d1efed226754632f231bc869c057901c97ea02d9d5d572eed82066d587d9195
6
+ metadata.gz: 3561e935bac22fb67a1cddbabd6727de86fd1ad34bcadb581602cd177b3008d950e47b2eadef9de33c5598272c8144175c97f864287891b4effc35954bdf7a06
7
+ data.tar.gz: 8bcc9e82756de4df619bb6388795b2819399041824762fa64a8c64385b3a0d0b220db2984abd0278c48266b0c0ba600ce08352a62b9d8d58b3d965670647e9cd
@@ -0,0 +1,55 @@
1
+ module Innologix
2
+ class DeviceLog
3
+ attr_accessor :id
4
+ attr_accessor :created_at
5
+ attr_accessor :updated_at
6
+
7
+ attr_accessor :client
8
+ attr_accessor :error
9
+
10
+ def initialize(h = {})
11
+ h.each { |k, v| public_send("#{k}=", v) }
12
+ @client = Client.default
13
+ end
14
+
15
+ def statistics(from_time, to_time)
16
+ path = '/device_logs/statistics'
17
+ method = 'get'
18
+ options = {query_params: {from_time: from_time, to_time: to_time}}
19
+ result = client.call_api(path, method, options)
20
+ if result[:error] == 0
21
+ messages = result[:statistics][:messages]
22
+ size = result[:statistics][:size]
23
+ result = OpenStruct.new
24
+ result.messages = messages
25
+ result.size = size
26
+ result
27
+ else
28
+ result = OpenStruct.new
29
+ result.messages = 0
30
+ result.size = 0
31
+ result
32
+ end
33
+ end
34
+
35
+ def statistic_minutes(from_time, to_time, arrange)
36
+ path = '/device_logs/statistic_minutes'
37
+ method = 'get'
38
+ options = {query_params: {from_time: from_time, to_time: to_time, arrange: arrange}}
39
+ result = client.call_api(path, method, options)
40
+ if result[:error] == 0
41
+ list = []
42
+ result[:statistics].each do |statistic|
43
+ _statistic = OpenStruct.new
44
+ _statistic.timestamp = statistic[:timestamp]
45
+ _statistic.messages = statistic[:messages]
46
+ _statistic.size = statistic[:size]
47
+ list.push(_statistic)
48
+ end
49
+ list
50
+ else
51
+ []
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,3 +1,3 @@
1
1
  module Innologix
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/innologix.rb CHANGED
@@ -15,6 +15,7 @@ require 'innologix/m2m'
15
15
  require 'innologix/storage'
16
16
  require 'innologix/supervisor'
17
17
  require 'innologix/user'
18
+ require 'innologix/device_log'
18
19
 
19
20
  module Innologix
20
21
  @config = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: innologix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - SkyLab Innogram
@@ -49,6 +49,7 @@ files:
49
49
  - lib/innologix/authorization.rb
50
50
  - lib/innologix/client.rb
51
51
  - lib/innologix/device.rb
52
+ - lib/innologix/device_log.rb
52
53
  - lib/innologix/device_type.rb
53
54
  - lib/innologix/group.rb
54
55
  - lib/innologix/logger.rb