apiotics 0.1.117 → 0.1.118
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apiotics/portal.rb +16 -0
- data/lib/apiotics/server.rb +12 -2
- data/lib/apiotics/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e87575079de673d9c4facd85812ae952d3414270
|
4
|
+
data.tar.gz: 3b9b529fc6e6ec4464884cb28dc24fc385dda659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a20cbc895eee845e46b686a54660a4e01e7fc07a30b5ee010ecf912d7adb140dee20854287dcb7b20a73020a4d7634e2ca7a8d29b57c0fcd409f540a2f26bfc
|
7
|
+
data.tar.gz: df05f8e15a2d84f12f3f7342215c24a63716b5028abdd8df2112fe84ff9e1f48ae8d3373bb33c0b0adf8818a4bca5d0bae8d8a24e41f45a717effb984886b05b
|
data/lib/apiotics/portal.rb
CHANGED
@@ -255,5 +255,21 @@ module Apiotics
|
|
255
255
|
}
|
256
256
|
end
|
257
257
|
|
258
|
+
def self.register_client
|
259
|
+
response = response = HTTParty.post("#{Apiotics.configuration.portal}api/register_client", :query => {:public_key => Apiotics.configuration.public_key, :private_key => Apiotics.configuration.private_key})
|
260
|
+
hash = JSON.parse(response)
|
261
|
+
gem_setting = ApioticsSetting.find_by(key: "gem_id")
|
262
|
+
if gem_setting == nil
|
263
|
+
gem_setting = ApioticsSetting.new
|
264
|
+
gem_setting.key = "gem_id"
|
265
|
+
gem_setting.value = hash["guid"]
|
266
|
+
gem_setting.save
|
267
|
+
else
|
268
|
+
gem_setting.value = hash["guid"]
|
269
|
+
gem_setting.save
|
270
|
+
end
|
271
|
+
hash["guid"]
|
272
|
+
end
|
273
|
+
|
258
274
|
end
|
259
275
|
end
|
data/lib/apiotics/server.rb
CHANGED
@@ -78,7 +78,7 @@ module Apiotics
|
|
78
78
|
@heartbeat_state = Hash.new
|
79
79
|
heartbeat = {
|
80
80
|
"action" => "heartbeat",
|
81
|
-
"
|
81
|
+
"instance_id" => "0000000000000000000000000000000000000000000000000000000000000000",
|
82
82
|
"driver" => "Core::Heartbeat",
|
83
83
|
"interface" => nil
|
84
84
|
}
|
@@ -168,7 +168,17 @@ module Apiotics
|
|
168
168
|
|
169
169
|
def send_heartbeat(heartbeat)
|
170
170
|
if Apiotics.configuration.handshake == true
|
171
|
-
|
171
|
+
gem_id = ApioticsSettings.find_by(key: "gem_id")
|
172
|
+
if gem_id == nil
|
173
|
+
gem_id = Apiotics::Portal.register_client
|
174
|
+
else
|
175
|
+
gem_id = gem_id.value
|
176
|
+
end
|
177
|
+
connect_msg = {
|
178
|
+
"action" => "connect",
|
179
|
+
"instance_id" => gem_id
|
180
|
+
}
|
181
|
+
self.send(connect_msg.to_json)
|
172
182
|
end
|
173
183
|
Thread.abort_on_exception = true
|
174
184
|
Thread.new do
|
data/lib/apiotics/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiotics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.118
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MicroArx Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|