alphapoint 0.1.3.2 → 0.1.4

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: a38be284bc09c871078c95ff3c0d365b0d5c65a8
4
- data.tar.gz: a36408157d6c77729588c36239d215b42bf79c89
3
+ metadata.gz: '09e77eeb428adcace775fee560501e75b6bf0a03'
4
+ data.tar.gz: ed91a7aa8fbd25275b1b1a669822874d6555ce40
5
5
  SHA512:
6
- metadata.gz: 827899f78296b1f03d2e3ebf5fddc7d1f08e9dc06d4dafc733018b7414d12b96f2d27f953ba98c263cf9ee83df8018cbd9c2f566197c76742b5a1eb7ced541ca
7
- data.tar.gz: 75a8d527b26ed4b6bda974854e5215f234bae7075e1718830a8e614bc6a4fbabcc1e285ce8dbfc1c0986e5bbe35f0084c0be0321d77ac5a187e68797998e31f9
6
+ metadata.gz: e24eecce4bdc07a0fdb5fca3d0a11cac27cc5cc71e9d73f2a15bdba013a52f6855e7f225aef2a0f7ec9bc10e267f0642bc4e442f1595b81a25933e6d3458c09d
7
+ data.tar.gz: 3bdf5fe82795726f10130caf4c03df6225f1ae4cb70d6cb2dcfb64770040f8945dfca25532aaadb640df3d25a718407ba4fa1fd942fe65eaf8502416ff456472
@@ -1,3 +1,3 @@
1
1
  module Alphapoint
2
- VERSION = "0.1.3.2"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -6,7 +6,7 @@ module Alphapoint
6
6
 
7
7
  attr_accessor :address
8
8
 
9
- def connect(address = nil, &block)
9
+ def initialize(address = nil, &block)
10
10
  if Alphapoint.configuration.nil? ||
11
11
  Alphapoint.configuration.address.nil? ||
12
12
  Alphapoint.configuration.address.empty?
@@ -31,38 +31,32 @@ module Alphapoint
31
31
 
32
32
  alpha_self = self
33
33
 
34
- @thread = Thread.new do
35
- EM.run do
36
- @ws = Faye::WebSocket::Client.new(@address)
37
-
38
- @ws.on :open do |event|
39
- p [:open, "Websocket connected to #{@address}"]
40
- block.call(self)
41
- end
42
-
43
- @ws.on :message do |event|
44
- alpha_self.delegate_message(JSON.parse(event.data).with_indifferent_access)
45
- end
46
-
47
- @ws.on :error do |event|
48
- p [:error, event.inspect]
49
- end
50
-
51
- @ws.on :close do |event|
52
- p [:close, event.code, event.reason]
53
- end
54
- end
34
+ @thread = Thread.new do
35
+ EM.run do
36
+ @ws = Faye::WebSocket::Client.new(@address)
37
+ @ws.on :open do |event|
38
+ p [:open, "Websocket connected to #{@address}"]
39
+ end
40
+
41
+ @ws.on :message do |event|
42
+ alpha_self.delegate_message(JSON.parse(event.data).with_indifferent_access)
43
+ end
44
+
45
+ @ws.on :error do |event|
46
+ p [:error, event.inspect]
47
+ end
48
+
49
+ @ws.on :close do |event|
50
+ p [:close, event.code, event.reason]
51
+ end
52
+ end
55
53
  end
56
54
 
57
- p @thread.status
58
-
59
55
  trap(:INT) { EM.stop }
60
56
  trap(:TERM){ EM.stop }
61
57
 
62
58
  while not EM.reactor_running?; end
63
- while not EM.defers_finished?; end
64
-
65
- self
59
+ while not EM.defers_finished?; end
66
60
  end
67
61
 
68
62
  def build_request(function_name, payload,type = 0, &block)
@@ -75,7 +69,6 @@ module Alphapoint
75
69
 
76
70
  @response[@nextIValue] = block
77
71
  @nextIValue += 2
78
-
79
72
  @ws.send(JSON.generate(frame))
80
73
  end
81
74
 
@@ -100,6 +93,8 @@ module Alphapoint
100
93
  end
101
94
 
102
95
  def method_missing(m, *args, &block)
96
+ # to wait handshake finish
97
+ sleep(0.5)
103
98
  function_name = m.to_s.camelcase
104
99
  respond_action = @avaliable_functions.select{ |func| func == function_name }
105
100
  if respond_action.size > 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alphapoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabiano Martins
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-01-03 00:00:00.000000000 Z
13
+ date: 2019-01-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport