remitano 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +13 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +127 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +115 -0
  9. data/Rakefile +51 -0
  10. data/bin/remitano +20 -0
  11. data/lib/remitano.rb +2 -0
  12. data/lib/remitano/client.rb +98 -0
  13. data/lib/remitano/client/action_confirmations.rb +29 -0
  14. data/lib/remitano/client/coin_accounts.rb +9 -0
  15. data/lib/remitano/client/coin_collection.rb +18 -0
  16. data/lib/remitano/client/coin_withdrawals.rb +24 -0
  17. data/lib/remitano/client/collection.rb +29 -0
  18. data/lib/remitano/client/fiat_accounts.rb +9 -0
  19. data/lib/remitano/client/fiat_collection.rb +18 -0
  20. data/lib/remitano/client/helper.rb +14 -0
  21. data/lib/remitano/client/merchant_charges.rb +24 -0
  22. data/lib/remitano/client/merchant_withdrawals.rb +38 -0
  23. data/lib/remitano/client/net.rb +100 -0
  24. data/lib/remitano/client/offers.rb +21 -0
  25. data/lib/remitano/client/orders.rb +26 -0
  26. data/lib/remitano/client/public/offers.rb +18 -0
  27. data/lib/remitano/client/public/price_ladders.rb +7 -0
  28. data/lib/remitano/client/public/rates.rb +12 -0
  29. data/lib/remitano/client/trades.rb +37 -0
  30. data/lib/remitano/version.rb +3 -0
  31. data/remitano.gemspec +40 -0
  32. data/spec/client/merchant_charges_spec.rb +66 -0
  33. data/spec/client/merchant_withdrawals_spec.rb +111 -0
  34. data/spec/coin_accounts_spec.rb +11 -0
  35. data/spec/fiat_accounts_spec.rb +11 -0
  36. data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/invalid_params/raises_error.yml +51 -0
  37. data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/valid_params/returns_created_charge.yml +53 -0
  38. data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_get/object_exists/returns_charge_data.yml +48 -0
  39. data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_get/object_not_found/raises_error.yml +46 -0
  40. data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_create/invalid_params/raises_error.yml +52 -0
  41. data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_create/valid_params/auto_confirms_withdrawal_with_htop_and_returns_created_withdrawal.yml +296 -0
  42. data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_get/object_exists/returns_withdrawal_data.yml +48 -0
  43. data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_get/object_not_found/raises_error.yml +46 -0
  44. data/spec/fixtures/vcr_cassettes/remitano/coin_accounts/me.yml +52 -0
  45. data/spec/fixtures/vcr_cassettes/remitano/fiat_accounts/me.yml +52 -0
  46. data/spec/fixtures/vcr_cassettes/remitano/my_offers/sell.yml +47 -0
  47. data/spec/fixtures/vcr_cassettes/remitano/offers/update.yml +94 -0
  48. data/spec/fixtures/vcr_cassettes/remitano/orders/cancel.yml +54 -0
  49. data/spec/fixtures/vcr_cassettes/remitano/orders/create.yml +54 -0
  50. data/spec/fixtures/vcr_cassettes/remitano/orders/open.yml +54 -0
  51. data/spec/fixtures/vcr_cassettes/remitano/price_ladders/sell.yml +48 -0
  52. data/spec/fixtures/vcr_cassettes/remitano/rates.yml +44 -0
  53. data/spec/fixtures/vcr_cassettes/remitano/trades/active.yml +46 -0
  54. data/spec/fixtures/vcr_cassettes/remitano/trades/completed.yml +46 -0
  55. data/spec/fixtures/vcr_cassettes/remitano/trades/release.yml +144 -0
  56. data/spec/offers_spec.rb +18 -0
  57. data/spec/orders_spec.rb +29 -0
  58. data/spec/public/price_ladders_spec.rb +11 -0
  59. data/spec/public/rates_spec.rb +10 -0
  60. data/spec/spec_helper.rb +25 -0
  61. data/spec/support/crendentials.rb +12 -0
  62. data/spec/support/request_usec.rb +5 -0
  63. data/spec/support/vcr.rb +22 -0
  64. data/spec/trades_spec.rb +39 -0
  65. metadata +329 -0
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: REMITANO_SERVER/api/v1/fiat_accounts/me?currency=zar&usec=0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.2 (darwin16.4.0 x86_64) ruby/2.4.3p205
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 25 Dec 2018 07:24:15 GMT
20
+ Authorization:
21
+ - APIAuth REMITANO_KEY:hcd5YXM91JCEeb2KdjO3yYmi/RU=
22
+ Host:
23
+ - localhost:3100
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Content-Type:
30
+ - application/json
31
+ Content-Length:
32
+ - '123'
33
+ Etag:
34
+ - W/"fe9759429fbc27307edee42193c5345d"
35
+ Cache-Control:
36
+ - max-age=0, private, must-revalidate
37
+ X-Request-Id:
38
+ - a66f41e0-5237-4f60-b124-595c3aab04d5
39
+ X-Runtime:
40
+ - '0.086490'
41
+ Vary:
42
+ - Origin
43
+ Connection:
44
+ - keep-alive
45
+ Server:
46
+ - thin
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"user_id":4,"balance":0.0,"available_balance":0.0,"frozen_balance":0.0,"type":"fiat","currency":"zar","country_code":"za"}'
50
+ http_version:
51
+ recorded_at: Tue, 25 Dec 2018 07:24:16 GMT
52
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: REMITANO_SERVER/api/v1/offers/my_offers?coin_currency=btc&offer_type=sell&usec=0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Date:
17
+ - Sun, 01 May 2016 07:20:30 GMT
18
+ Authorization:
19
+ - APIAuth REMITANO_KEY:3HwhendFzmR1tAlCEM19/bYOnbM=
20
+ User-Agent:
21
+ - Ruby
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Content-Type:
28
+ - application/json
29
+ Etag:
30
+ - '"a6962bfedddd4e804370dc82ee482b63"'
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Request-Id:
34
+ - 8d0553e1-b602-432a-b9cc-94ede6cdbcea
35
+ X-Runtime:
36
+ - '0.132268'
37
+ Content-Length:
38
+ - '813'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"offers":[{"id":2,"canonical_name":"buy-bitcoin-easy-with-vnd-in-vietnam-via-local-bank-transfer","offer_type":"sell","min_amount":10.0,"max_amount":500.0,"currency":"VND","payment_time":60,"payment_descriptions":null,"terms_of_trade":"No
42
+ terms","price":25050.0,"formatted_price":"25,050 VND","payment_method":"local_bank","username":"phuongnd08","counter_offer_type":"buy","disabled":false,"user_summary":"(0%;2)","last_active":"2016-05-01T14:20:30.000+07:00","location":{"id":2,"locatable_id":2,"locatable_type":"Offer","country_name":"Vietnam","country_code":"VN","area1":"Ha
43
+ Noi","area2":null,"zip":null,"formatted_address":"Ha Noi, Vietnam","lat":21.0333,"lng":105.85,"short_formatted_address":"Ha
44
+ Noi, Vietnam"}}],"meta":{"current_page":1,"next_page":null,"prev_page":null,"total_pages":1,"total_items":1}}'
45
+ http_version:
46
+ recorded_at: Sun, 01 May 2016 07:20:30 GMT
47
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,94 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: REMITANO_SERVER/api/v1/offers/2?coin_currency=btc
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"price":21800}'
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Md5:
17
+ - u9Ta1E6/BJcn0Ntrqo+ztQ==
18
+ Date:
19
+ - Sun, 01 May 2016 04:18:28 GMT
20
+ Authorization:
21
+ - APIAuth REMITANO_KEY:geScUL3qbsPqVpjwJq6jUXjxLX8=
22
+ Content-Length:
23
+ - '15'
24
+ User-Agent:
25
+ - Ruby
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ Content-Type:
32
+ - application/json
33
+ Etag:
34
+ - '"1ccd06d30a9b47a15e92aa94190ef970"'
35
+ Cache-Control:
36
+ - max-age=0, private, must-revalidate
37
+ X-Request-Id:
38
+ - c622e256-e15d-4bea-9c0f-82018caf19d9
39
+ X-Runtime:
40
+ - '0.405004'
41
+ Content-Length:
42
+ - '606'
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"id":2,"canonical_name":"buy-bitcoin-easy-with-vnd-in-vietnam-via-local-bank-transfer","offer_type":"sell","min_amount":10.0,"max_amount":500.0,"currency":"VND","payment_time":60,"payment_descriptions":null,"terms_of_trade":"No
46
+ terms","price":21800.0,"payment_method":"local_bank","disabled":false,"payment_instructions":null,"location_attributes":{"id":2,"locatable_id":2,"locatable_type":"Offer","country_code":"VN","area2":null,"area1":"Ha
47
+ Noi","zip":null,"formatted_address":"Ha Noi, Vietnam","lat":21.0333,"lng":105.85,"created_at":"2016-04-26T09:27:58.604Z","updated_at":"2016-04-26T09:27:58.604Z"}}'
48
+ http_version:
49
+ recorded_at: Sun, 01 May 2016 04:18:29 GMT
50
+ - request:
51
+ method: get
52
+ uri: REMITANO_SERVER/api/v1/offers/my_offers?coin_currency=btc&offer_type=sell&usec=0
53
+ body:
54
+ encoding: US-ASCII
55
+ string: ''
56
+ headers:
57
+ Accept:
58
+ - "*/*; q=0.5, application/xml"
59
+ Accept-Encoding:
60
+ - gzip, deflate
61
+ Content-Type:
62
+ - application/json
63
+ Date:
64
+ - Sun, 01 May 2016 04:18:29 GMT
65
+ Authorization:
66
+ - APIAuth REMITANO_KEY:5fzF/wsCQ1JMHfrqaeA5+6PD5Wo=
67
+ User-Agent:
68
+ - Ruby
69
+ response:
70
+ status:
71
+ code: 200
72
+ message: OK
73
+ headers:
74
+ Content-Type:
75
+ - application/json
76
+ Etag:
77
+ - '"2ccc6b0227d6d0bc82915162a35dd6b4"'
78
+ Cache-Control:
79
+ - max-age=0, private, must-revalidate
80
+ X-Request-Id:
81
+ - 6f33ceea-3301-466b-9689-6dc8ae08e99e
82
+ X-Runtime:
83
+ - '0.317799'
84
+ Content-Length:
85
+ - '813'
86
+ body:
87
+ encoding: UTF-8
88
+ string: '{"offers":[{"id":2,"canonical_name":"buy-bitcoin-easy-with-vnd-in-vietnam-via-local-bank-transfer","offer_type":"sell","min_amount":10.0,"max_amount":500.0,"currency":"VND","payment_time":60,"payment_descriptions":null,"terms_of_trade":"No
89
+ terms","price":21800.0,"formatted_price":"21,800 VND","payment_method":"local_bank","username":"phuongnd08","counter_offer_type":"buy","disabled":false,"user_summary":"(0%;2)","last_active":"2016-05-01T11:18:29.000+07:00","location":{"id":2,"locatable_id":2,"locatable_type":"Offer","country_name":"Vietnam","country_code":"VN","area1":"Ha
90
+ Noi","area2":null,"zip":null,"formatted_address":"Ha Noi, Vietnam","lat":21.0333,"lng":105.85,"short_formatted_address":"Ha
91
+ Noi, Vietnam"}}],"meta":{"current_page":1,"next_page":null,"prev_page":null,"total_pages":1,"total_items":1}}'
92
+ http_version:
93
+ recorded_at: Sun, 01 May 2016 04:18:29 GMT
94
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: REMITANO_SERVER/api/v1/orders/27/cancel
6
+ body:
7
+ encoding: UTF-8
8
+ string: "{}"
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.2 (darwin14.5.0 x86_64) ruby/2.4.3p205
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Thu, 05 Apr 2018 01:27:52 GMT
20
+ Authorization:
21
+ - APIAuth REMITANO_KEY:5uxynj3rEcr3pXK0VI2kxgLlRY8=
22
+ Content-Length:
23
+ - '2'
24
+ Host:
25
+ - localhost:3100
26
+ response:
27
+ status:
28
+ code: 201
29
+ message: Created
30
+ headers:
31
+ Content-Type:
32
+ - application/json
33
+ Content-Length:
34
+ - '151'
35
+ Etag:
36
+ - W/"90b0c29136d2b41c17f3f38d13a6bb12"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - b9098673-7085-47ed-ba2d-334320e8f601
41
+ X-Runtime:
42
+ - '0.136347'
43
+ Vary:
44
+ - Origin
45
+ Connection:
46
+ - keep-alive
47
+ Server:
48
+ - thin
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"id":27,"pair":"btcusdt","side":"sell","price":10000.0,"amount":0.001,"unfilled_amount":"0.001","status":"cancelled","status_explanation":"requested"}'
52
+ http_version:
53
+ recorded_at: Thu, 05 Apr 2018 01:27:52 GMT
54
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: REMITANO_SERVER/api/v1/orders
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"pair":"btcusdt","side":"sell","price":"10000","amount":0.001}'
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.2 (darwin14.5.0 x86_64) ruby/2.4.3p205
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Thu, 05 Apr 2018 01:27:13 GMT
20
+ Authorization:
21
+ - APIAuth REMITANO_KEY:jqoT1FNIiD8jyQSEhbs/SzZNuaM=
22
+ Content-Length:
23
+ - '63'
24
+ Host:
25
+ - localhost:3100
26
+ response:
27
+ status:
28
+ code: 201
29
+ message: Created
30
+ headers:
31
+ Content-Type:
32
+ - application/json
33
+ Content-Length:
34
+ - '139'
35
+ Etag:
36
+ - W/"21dd8ddb7ef1ee95935c1564c4842738"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - da56f266-b2ad-410f-95db-0e179c25ea2a
41
+ X-Runtime:
42
+ - '0.643958'
43
+ Vary:
44
+ - Origin
45
+ Connection:
46
+ - keep-alive
47
+ Server:
48
+ - thin
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"id":27,"pair":"btcusdt","side":"sell","price":10000.0,"amount":0.001,"unfilled_amount":"0.001","status":"open","status_explanation":null}'
52
+ http_version:
53
+ recorded_at: Thu, 05 Apr 2018 01:27:14 GMT
54
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: REMITANO_SERVER/api/v1/orders/open?page=1&pair=btcusdt&usec=0
6
+ body:
7
+ encoding: UTF-8
8
+ string: "{}"
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.2 (darwin14.5.0 x86_64) ruby/2.4.3p205
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Thu, 05 Apr 2018 07:55:29 GMT
20
+ Authorization:
21
+ - APIAuth REMITANO_KEY:ppapfezucyncQcdTYlCdjGQ5c1E=
22
+ Content-Length:
23
+ - '2'
24
+ Host:
25
+ - localhost:3100
26
+ response:
27
+ status:
28
+ code: 200
29
+ message: OK
30
+ headers:
31
+ Content-Type:
32
+ - application/json
33
+ Content-Length:
34
+ - '650'
35
+ Etag:
36
+ - W/"ac351a15f64df69b7f93285e032072d4"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 9a23c2a0-0ccc-409c-af0b-c99df3622382
41
+ X-Runtime:
42
+ - '0.394287'
43
+ Vary:
44
+ - Origin
45
+ Connection:
46
+ - keep-alive
47
+ Server:
48
+ - thin
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"orders":[{"id":19,"pair":"btcusdt","side":"sell","price":1000.0,"amount":0.1,"unfilled_amount":0.1,"status":"open","status_explanation":null},{"id":20,"pair":"btcusdt","side":"sell","price":1200.0,"amount":0.2,"unfilled_amount":0.2,"status":"open","status_explanation":null},{"id":21,"pair":"btcusdt","side":"sell","price":1300.0,"amount":0.3,"unfilled_amount":0.3,"status":"open","status_explanation":null},{"id":22,"pair":"btcusdt","side":"sell","price":1400.0,"amount":0.4,"unfilled_amount":0.4,"status":"open","status_explanation":null}],"meta":{"per_page":25,"current_page":1,"next_page":null,"prev_page":null,"total_pages":1,"total_items":4}}'
52
+ http_version:
53
+ recorded_at: Thu, 05 Apr 2018 07:55:30 GMT
54
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: REMITANO_SERVER/api/v1/price_ladders/btcusdt
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.2 (darwin14.5.0 x86_64) ruby/2.4.3p205
16
+ Lang:
17
+ - vi
18
+ Host:
19
+ - localhost:3100
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Content-Type:
26
+ - application/json
27
+ Content-Length:
28
+ - '246'
29
+ Etag:
30
+ - W/"583d07b245304e264c0b939b032b025e"
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Request-Id:
34
+ - fb5d637c-5d35-4357-b58e-40a624d4f0f1
35
+ X-Runtime:
36
+ - '0.286067'
37
+ Vary:
38
+ - Origin
39
+ Connection:
40
+ - keep-alive
41
+ Server:
42
+ - thin
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"sell":[[1000.0,0.20000000000000002],[1200.0,0.40000000000000002],[1300.0,0.59999999999999998],[1400.0,0.80000000000000004]],"buy":[[900.0,0.20000000000000002],[800.0,0.40000000000000002],[700.0,0.59999999999999998],[600.0,0.80000000000000004]]}'
46
+ http_version:
47
+ recorded_at: Thu, 05 Apr 2018 03:55:11 GMT
48
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: REMITANO_SERVER/api/v1/rates/ads
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Date:
17
+ - Sat, 30 Jul 2016 09:10:08 GMT
18
+ Authorization:
19
+ - APIAuth REMITANO_KEY:6XaDTeseY0EouE/A2Gbto0FxyyU=
20
+ User-Agent:
21
+ - Ruby
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Content-Type:
28
+ - application/json
29
+ Etag:
30
+ - W/"3ef5563fbb3dcc5da1393fe88927cfa2"
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Request-Id:
34
+ - 67c50a37-bf5a-42b5-991b-67b174ad9678
35
+ X-Runtime:
36
+ - '0.086967'
37
+ Content-Length:
38
+ - '115'
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"bid":654.34,"ask":654.34,"remi_vnd_bid":22500.0,"remi_vnd_ask":30303.0,"bid_vnd":14722650.0,"ask_vnd":19630200.0}'
42
+ http_version:
43
+ recorded_at: Sat, 30 Jul 2016 09:10:09 GMT
44
+ recorded_with: VCR 2.6.0