quadrigacx 0.4.0 → 0.5.0

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: 5a5ae600c3af6db8ab2073e6cc64709d994346c0
4
- data.tar.gz: dfd126401f57b765a6ac836e4d48c739bd2e922e
3
+ metadata.gz: 7817cc4b72d93c5d074a56d6170b0703a9f01b0b
4
+ data.tar.gz: b0c078af64803b3db22c1fe9174ed1d181dfc1b3
5
5
  SHA512:
6
- metadata.gz: 94e208cc4bda700c440c1808d3708607ebe606d8f02b6e8e20d667797b6171e5e0fb645d2e25ae8852f6a71e14458def68d9c588876aca25a8148dc4f1426828
7
- data.tar.gz: 3189131de7793f88b88776b186417ca81ae0b97998658e67b68878a80cc130b44b8615b1cb79336891db7b923c7ef522a5bc5e197f91af58c1a1f5a19f75330a
6
+ metadata.gz: e5975ecb0f0ba02b73b616c0d3af4efb935bc5777edc974d1445100b848509a7c895b662ff1daf36ee0dc6b8e0b81d1ddd48b5700a1bdda4b5d7939c54f95b69
7
+ data.tar.gz: dded70595e3fe98484134c6d07b88b4f3290a2e4fe4081032a309afd59aba3eb39629f92c19ceab0f1ee0407fa290b52662e568fc40c34ab490222dcd9ee99dc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quadrigacx (0.1.0)
4
+ quadrigacx (0.4.0)
5
5
  hashie (~> 3.3)
6
6
  json (~> 1.8)
7
7
  rest-client (~> 1.7)
@@ -55,5 +55,10 @@ module QuadrigaCX
55
55
  def open_orders params={}
56
56
  request(:post, '/open_orders', params)
57
57
  end
58
+
59
+ # Returns a bitcoin deposit address for funding your account
60
+ def wallet_address params={}
61
+ request(:post, '/bitcoin_deposit_address', params)
62
+ end
58
63
  end
59
64
  end
@@ -20,7 +20,8 @@ module QuadrigaCX
20
20
 
21
21
  # The `/cancel_order` route returns `"true"` instead of valid JSON.
22
22
  rescue JSON::ParserError
23
- return resp.body
23
+ match = resp.body.match(/"(.*)"/)
24
+ return match ? match[1] : resp.body
24
25
  end
25
26
 
26
27
  json.kind_of?(Array) ? json.map { |i| to_hashie(i) } : to_hashie(json)
@@ -1,5 +1,5 @@
1
1
  module QuadrigaCX
2
2
  unless defined?(QuadrigaCX::VERSION)
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
data/spec/client_spec.rb CHANGED
@@ -91,7 +91,7 @@ describe QuadrigaCX::Client do
91
91
  it 'cancels an order' do
92
92
  VCR.use_cassette('cancel_order') do
93
93
  response = client.cancel(id: order.id)
94
- expect(response).to eq('"true"')
94
+ expect(response).to eq('true')
95
95
  end
96
96
  end
97
97
  end
@@ -100,7 +100,7 @@ describe QuadrigaCX::Client do
100
100
  it 'withdraws bitcoins' do
101
101
  VCR.use_cassette('withdraw') do
102
102
  response = client.withdraw(amount: '0.01', address: '1FAs1ywa3pqS6S5mvypXjCtHAzwCkymNUX')
103
- expect(response).to eq('"ok"')
103
+ expect(response).to eq('ok')
104
104
  end
105
105
  end
106
106
  end
@@ -116,5 +116,14 @@ describe QuadrigaCX::Client do
116
116
  end
117
117
  end
118
118
  end
119
+
120
+ describe '#wallet_address' do
121
+ it 'returns a wallet address' do
122
+ VCR.use_cassette('wallet_address') do
123
+ response = client.wallet_address
124
+ expect(response.length).to be_between(26, 35)
125
+ end
126
+ end
127
+ end
119
128
  end
120
129
  end
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.quadrigacx.com/v2/bitcoin_deposit_address
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"key":"kOnVDjfPPh","nonce":"1421980079485","signature":"ab0fd98363db8f676d593816576ae412a0e699e93a5007c04cc500b643e92260"}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '123'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - cloudflare-nginx
27
+ Date:
28
+ - Fri, 23 Jan 2015 02:27:58 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Content-Length:
32
+ - '36'
33
+ Connection:
34
+ - keep-alive
35
+ Set-Cookie:
36
+ - __cfduid=dff2cd6e5b388980071bc1b814ce603651421980078; expires=Sat, 23-Jan-16
37
+ 02:27:58 GMT; path=/; domain=.quadrigacx.com; HttpOnly
38
+ - ci_session=CjNRZQNnBjxTfF4hBWBWZ1A0Um0MLl17AmdWIVFzBzkJOgQ7AV9eOAs3DyMJY1YlVjgJNgBtBT9XIQI1DzdUZAM3BWJWYwc2WGdRNAI0WmcKN1E6A2IGMlM1XmoFblZmUGJSbww0XW0CZlZkUTkHNAlsBGUBZl5nCzYPIwljViVWOAk0AG8FP1chAm4Pf1ReA2IFZVZjByJYYVFzAnBadwppUSwDaAY3UzReaAV4VmdQM1JvDCJdPgIxVnxRMQdkCXsEZwExXmcLcQ86CStWbFYzCTUAZQUnV3YCdA9qVHMDXAVgVmAHNVhqUXQCIVpuCiFRZQNmBjxTJV4ABS9WNFB9UnUMN117AjhWY1EzB2oJdwQ5AWFeIgsnD14JOVY1VnYJbAApBWxXdwJ%2BDy1UOgNqBTtWNgdkWDZRMQI6Wm0KYlFvA2UGPlM8XiEFYFZvUD5SdQx5XXsCZ1YgUV8HNAk0BCEBYV5zC2gPcgliVmZWOAknAH0FPld%2B;
39
+ expires=Fri, 23-Jan-2015 04:27:58 GMT; Max-Age=7200; path=/
40
+ X-Frame-Options:
41
+ - SAMEORIGIN
42
+ Cf-Ray:
43
+ - 1ad08e20734e0534-YYZ
44
+ body:
45
+ encoding: UTF-8
46
+ string: '"1KNe6Ad6pi8cZBUm31T9ZZMMLZhj8axE6M"'
47
+ http_version:
48
+ recorded_at: Fri, 23 Jan 2015 02:27:59 GMT
49
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quadrigacx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maros Hluska
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-21 00:00:00.000000000 Z
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -138,6 +138,7 @@ files:
138
138
  - spec/fixtures/vcr_cassettes/open_orders.yml
139
139
  - spec/fixtures/vcr_cassettes/order_book.yml
140
140
  - spec/fixtures/vcr_cassettes/transactions.yml
141
+ - spec/fixtures/vcr_cassettes/wallet_address.yml
141
142
  - spec/fixtures/vcr_cassettes/withdraw.yml
142
143
  - spec/spec_helper.rb
143
144
  homepage: http://mhluska.com/
@@ -174,5 +175,6 @@ test_files:
174
175
  - spec/fixtures/vcr_cassettes/open_orders.yml
175
176
  - spec/fixtures/vcr_cassettes/order_book.yml
176
177
  - spec/fixtures/vcr_cassettes/transactions.yml
178
+ - spec/fixtures/vcr_cassettes/wallet_address.yml
177
179
  - spec/fixtures/vcr_cassettes/withdraw.yml
178
180
  - spec/spec_helper.rb