remitano 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +13 -0
- data/.ruby-version +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +127 -0
- data/LICENSE.txt +20 -0
- data/README.md +115 -0
- data/Rakefile +51 -0
- data/bin/remitano +20 -0
- data/lib/remitano.rb +2 -0
- data/lib/remitano/client.rb +98 -0
- data/lib/remitano/client/action_confirmations.rb +29 -0
- data/lib/remitano/client/coin_accounts.rb +9 -0
- data/lib/remitano/client/coin_collection.rb +18 -0
- data/lib/remitano/client/coin_withdrawals.rb +24 -0
- data/lib/remitano/client/collection.rb +29 -0
- data/lib/remitano/client/fiat_accounts.rb +9 -0
- data/lib/remitano/client/fiat_collection.rb +18 -0
- data/lib/remitano/client/helper.rb +14 -0
- data/lib/remitano/client/merchant_charges.rb +24 -0
- data/lib/remitano/client/merchant_withdrawals.rb +38 -0
- data/lib/remitano/client/net.rb +100 -0
- data/lib/remitano/client/offers.rb +21 -0
- data/lib/remitano/client/orders.rb +26 -0
- data/lib/remitano/client/public/offers.rb +18 -0
- data/lib/remitano/client/public/price_ladders.rb +7 -0
- data/lib/remitano/client/public/rates.rb +12 -0
- data/lib/remitano/client/trades.rb +37 -0
- data/lib/remitano/version.rb +3 -0
- data/remitano.gemspec +40 -0
- data/spec/client/merchant_charges_spec.rb +66 -0
- data/spec/client/merchant_withdrawals_spec.rb +111 -0
- data/spec/coin_accounts_spec.rb +11 -0
- data/spec/fiat_accounts_spec.rb +11 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/invalid_params/raises_error.yml +51 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/valid_params/returns_created_charge.yml +53 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_get/object_exists/returns_charge_data.yml +48 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_get/object_not_found/raises_error.yml +46 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_create/invalid_params/raises_error.yml +52 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_create/valid_params/auto_confirms_withdrawal_with_htop_and_returns_created_withdrawal.yml +296 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_get/object_exists/returns_withdrawal_data.yml +48 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_get/object_not_found/raises_error.yml +46 -0
- data/spec/fixtures/vcr_cassettes/remitano/coin_accounts/me.yml +52 -0
- data/spec/fixtures/vcr_cassettes/remitano/fiat_accounts/me.yml +52 -0
- data/spec/fixtures/vcr_cassettes/remitano/my_offers/sell.yml +47 -0
- data/spec/fixtures/vcr_cassettes/remitano/offers/update.yml +94 -0
- data/spec/fixtures/vcr_cassettes/remitano/orders/cancel.yml +54 -0
- data/spec/fixtures/vcr_cassettes/remitano/orders/create.yml +54 -0
- data/spec/fixtures/vcr_cassettes/remitano/orders/open.yml +54 -0
- data/spec/fixtures/vcr_cassettes/remitano/price_ladders/sell.yml +48 -0
- data/spec/fixtures/vcr_cassettes/remitano/rates.yml +44 -0
- data/spec/fixtures/vcr_cassettes/remitano/trades/active.yml +46 -0
- data/spec/fixtures/vcr_cassettes/remitano/trades/completed.yml +46 -0
- data/spec/fixtures/vcr_cassettes/remitano/trades/release.yml +144 -0
- data/spec/offers_spec.rb +18 -0
- data/spec/orders_spec.rb +29 -0
- data/spec/public/price_ladders_spec.rb +11 -0
- data/spec/public/rates_spec.rb +10 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/support/crendentials.rb +12 -0
- data/spec/support/request_usec.rb +5 -0
- data/spec/support/vcr.rb +22 -0
- data/spec/trades_spec.rb +39 -0
- metadata +329 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: REMITANO_SERVER/api/v1/trades?coin_currency=btc&trade_status=active&trade_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
|
+
- Wed, 27 Apr 2016 02:44:01 GMT
|
18
|
+
Authorization:
|
19
|
+
- APIAuth REMITANO_KEY:wB7JV07HP1PkHK37iupd/Nxj8hM=
|
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
|
+
- '"772fcfc6f66db0bb98b518f9613add03"'
|
31
|
+
Cache-Control:
|
32
|
+
- max-age=0, private, must-revalidate
|
33
|
+
X-Request-Id:
|
34
|
+
- 289d0f3e-094d-415a-b5b1-77cf13245146
|
35
|
+
X-Runtime:
|
36
|
+
- '0.079572'
|
37
|
+
Content-Length:
|
38
|
+
- '706'
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"trades":[{"id":2,"price":22800.0,"remi_amount":275.0,"other_amount":6270000.0,"created_at":"2016-04-26T09:43:05.674Z","buyer_username":"kukien0707","seller_username":"phuongnd08","status":"unpaid","offer_data":{"id":2,"offer_type":"sell","min_amount":10.0,"max_amount":500.0,"currency":"VND","payment_time":60,"payment_descriptions":null,"payment_instructions":null,"terms_of_trade":"No
|
42
|
+
terms","price":22800.0,"payment_method":"local_bank","username":"phuongnd08","formatted_address":"Ha
|
43
|
+
Noi, Vietnam"},"payment_deadline":"2016-04-26T10:43:05.674Z","seller_sending_amount":275.0,"buyer_receiving_amount":275.0}],"meta":{"current_page":1,"next_page":null,"prev_page":null,"total_pages":1,"total_items":1}}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Wed, 27 Apr 2016 02:44:01 GMT
|
46
|
+
recorded_with: VCR 2.6.0
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: REMITANO_SERVER/api/v1/trades?coin_currency=btc&trade_status=completed&trade_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
|
+
- Wed, 27 Apr 2016 02:44:01 GMT
|
18
|
+
Authorization:
|
19
|
+
- APIAuth REMITANO_KEY:MJvM7z67swCSZKoTiUlJwL/2fEE=
|
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
|
+
- '"479414bd1e179d3d303bfb5c141df326"'
|
31
|
+
Cache-Control:
|
32
|
+
- max-age=0, private, must-revalidate
|
33
|
+
X-Request-Id:
|
34
|
+
- 30d08fcf-a9b9-41e9-9334-5545c5eb2430
|
35
|
+
X-Runtime:
|
36
|
+
- '0.050666'
|
37
|
+
Content-Length:
|
38
|
+
- '709'
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"trades":[{"id":1,"price":22800.0,"remi_amount":275.0,"other_amount":6270000.0,"created_at":"2016-04-26T09:34:17.864Z","buyer_username":"kukien0707","seller_username":"phuongnd08","status":"cancelled","offer_data":{"id":2,"offer_type":"sell","min_amount":10.0,"max_amount":500.0,"currency":"VND","payment_time":60,"payment_descriptions":null,"payment_instructions":null,"terms_of_trade":"No
|
42
|
+
terms","price":22800.0,"payment_method":"local_bank","username":"phuongnd08","formatted_address":"Ha
|
43
|
+
Noi, Vietnam"},"payment_deadline":"2016-04-26T10:34:17.864Z","seller_sending_amount":275.0,"buyer_receiving_amount":275.0}],"meta":{"current_page":1,"next_page":null,"prev_page":null,"total_pages":1,"total_items":1}}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Wed, 27 Apr 2016 02:44:01 GMT
|
46
|
+
recorded_with: VCR 2.6.0
|
@@ -0,0 +1,144 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: REMITANO_SERVER/api/v1/trades/2T61603008/release
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
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
|
+
Content-Md5:
|
17
|
+
- mZFLkyvTelC5g8XnyQrpOw==
|
18
|
+
Date:
|
19
|
+
- Sat, 30 Apr 2016 07:52:08 GMT
|
20
|
+
Authorization:
|
21
|
+
- APIAuth REMITANO_KEY:szLqYscrg1F+GRkYPDb4T00vHGQ=
|
22
|
+
Content-Length:
|
23
|
+
- '2'
|
24
|
+
User-Agent:
|
25
|
+
- Ruby
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 201
|
29
|
+
message: Created
|
30
|
+
headers:
|
31
|
+
Content-Type:
|
32
|
+
- application/json
|
33
|
+
Etag:
|
34
|
+
- '"bd4d2aaf0eea5879321cea067e14b616"'
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
X-Request-Id:
|
38
|
+
- b4ab75b1-6ac2-4906-91f7-5a81302c22bc
|
39
|
+
X-Runtime:
|
40
|
+
- '0.067668'
|
41
|
+
Content-Length:
|
42
|
+
- '911'
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: '{"id":8,"status":"pending","actionable_type":"Trade","action":"release_trade!","via":"authenticator","actionable_id":4,"message":"You
|
46
|
+
are releasing trade \u003Cb\u003E#4\u003C/b\u003E with \u003Cb\u003Ekukien0707\u003C/b\u003E.
|
47
|
+
Trading amount: \u003Cb\u003E220.0 REMI\u003C/b\u003E.","actionable":{"ref":"2T61603008","price":22800.0,"remi_amount":220.0,"other_amount":5016000.0,"created_at":"2016-04-30T07:51:48.036Z","buyer_username":"kukien0707","seller_username":"phuongnd08","status":"unpaid","offer_data":{"id":2,"offer_type":"sell","min_amount":10.0,"max_amount":500.0,"currency":"VND","payment_time":60,"payment_descriptions":null,"payment_instructions":null,"terms_of_trade":"No
|
48
|
+
terms","price":22800.0,"payment_method":"local_bank","username":"phuongnd08","formatted_address":"Ha
|
49
|
+
Noi, Vietnam"},"payment_deadline":"2016-04-30T08:51:48.036Z","seller_sending_amount":220.0,"buyer_receiving_amount":220.0}}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Sat, 30 Apr 2016 07:52:08 GMT
|
52
|
+
- request:
|
53
|
+
method: post
|
54
|
+
uri: REMITANO_SERVER/api/v1/action_confirmations/8/confirm
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: '{"token":"885921"}'
|
58
|
+
headers:
|
59
|
+
Accept:
|
60
|
+
- "*/*; q=0.5, application/xml"
|
61
|
+
Accept-Encoding:
|
62
|
+
- gzip, deflate
|
63
|
+
Content-Type:
|
64
|
+
- application/json
|
65
|
+
Content-Md5:
|
66
|
+
- dQCkSJvqbon2orZS8CCUiw==
|
67
|
+
Date:
|
68
|
+
- Sat, 30 Apr 2016 07:52:08 GMT
|
69
|
+
Authorization:
|
70
|
+
- APIAuth REMITANO_KEY:vSElZFEEyMFZTmfabHyS1xn6mgM=
|
71
|
+
Content-Length:
|
72
|
+
- '18'
|
73
|
+
User-Agent:
|
74
|
+
- Ruby
|
75
|
+
response:
|
76
|
+
status:
|
77
|
+
code: 201
|
78
|
+
message: Created
|
79
|
+
headers:
|
80
|
+
Content-Type:
|
81
|
+
- application/json
|
82
|
+
Etag:
|
83
|
+
- '"c9d720eb8d2f5fe07e7362f609b8b9a0"'
|
84
|
+
Cache-Control:
|
85
|
+
- max-age=0, private, must-revalidate
|
86
|
+
X-Request-Id:
|
87
|
+
- 5c3696ac-81b1-48ca-b023-db28a0b6ccec
|
88
|
+
X-Runtime:
|
89
|
+
- '0.171240'
|
90
|
+
Content-Length:
|
91
|
+
- '915'
|
92
|
+
body:
|
93
|
+
encoding: UTF-8
|
94
|
+
string: '{"id":8,"status":"confirmed","actionable_type":"Trade","action":"release_trade!","via":"authenticator","actionable_id":4,"message":"You
|
95
|
+
are releasing trade \u003Cb\u003E#4\u003C/b\u003E with \u003Cb\u003Ekukien0707\u003C/b\u003E.
|
96
|
+
Trading amount: \u003Cb\u003E220.0 REMI\u003C/b\u003E.","actionable":{"ref":"2T61603008","price":22800.0,"remi_amount":220.0,"other_amount":5016000.0,"created_at":"2016-04-30T07:51:48.036Z","buyer_username":"kukien0707","seller_username":"phuongnd08","status":"released","offer_data":{"id":2,"offer_type":"sell","min_amount":10.0,"max_amount":500.0,"currency":"VND","payment_time":60,"payment_descriptions":null,"payment_instructions":null,"terms_of_trade":"No
|
97
|
+
terms","price":22800.0,"payment_method":"local_bank","username":"phuongnd08","formatted_address":"Ha
|
98
|
+
Noi, Vietnam"},"payment_deadline":"2016-04-30T08:51:48.036Z","seller_sending_amount":220.0,"buyer_receiving_amount":220.0}}'
|
99
|
+
http_version:
|
100
|
+
recorded_at: Sat, 30 Apr 2016 07:52:09 GMT
|
101
|
+
- request:
|
102
|
+
method: get
|
103
|
+
uri: REMITANO_SERVER/api/v1/trades/2T61603008?usec=0
|
104
|
+
body:
|
105
|
+
encoding: US-ASCII
|
106
|
+
string: ''
|
107
|
+
headers:
|
108
|
+
Accept:
|
109
|
+
- "*/*; q=0.5, application/xml"
|
110
|
+
Accept-Encoding:
|
111
|
+
- gzip, deflate
|
112
|
+
Content-Type:
|
113
|
+
- application/json
|
114
|
+
Date:
|
115
|
+
- Sat, 30 Apr 2016 07:52:09 GMT
|
116
|
+
Authorization:
|
117
|
+
- APIAuth REMITANO_KEY:QhcO6MnVnBbdwbnxvWJlchuU0Zk=
|
118
|
+
User-Agent:
|
119
|
+
- Ruby
|
120
|
+
response:
|
121
|
+
status:
|
122
|
+
code: 200
|
123
|
+
message: OK
|
124
|
+
headers:
|
125
|
+
Content-Type:
|
126
|
+
- application/json
|
127
|
+
Etag:
|
128
|
+
- '"a92f5aacd4ba195aabb3c2f30589d7c3"'
|
129
|
+
Cache-Control:
|
130
|
+
- max-age=0, private, must-revalidate
|
131
|
+
X-Request-Id:
|
132
|
+
- 4a36c2c6-af76-42d6-8454-6bfa9fcbc75d
|
133
|
+
X-Runtime:
|
134
|
+
- '0.056172'
|
135
|
+
Content-Length:
|
136
|
+
- '657'
|
137
|
+
body:
|
138
|
+
encoding: UTF-8
|
139
|
+
string: '{"trade":{"ref":"2T61603008","price":22800.0,"remi_amount":220.0,"other_amount":5016000.0,"created_at":"2016-04-30T07:51:48.036Z","buyer_username":"kukien0707","seller_username":"phuongnd08","status":"released","offer_data":{"id":2,"offer_type":"sell","min_amount":10.0,"max_amount":500.0,"currency":"VND","payment_time":60,"payment_descriptions":null,"payment_instructions":null,"terms_of_trade":"No
|
140
|
+
terms","price":22800.0,"payment_method":"local_bank","username":"phuongnd08","formatted_address":"Ha
|
141
|
+
Noi, Vietnam"},"payment_deadline":"2016-04-30T08:51:48.036Z","seller_sending_amount":220.0,"buyer_receiving_amount":220.0},"role":"seller","feedback":null}'
|
142
|
+
http_version:
|
143
|
+
recorded_at: Sat, 30 Apr 2016 07:52:09 GMT
|
144
|
+
recorded_with: VCR 2.6.0
|
data/spec/offers_spec.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Remitano::Client#offers" do
|
4
|
+
describe :my_offers, vcr: {cassette_name: 'remitano/my_offers/sell'} do
|
5
|
+
subject { Remitano::Client.default.offers("btc").my_offers("sell") }
|
6
|
+
it "should have 1 item" do
|
7
|
+
subject.length.should == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe :update, vcr: {cassette_name: 'remitano/offers/update'} do
|
12
|
+
it "change the offer" do
|
13
|
+
Remitano::Client.default.offers("btc").update(2, price: 21800)
|
14
|
+
offer = Remitano::Client.default.offers("btc").my_offers("sell").first
|
15
|
+
offer[:price].should == 21800
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/orders_spec.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Remitano::Client#orders" do
|
4
|
+
describe :open, vcr: {cassette_name: 'remitano/orders/open'} do
|
5
|
+
subject { Remitano::Client.default.orders.open("btcusdt", page: 1) }
|
6
|
+
it "returns list of orders" do
|
7
|
+
expect(subject["orders"].count).to eq 4
|
8
|
+
expect(subject["orders"].first["status"]).to eq "open"
|
9
|
+
expect(subject["orders"].first["side"]).to eq "sell"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe :create, vcr: {cassette_name: 'remitano/orders/create'} do
|
14
|
+
it "create the order" do
|
15
|
+
order = Remitano::Client.default.orders.create(
|
16
|
+
pair: "btcusdt", side: "sell",
|
17
|
+
price: "10000", amount: 0.001
|
18
|
+
)
|
19
|
+
expect(order["status"]).to eq "open"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe :cancel, vcr: {cassette_name: 'remitano/orders/cancel'} do
|
24
|
+
it "cancel the order" do
|
25
|
+
order = Remitano::Client.default.orders.cancel(27)
|
26
|
+
expect(order["status"]).to eq "cancelled"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Remitano::Client::PriceLadders do
|
4
|
+
describe :active, vcr: {cassette_name: 'remitano/price_ladders/sell'} do
|
5
|
+
subject { Remitano::Client.default.price_ladders.fetch("btcusdt") }
|
6
|
+
it "contains buy and sell ladders" do
|
7
|
+
expect(subject["buy"].length).to eq 4
|
8
|
+
expect(subject["sell"].length).to eq 4
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'remitano'
|
4
|
+
require 'dotenv'
|
5
|
+
require 'byebug'
|
6
|
+
|
7
|
+
Dotenv.load
|
8
|
+
|
9
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
|
+
# in spec/support/ and its subdirectories.
|
11
|
+
Dir[File.expand_path("./spec/support/**/*.rb")].each { |f| require f }
|
12
|
+
|
13
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
16
|
+
config.run_all_when_everything_filtered = true
|
17
|
+
config.filter_run :focus
|
18
|
+
config.mock_with :rspec
|
19
|
+
|
20
|
+
# Run specs in random order to surface order dependencies. If you find an
|
21
|
+
# order dependency and want to debug it, you can fix the order by providing
|
22
|
+
# the seed, which is printed after each run.
|
23
|
+
# --seed 1234
|
24
|
+
config.order = 'random'
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
ENV['REMITANO_KEY'] = 'key'
|
2
|
+
ENV['REMITANO_SECRET'] = 'secret'
|
3
|
+
ENV['REMITANO_AUTHENTICATOR_SECRET'] = 'secret'
|
4
|
+
ENV["REMITANO_SERVER"] = "http://localhost:3100"
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.before(:each) do
|
8
|
+
Remitano::Client.default_key = ENV['REMITANO_KEY']
|
9
|
+
Remitano::Client.default_secret = ENV['REMITANO_SECRET']
|
10
|
+
Remitano::Client.default_authenticator_secret = ENV['REMITANO_AUTHENTICATOR_SECRET']
|
11
|
+
end
|
12
|
+
end
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
require_relative 'crendentials'
|
4
|
+
|
5
|
+
VCR.configure do |c|
|
6
|
+
c.allow_http_connections_when_no_cassette = false
|
7
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
8
|
+
c.hook_into :webmock # or :fakeweb
|
9
|
+
c.configure_rspec_metadata!
|
10
|
+
c.default_cassette_options = { record: :once }
|
11
|
+
%w(REMITANO_KEY REMITANO_SECRET REMITANO_SERVER).each do |key|
|
12
|
+
c.filter_sensitive_data(key) do |interaction|
|
13
|
+
ENV[key]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
RSpec.configure do |c|
|
19
|
+
# so we can use :vcr rather than :vcr => true;
|
20
|
+
# in RSpec 3 this will no longer be necessary.
|
21
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
22
|
+
end
|
data/spec/trades_spec.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Remitano::Client#trades"do
|
4
|
+
describe :active, vcr: {cassette_name: 'remitano/trades/active'} do
|
5
|
+
describe "first trade" do
|
6
|
+
subject { Remitano::Client.default.trades("btc").active("sell").trades.first }
|
7
|
+
it "should have correct values" do
|
8
|
+
subject.price.should == 22800
|
9
|
+
subject.seller_sending_amount.should == 275
|
10
|
+
subject.buyer_username.should be_present
|
11
|
+
subject.seller_username.should be_present
|
12
|
+
subject.created_at.should be_present
|
13
|
+
subject.status.should == "unpaid"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe :completed, vcr: {cassette_name: 'remitano/trades/completed'} do
|
19
|
+
describe "first trade" do
|
20
|
+
subject { Remitano::Client.default.trades("btc").completed("sell").trades.first }
|
21
|
+
it "should have correct value" do
|
22
|
+
subject.price.should == 22800
|
23
|
+
subject.seller_sending_amount.should == 275
|
24
|
+
subject.buyer_username.should be_present
|
25
|
+
subject.seller_username.should be_present
|
26
|
+
subject.created_at.should be_present
|
27
|
+
subject.status.should == "cancelled"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe :release, vcr: {cassette_name: 'remitano/trades/release'} do
|
33
|
+
it "release the trade" do
|
34
|
+
Remitano::Client.default.trades("btc").release("2T61603008")
|
35
|
+
trade = Remitano::Client.default.trades("btc").get("2T61603008")
|
36
|
+
trade[:status].should == "released"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,329 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: remitano
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Phuong Nguyen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-05-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.10
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.10
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ruby-hmac
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.4.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.4.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: api-auth
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.1.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.1.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: hashie
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rotp
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-mocks
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.8'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.8'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rdoc
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.12'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.12'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: bundler
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: jeweler
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.8.4
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.8.4
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: dotenv
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 2.0.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 2.0.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: vcr
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 4.0.0
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 4.0.0
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: webmock
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 3.3.0
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 3.3.0
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: byebug
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: thor
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
description: Ruby API for use with remitano.
|
238
|
+
email: phuongnd08@gmail.com
|
239
|
+
executables: []
|
240
|
+
extensions: []
|
241
|
+
extra_rdoc_files: []
|
242
|
+
files:
|
243
|
+
- ".gitignore"
|
244
|
+
- ".rubocop.yml"
|
245
|
+
- ".ruby-version"
|
246
|
+
- Gemfile
|
247
|
+
- Gemfile.lock
|
248
|
+
- LICENSE.txt
|
249
|
+
- README.md
|
250
|
+
- Rakefile
|
251
|
+
- bin/remitano
|
252
|
+
- lib/remitano.rb
|
253
|
+
- lib/remitano/client.rb
|
254
|
+
- lib/remitano/client/action_confirmations.rb
|
255
|
+
- lib/remitano/client/coin_accounts.rb
|
256
|
+
- lib/remitano/client/coin_collection.rb
|
257
|
+
- lib/remitano/client/coin_withdrawals.rb
|
258
|
+
- lib/remitano/client/collection.rb
|
259
|
+
- lib/remitano/client/fiat_accounts.rb
|
260
|
+
- lib/remitano/client/fiat_collection.rb
|
261
|
+
- lib/remitano/client/helper.rb
|
262
|
+
- lib/remitano/client/merchant_charges.rb
|
263
|
+
- lib/remitano/client/merchant_withdrawals.rb
|
264
|
+
- lib/remitano/client/net.rb
|
265
|
+
- lib/remitano/client/offers.rb
|
266
|
+
- lib/remitano/client/orders.rb
|
267
|
+
- lib/remitano/client/public/offers.rb
|
268
|
+
- lib/remitano/client/public/price_ladders.rb
|
269
|
+
- lib/remitano/client/public/rates.rb
|
270
|
+
- lib/remitano/client/trades.rb
|
271
|
+
- lib/remitano/version.rb
|
272
|
+
- remitano.gemspec
|
273
|
+
- spec/client/merchant_charges_spec.rb
|
274
|
+
- spec/client/merchant_withdrawals_spec.rb
|
275
|
+
- spec/coin_accounts_spec.rb
|
276
|
+
- spec/fiat_accounts_spec.rb
|
277
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/invalid_params/raises_error.yml
|
278
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/valid_params/returns_created_charge.yml
|
279
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_get/object_exists/returns_charge_data.yml
|
280
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_get/object_not_found/raises_error.yml
|
281
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_create/invalid_params/raises_error.yml
|
282
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_create/valid_params/auto_confirms_withdrawal_with_htop_and_returns_created_withdrawal.yml
|
283
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_get/object_exists/returns_withdrawal_data.yml
|
284
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_withdrawals/_get/object_not_found/raises_error.yml
|
285
|
+
- spec/fixtures/vcr_cassettes/remitano/coin_accounts/me.yml
|
286
|
+
- spec/fixtures/vcr_cassettes/remitano/fiat_accounts/me.yml
|
287
|
+
- spec/fixtures/vcr_cassettes/remitano/my_offers/sell.yml
|
288
|
+
- spec/fixtures/vcr_cassettes/remitano/offers/update.yml
|
289
|
+
- spec/fixtures/vcr_cassettes/remitano/orders/cancel.yml
|
290
|
+
- spec/fixtures/vcr_cassettes/remitano/orders/create.yml
|
291
|
+
- spec/fixtures/vcr_cassettes/remitano/orders/open.yml
|
292
|
+
- spec/fixtures/vcr_cassettes/remitano/price_ladders/sell.yml
|
293
|
+
- spec/fixtures/vcr_cassettes/remitano/rates.yml
|
294
|
+
- spec/fixtures/vcr_cassettes/remitano/trades/active.yml
|
295
|
+
- spec/fixtures/vcr_cassettes/remitano/trades/completed.yml
|
296
|
+
- spec/fixtures/vcr_cassettes/remitano/trades/release.yml
|
297
|
+
- spec/offers_spec.rb
|
298
|
+
- spec/orders_spec.rb
|
299
|
+
- spec/public/price_ladders_spec.rb
|
300
|
+
- spec/public/rates_spec.rb
|
301
|
+
- spec/spec_helper.rb
|
302
|
+
- spec/support/crendentials.rb
|
303
|
+
- spec/support/request_usec.rb
|
304
|
+
- spec/support/vcr.rb
|
305
|
+
- spec/trades_spec.rb
|
306
|
+
homepage: http://github.com/remitano/remitano-ruby
|
307
|
+
licenses:
|
308
|
+
- MIT
|
309
|
+
metadata: {}
|
310
|
+
post_install_message:
|
311
|
+
rdoc_options: []
|
312
|
+
require_paths:
|
313
|
+
- lib
|
314
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
315
|
+
requirements:
|
316
|
+
- - ">="
|
317
|
+
- !ruby/object:Gem::Version
|
318
|
+
version: '0'
|
319
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
320
|
+
requirements:
|
321
|
+
- - ">="
|
322
|
+
- !ruby/object:Gem::Version
|
323
|
+
version: '0'
|
324
|
+
requirements: []
|
325
|
+
rubygems_version: 3.0.6
|
326
|
+
signing_key:
|
327
|
+
specification_version: 4
|
328
|
+
summary: Remitano Ruby API
|
329
|
+
test_files: []
|