cryptsy 0.2 → 0.3

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: 5d1a9e53dc363dc442072d76a240b16e5d246b7d
4
- data.tar.gz: 79ef12b13f786c0528c789622588be3400c83979
3
+ metadata.gz: ae0d7adc6a1e01bb714a99bad44c82619529cd9f
4
+ data.tar.gz: f2539f9b32a0f4a1c2a52ff9c4ee1d03035226bd
5
5
  SHA512:
6
- metadata.gz: 007bfc16b7ad2b71978044f0e972239be6059a2cdb99d23f5aead8453632478c9475e2508bd70b6f5a09883ee3855c4a2e35a7ef5d9ac2c245ac9a471bf15cd4
7
- data.tar.gz: 1848249a8eb3a1d272763e96b1bd23fcee70c08861291bd89c394909a2dc0bc5b639508bd41372d60b55d51a2fe4beb9ebb8dd6a9d3575bf4df97a839ba25c6e
6
+ metadata.gz: 2640b03968514485d64f202620a077ff67b160bf5e9df065418bf79d0475760b72548e4c58d9691186d76b11cc6a9e3d96a6b0573210e9ee9cddf6b69eaa746d
7
+ data.tar.gz: 247a65d648dee64cfc36c51067578095b51a8a0ab7a55527112333e98bab8894b5af8cbcea3c500c82d393b3681255bb408d2c22fb202154e2af39dee19a6637
@@ -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 [CryptsyError]
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 [CryptsyError]
165
+ # @raise [ClientError]
162
166
  # @param [Faraday::Response] response
163
167
  # @return [Object]
164
168
  def process_response(response)
@@ -1,3 +1,3 @@
1
1
  module Cryptsy
2
- VERSION = '0.2'
2
+ VERSION = '0.3'
3
3
  end
@@ -40,7 +40,7 @@ module Cryptsy
40
40
  'data[User][password]' => @password,
41
41
  }
42
42
 
43
- post_with_csrf('/users/login', request)
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
- post_with_csrf('/users/pincode', request)
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
- post_with_csrf('/users/addtrustedaddress', request)
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
- post_with_csrf("/users/makewithdrawal/#{currency_id}", request)
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 post_with_csrf(url, request)
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.2'
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-04-03 00:00:00.000000000 Z
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: