cryptsy 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cryptsy/client.rb +6 -2
- data/lib/cryptsy/version.rb +1 -1
- data/lib/cryptsy/web_client.rb +8 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae0d7adc6a1e01bb714a99bad44c82619529cd9f
|
4
|
+
data.tar.gz: f2539f9b32a0f4a1c2a52ff9c4ee1d03035226bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2640b03968514485d64f202620a077ff67b160bf5e9df065418bf79d0475760b72548e4c58d9691186d76b11cc6a9e3d96a6b0573210e9ee9cddf6b69eaa746d
|
7
|
+
data.tar.gz: 247a65d648dee64cfc36c51067578095b51a8a0ab7a55527112333e98bab8894b5af8cbcea3c500c82d393b3681255bb408d2c22fb202154e2af39dee19a6637
|
data/lib/cryptsy/client.rb
CHANGED
@@ -29,6 +29,10 @@ module Cryptsy
|
|
29
29
|
call(:getinfo)
|
30
30
|
end
|
31
31
|
|
32
|
+
def balance(currency_code)
|
33
|
+
info.balances_available.fetch(currency_code.upcase).to_f
|
34
|
+
end
|
35
|
+
|
32
36
|
def markets
|
33
37
|
call(:getmarkets)
|
34
38
|
end
|
@@ -133,7 +137,7 @@ module Cryptsy
|
|
133
137
|
call(:makewithdrawal, address: address, amount: amount)
|
134
138
|
end
|
135
139
|
|
136
|
-
# @raise [
|
140
|
+
# @raise [ClientError]
|
137
141
|
# @param [Symbol] method_name
|
138
142
|
# @param [Hash] params
|
139
143
|
# @return [Object]
|
@@ -158,7 +162,7 @@ module Cryptsy
|
|
158
162
|
process_response(response)
|
159
163
|
end
|
160
164
|
|
161
|
-
# @raise [
|
165
|
+
# @raise [ClientError]
|
162
166
|
# @param [Faraday::Response] response
|
163
167
|
# @return [Object]
|
164
168
|
def process_response(response)
|
data/lib/cryptsy/version.rb
CHANGED
data/lib/cryptsy/web_client.rb
CHANGED
@@ -40,7 +40,7 @@ module Cryptsy
|
|
40
40
|
'data[User][password]' => @password,
|
41
41
|
}
|
42
42
|
|
43
|
-
|
43
|
+
post_with_token('/users/login', request)
|
44
44
|
end
|
45
45
|
|
46
46
|
# Finishes login operation using TOTP and TFA secret
|
@@ -50,7 +50,7 @@ module Cryptsy
|
|
50
50
|
'data[User][pincode]' => @tfa.now
|
51
51
|
}
|
52
52
|
|
53
|
-
|
53
|
+
post_with_token('/users/pincode', request)
|
54
54
|
end
|
55
55
|
|
56
56
|
# Submits a trusted address for pre-approved withdrawals
|
@@ -66,11 +66,14 @@ module Cryptsy
|
|
66
66
|
'data[Withdrawal][pincode]' => @tfa.now,
|
67
67
|
}
|
68
68
|
|
69
|
-
|
69
|
+
post_with_token('/users/addtrustedaddress', request)
|
70
70
|
end
|
71
71
|
|
72
72
|
# Submits a request for withdrawal to an untrusted address
|
73
73
|
#
|
74
|
+
# Note that this will only work for addresses that have not been trusted. Use the JSON
|
75
|
+
# API for withdrawing to trusted addresses.
|
76
|
+
#
|
74
77
|
# @param [Integer] currency_id
|
75
78
|
# @param [String] address
|
76
79
|
# @param [Float] amount
|
@@ -80,12 +83,11 @@ module Cryptsy
|
|
80
83
|
'data[Withdrawal][fee]' => '1.00000000',
|
81
84
|
'data[Withdrawal][wdamount]' => amount,
|
82
85
|
'data[Withdrawal][address]' => address,
|
83
|
-
'data[Withdrawal][approvedaddress]' => '',
|
84
86
|
'data[Withdrawal][existing_password]' => @password,
|
85
87
|
'data[Withdrawal][pincode]' => @tfa.now,
|
86
88
|
}
|
87
89
|
|
88
|
-
|
90
|
+
post_with_token("/users/makewithdrawal/#{currency_id}", request)
|
89
91
|
end
|
90
92
|
|
91
93
|
# @param [String] url
|
@@ -107,7 +109,7 @@ module Cryptsy
|
|
107
109
|
# @param [String] url
|
108
110
|
# @param [Hash] request
|
109
111
|
# @return [Faraday::Request]
|
110
|
-
def
|
112
|
+
def post_with_token(url, request)
|
111
113
|
prepare_request(get(url), request)
|
112
114
|
post(url, request)
|
113
115
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptsy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Unruh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -83,3 +83,4 @@ test_files:
|
|
83
83
|
- spec/client_spec.rb
|
84
84
|
- spec/spec_helper.rb
|
85
85
|
- spec/web_client_spec.rb
|
86
|
+
has_rdoc:
|