cf-trade-client 0.1.6 → 0.1.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.
- data/lib/client/client.rb +8 -4
- metadata +2 -2
data/lib/client/client.rb
CHANGED
|
@@ -16,17 +16,18 @@ limitations under the License.
|
|
|
16
16
|
require 'faye/websocket'
|
|
17
17
|
module Coinfloor
|
|
18
18
|
class CFClient
|
|
19
|
-
def initialize(domain,uid,pass,api_key,pkey=nil)
|
|
20
|
-
|
|
19
|
+
def initialize(domain,uid,pass,api_key=nil,pkey=nil)
|
|
21
20
|
if domain.include?("ws://")||domain.include?("wss://")
|
|
22
21
|
@messages=[]
|
|
23
22
|
if uid==0
|
|
24
23
|
@con=CFAcon.new(uid,pass)
|
|
25
24
|
else
|
|
26
|
-
if
|
|
25
|
+
if api_key.nil?
|
|
26
|
+
abort("An API key is required")
|
|
27
|
+
elsif pkey
|
|
27
28
|
@con=CFcon.new(uid,pass,api_key,pkey)
|
|
28
29
|
else
|
|
29
|
-
@con=CFcon.new(uid,api_key
|
|
30
|
+
@con=CFcon.new(uid,pass,api_key)
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
@domain=domain
|
|
@@ -43,6 +44,7 @@ module Coinfloor
|
|
|
43
44
|
end
|
|
44
45
|
|
|
45
46
|
def begin_connection(sendata)
|
|
47
|
+
puts "begining connection"
|
|
46
48
|
output=nil
|
|
47
49
|
EM.run {
|
|
48
50
|
ws = Faye::WebSocket::Client.new(@domain)
|
|
@@ -50,8 +52,10 @@ module Coinfloor
|
|
|
50
52
|
end
|
|
51
53
|
|
|
52
54
|
ws.on :message do |event|
|
|
55
|
+
puts "message from server"
|
|
53
56
|
evtdata=event.data
|
|
54
57
|
msg=JSON.parse(evtdata)
|
|
58
|
+
puts msg
|
|
55
59
|
if msg["notice"]&&msg["notice"]=="Welcome"
|
|
56
60
|
auth(ws,msg)
|
|
57
61
|
elsif msg["notice"].nil?
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cf-trade-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-01-
|
|
12
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: faye-websocket
|