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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9bfebdb9911fa95fe0686882d28a1bf4e8d595e
4
- data.tar.gz: 5cb5d8d5e8a6251bbfafa041e91304d561484574
3
+ metadata.gz: e87575079de673d9c4facd85812ae952d3414270
4
+ data.tar.gz: 3b9b529fc6e6ec4464884cb28dc24fc385dda659
5
5
  SHA512:
6
- metadata.gz: 53e8dce4c512f6658d9bfc80a23d81ee5ee74e31def52223904c00a4af2e5173c75bf60a278739074a9ed1e8a50a007e02149d0cbb6894ee0bd2ad86759b9b01
7
- data.tar.gz: 79b4dcfd639c9d087c7dbaddacacc8df487774fced736bc863c085e4740b8df63fa9ecedbf572026836cd23bb03c121fd1f73913138a59729056649ce5ce4e12
6
+ metadata.gz: 8a20cbc895eee845e46b686a54660a4e01e7fc07a30b5ee010ecf912d7adb140dee20854287dcb7b20a73020a4d7634e2ca7a8d29b57c0fcd409f540a2f26bfc
7
+ data.tar.gz: df05f8e15a2d84f12f3f7342215c24a63716b5028abdd8df2112fe84ff9e1f48ae8d3373bb33c0b0adf8818a4bca5d0bae8d8a24e41f45a717effb984886b05b
@@ -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
@@ -78,7 +78,7 @@ module Apiotics
78
78
  @heartbeat_state = Hash.new
79
79
  heartbeat = {
80
80
  "action" => "heartbeat",
81
- "instance" => "0000000000000000000000000000000000000000000000000000000000000000",
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
- self.send('{"action":"connect"}')
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
@@ -1,3 +1,3 @@
1
1
  module Apiotics
2
- VERSION = '0.1.117'
2
+ VERSION = '0.1.118'
3
3
  end
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.117
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: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails