btcjammer 0.1.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 +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +138 -0
- data/Rakefile +9 -0
- data/btcjammer.gemspec +31 -0
- data/lib/btcjammer.rb +74 -0
- data/lib/btcjammer/automatic_plan_templates.rb +13 -0
- data/lib/btcjammer/automatic_plans.rb +24 -0
- data/lib/btcjammer/currencies.rb +13 -0
- data/lib/btcjammer/employment_statuses.rb +13 -0
- data/lib/btcjammer/listings.rb +39 -0
- data/lib/btcjammer/national_id_types.rb +13 -0
- data/lib/btcjammer/payment_types.rb +13 -0
- data/lib/btcjammer/submit_documents.rb +32 -0
- data/lib/btcjammer/terms.rb +13 -0
- data/lib/btcjammer/users.rb +71 -0
- data/lib/btcjammer/version.rb +4 -0
- data/test/automatic_plan_templates_test.rb +19 -0
- data/test/currencies_test.rb +26 -0
- data/test/employment_statuses_test.rb +19 -0
- data/test/fixtures/automatic_plan_templates.yml +54 -0
- data/test/fixtures/currencies.yml +95 -0
- data/test/fixtures/employee_statuses.yml +61 -0
- data/test/fixtures/national_id_types.yml +79 -0
- data/test/fixtures/payment_types.yml +99 -0
- data/test/fixtures/terms.yml +100 -0
- data/test/listings_test.rb +70 -0
- data/test/national_id_types_test.rb +20 -0
- data/test/payment_types_test.rb +22 -0
- data/test/submit_documents_test.rb +38 -0
- data/test/terms_test.rb +21 -0
- data/test/test_helper.rb +9 -0
- data/test/users_test.rb +130 -0
- metadata +221 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://btcjam.com/payment_types.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.2
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Cache-Control:
|
22
|
+
- max-age=0, private, must-revalidate
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Date:
|
26
|
+
- Fri, 09 Oct 2015 07:37:58 GMT
|
27
|
+
Server:
|
28
|
+
- nginx/1.6.2 + Phusion Passenger 4.0.50
|
29
|
+
Set-Cookie:
|
30
|
+
- XSRF-TOKEN=LIWB1K3IWnPGt%2B59AN8tfP1%2BpcchI1Lj%2B%2BPKPDJZXxpWOQRp%2BE8BobQ3V5cyN68uBRu6XNWN3LAJn5jYuYM3Og%3D%3D;
|
31
|
+
path=/; secure
|
32
|
+
- _session_id=84fc5d80307be7d2da9b61833b8c23f5; path=/; expires=Fri, 09 Oct
|
33
|
+
2015 13:37:58 -0000; secure; HttpOnly
|
34
|
+
Status:
|
35
|
+
- 200 OK
|
36
|
+
Strict-Transport-Security:
|
37
|
+
- max-age=31536000
|
38
|
+
Vary:
|
39
|
+
- Accept-Encoding
|
40
|
+
X-Content-Type-Options:
|
41
|
+
- nosniff
|
42
|
+
X-Frame-Options:
|
43
|
+
- ALLOW-FROM https://www.optimizely.com/
|
44
|
+
X-Powered-By:
|
45
|
+
- Phusion Passenger 4.0.50
|
46
|
+
X-Request-Id:
|
47
|
+
- bde48d05-9a1d-4c0c-9f30-0b7ef0c09f99
|
48
|
+
X-Runtime:
|
49
|
+
- '0.022164'
|
50
|
+
X-Xss-Protection:
|
51
|
+
- 1; mode=block
|
52
|
+
Transfer-Encoding:
|
53
|
+
- chunked
|
54
|
+
Connection:
|
55
|
+
- keep-alive
|
56
|
+
body:
|
57
|
+
encoding: ASCII-8BIT
|
58
|
+
string: |2-
|
59
|
+
|
60
|
+
[
|
61
|
+
{
|
62
|
+
"id": 4,
|
63
|
+
"name": "1st of the month",
|
64
|
+
"days_of_interval": 30,
|
65
|
+
"enabled": true,
|
66
|
+
"translated_name": "1st of the month"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"id": 5,
|
70
|
+
"name": "5th of the month",
|
71
|
+
"days_of_interval": 30,
|
72
|
+
"enabled": true,
|
73
|
+
"translated_name": "5th of the month"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"id": 6,
|
77
|
+
"name": "10th of the month",
|
78
|
+
"days_of_interval": 30,
|
79
|
+
"enabled": true,
|
80
|
+
"translated_name": "10th of the month"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"id": 3,
|
84
|
+
"name": "Weekly",
|
85
|
+
"days_of_interval": 7,
|
86
|
+
"enabled": true,
|
87
|
+
"translated_name": "Weekly"
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"id": 7,
|
91
|
+
"name": "Monthly",
|
92
|
+
"days_of_interval": 30,
|
93
|
+
"enabled": true,
|
94
|
+
"translated_name": "Monthly"
|
95
|
+
}
|
96
|
+
]
|
97
|
+
http_version:
|
98
|
+
recorded_at: Fri, 09 Oct 2015 07:37:58 GMT
|
99
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://btcjam.com/terms.json
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.2
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Cache-Control:
|
22
|
+
- max-age=0, private, must-revalidate
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Date:
|
26
|
+
- Mon, 12 Oct 2015 20:02:45 GMT
|
27
|
+
Server:
|
28
|
+
- nginx/1.6.2 + Phusion Passenger 4.0.50
|
29
|
+
Set-Cookie:
|
30
|
+
- XSRF-TOKEN=ntDhe919YPRpDm0yY2D%2BSeJv3BQcOPGvLPygQUjjG7enpRv7AmYm%2BHMr8tbxtsMuyBX6tRg4zg817PGBuh0Kbw%3D%3D;
|
31
|
+
path=/; secure
|
32
|
+
- _session_id=1ffba0fece8df0b3b25a6d9e72ff2e68; path=/; expires=Tue, 13 Oct
|
33
|
+
2015 02:02:45 -0000; secure; HttpOnly
|
34
|
+
Status:
|
35
|
+
- 200 OK
|
36
|
+
Strict-Transport-Security:
|
37
|
+
- max-age=31536000
|
38
|
+
Vary:
|
39
|
+
- Accept-Encoding
|
40
|
+
X-Content-Type-Options:
|
41
|
+
- nosniff
|
42
|
+
X-Frame-Options:
|
43
|
+
- ALLOW-FROM https://www.optimizely.com/
|
44
|
+
X-Powered-By:
|
45
|
+
- Phusion Passenger 4.0.50
|
46
|
+
X-Request-Id:
|
47
|
+
- beacab76-1849-4077-b46d-70abb008a083
|
48
|
+
X-Runtime:
|
49
|
+
- '0.024038'
|
50
|
+
X-Xss-Protection:
|
51
|
+
- 1; mode=block
|
52
|
+
Transfer-Encoding:
|
53
|
+
- chunked
|
54
|
+
Connection:
|
55
|
+
- keep-alive
|
56
|
+
body:
|
57
|
+
encoding: ASCII-8BIT
|
58
|
+
string: |2-
|
59
|
+
|
60
|
+
[
|
61
|
+
{
|
62
|
+
"id": 4,
|
63
|
+
"term_days": 30,
|
64
|
+
"short_term": true,
|
65
|
+
"name": "1 Month"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"id": 5,
|
69
|
+
"term_days": 60,
|
70
|
+
"short_term": true,
|
71
|
+
"name": "2 Months"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"id": 6,
|
75
|
+
"term_days": 90,
|
76
|
+
"short_term": false,
|
77
|
+
"name": "3 Months"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"id": 8,
|
81
|
+
"term_days": 180,
|
82
|
+
"short_term": false,
|
83
|
+
"name": "6 Months"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"id": 9,
|
87
|
+
"term_days": 270,
|
88
|
+
"short_term": false,
|
89
|
+
"name": "9 Months"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"id": 10,
|
93
|
+
"term_days": 365,
|
94
|
+
"short_term": false,
|
95
|
+
"name": "1 Year"
|
96
|
+
}
|
97
|
+
]
|
98
|
+
http_version:
|
99
|
+
recorded_at: Mon, 12 Oct 2015 20:02:40 GMT
|
100
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
describe 'BTCJammer::Listings' do
|
4
|
+
before do
|
5
|
+
BTCJammer.configure do |config|
|
6
|
+
config.client_id = 'test_id'
|
7
|
+
config.client_secret = 'test_secret'
|
8
|
+
end
|
9
|
+
VCR.turn_off! ignore_cassettes: true
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
VCR.turn_on!
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should exist for sure' do
|
17
|
+
assert BTCJammer::Listings
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return a list of all open listings' do
|
21
|
+
stub_request(:get, 'https://btcjam.com/api/v1/listings.json?appid=test_id&secret=test_secret')
|
22
|
+
.to_return(body: [
|
23
|
+
{
|
24
|
+
'listing' => {
|
25
|
+
'id' => 53_498,
|
26
|
+
'title' => 'Debt. Reconsolidation',
|
27
|
+
'term_days' => 365,
|
28
|
+
'description' => 'This should help me a lot.',
|
29
|
+
'amount' => 11.1844,
|
30
|
+
'user' => {
|
31
|
+
'id' => 4022
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
].to_json)
|
36
|
+
|
37
|
+
listings = BTCJammer::Listings.all
|
38
|
+
|
39
|
+
assert listings.is_a? Array
|
40
|
+
|
41
|
+
assert listings.first.id == 53_498
|
42
|
+
assert listings.first.title == 'Debt. Reconsolidation'
|
43
|
+
assert listings.first.term_days == 365
|
44
|
+
assert listings.first.description == 'This should help me a lot.'
|
45
|
+
assert listings.first.amount == 11.1844
|
46
|
+
assert listings.first.user.id == 4022
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should allow an authenticated user to create a listing' do
|
50
|
+
stub_request(:post, 'https://btcjam.com/api/v1/listings.json')
|
51
|
+
.with(body: { 'listing' => "{\"loan_purpose_id\":1,\"currency_id\":2,\"amount\":0.01,\"term_days\":123,\"payment_type_id\":3,\"locale_id\":4,\"title\":\"A new listing\",\"description\":\"Sweet!\"}" },
|
52
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer 12354', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => 'Faraday v0.9.2' })
|
53
|
+
.to_return(status: 200, body: { listing: { success: true } }.to_json, headers: {})
|
54
|
+
|
55
|
+
token = '12354'
|
56
|
+
listing_params = {
|
57
|
+
loan_purpose_id: 1,
|
58
|
+
currency_id: 2,
|
59
|
+
amount: 0.01,
|
60
|
+
term_days: 123,
|
61
|
+
payment_type_id: 3,
|
62
|
+
locale_id: 4,
|
63
|
+
title: 'A new listing',
|
64
|
+
description: 'Sweet!'
|
65
|
+
}
|
66
|
+
response = BTCJammer::Listings.create token, listing_params
|
67
|
+
|
68
|
+
assert response.success
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
describe 'BTCJammer::NationalIDTypes' do
|
4
|
+
it 'should exist for sure' do
|
5
|
+
assert BTCJammer::NationalIDTypes
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should return a list of all supported national ID types' do
|
9
|
+
VCR.use_cassette('national_id_types') do
|
10
|
+
types = BTCJammer::NationalIDTypes.all
|
11
|
+
|
12
|
+
assert types.is_a? Array
|
13
|
+
assert types.length == 3
|
14
|
+
|
15
|
+
assert types.first.id == 1
|
16
|
+
assert types.first.name == "Driver's License"
|
17
|
+
assert types.first.translated_name == "Driver's License"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
describe 'BTCJammer::PaymentTypes' do
|
4
|
+
it 'should exist for sure' do
|
5
|
+
assert BTCJammer::PaymentTypes
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should return a list of all supported payment types' do
|
9
|
+
VCR.use_cassette('payment_types') do
|
10
|
+
types = BTCJammer::PaymentTypes.all
|
11
|
+
|
12
|
+
assert types.is_a? Array
|
13
|
+
assert types.length == 5
|
14
|
+
|
15
|
+
assert types.first.id == 4
|
16
|
+
assert types.first.name == '1st of the month'
|
17
|
+
assert types.first.days_of_interval == 30
|
18
|
+
assert types.first.enabled
|
19
|
+
assert types.first.translated_name == '1st of the month'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
describe 'BTCJammer::SubmitDocuments' do
|
4
|
+
before do
|
5
|
+
VCR.turn_off! ignore_cassettes: true
|
6
|
+
BTCJammer.configure do |config|
|
7
|
+
config.client_id = 'test_id'
|
8
|
+
config.client_secret = 'test_secret'
|
9
|
+
config.redirect_uri = 'localhost/callback'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
VCR.turn_on!
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should exist for sure' do
|
18
|
+
assert BTCJammer::SubmitDocuments
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should support creating an identity check' do
|
22
|
+
stub_request(:post, 'https://btcjam.com/api/v1/identity_checks.json')
|
23
|
+
.with(body: { 'identity_check' => "{\"name\":\"Bob Sagat\",\"dob\":\"2015-01-01\",\"gender\":\"Male\",\"nationalid\":1,\"nationalid_type_id\":1,\"img\":\"\"}" },
|
24
|
+
headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer 1234', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => 'Faraday v0.9.2' })
|
25
|
+
.to_return(status: 200, body: { identity_check: {} }.to_json, headers: {})
|
26
|
+
|
27
|
+
token = '1234'
|
28
|
+
params = {
|
29
|
+
name: 'Bob Sagat',
|
30
|
+
dob: '2015-01-01',
|
31
|
+
gender: 'Male',
|
32
|
+
nationalid: 1,
|
33
|
+
nationalid_type_id: 1,
|
34
|
+
img: ''
|
35
|
+
}
|
36
|
+
BTCJammer::SubmitDocuments.create_identity_check(token, params)
|
37
|
+
end
|
38
|
+
end
|
data/test/terms_test.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
describe 'BTCJammer::Terms' do
|
4
|
+
it 'should exist for sure' do
|
5
|
+
assert BTCJammer::Terms
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should return a list of all supported terms' do
|
9
|
+
VCR.use_cassette('terms') do
|
10
|
+
terms = BTCJammer::Terms.all
|
11
|
+
|
12
|
+
assert terms.is_a? Array
|
13
|
+
assert terms.length == 6
|
14
|
+
|
15
|
+
assert terms.first.id == 4
|
16
|
+
assert terms.first.name == '1 Month'
|
17
|
+
assert terms.first.short_term == true
|
18
|
+
assert terms.first.term_days == 30
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/test/test_helper.rb
ADDED
data/test/users_test.rb
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
describe 'BTCJammer::Users' do
|
4
|
+
before do
|
5
|
+
VCR.turn_off! ignore_cassettes: true
|
6
|
+
BTCJammer.configure do |config|
|
7
|
+
config.client_id = 'test_id'
|
8
|
+
config.client_secret = 'test_secret'
|
9
|
+
config.redirect_uri = 'localhost/callback'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
VCR.turn_on!
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should exist for sure' do
|
18
|
+
assert BTCJammer::Users
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should support creating new users' do
|
22
|
+
stub_request(:post, 'https://btcjam.com/api/v1/users.json?appid=test_id&secret=test_secret')
|
23
|
+
.to_return(body: {}.to_json)
|
24
|
+
|
25
|
+
BTCJammer::Users.create('test@example.com', '12345')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should support retrieving an authenticated user's profile" do
|
29
|
+
stub_request(:get, 'https://btcjam.com/api/v1/me.json')
|
30
|
+
.to_return(body: { id: 123, email: 'test@example.com' }.to_json)
|
31
|
+
|
32
|
+
token = '12345'
|
33
|
+
profile = BTCJammer::Users.profile token
|
34
|
+
|
35
|
+
assert profile.id == 123
|
36
|
+
assert profile.email == 'test@example.com'
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should support retrieving an authenticated user's open listings" do
|
40
|
+
stub_request(:get, 'https://btcjam.com/api/v1/my_open_listings.json')
|
41
|
+
.to_return(body: [{ id: 123, title: 'Blarg' }].to_json)
|
42
|
+
|
43
|
+
token = '12345'
|
44
|
+
listings = BTCJammer::Users.open_listings token
|
45
|
+
|
46
|
+
assert listings.class == Array
|
47
|
+
assert listings.first.id == 123
|
48
|
+
assert listings.first.title == 'Blarg'
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should support retrieving an authenticated user's recieables" do
|
52
|
+
stub_request(:get, 'https://btcjam.com/api/v1/my_receivables.json')
|
53
|
+
.to_return(body: { user: { id: 123, amount_received: 0.0 } }.to_json)
|
54
|
+
|
55
|
+
token = '12345'
|
56
|
+
receivables = BTCJammer::Users.receivables token
|
57
|
+
|
58
|
+
assert receivables.id == 123
|
59
|
+
assert receivables.amount_received == 0.0
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should support retrieving an authenticated user's payables" do
|
63
|
+
stub_request(:get, 'https://btcjam.com/api/v1/my_payables.json')
|
64
|
+
.to_return(body: { user: { id: 123, amount_paid: 0.0 } }.to_json)
|
65
|
+
|
66
|
+
token = '12345'
|
67
|
+
payables = BTCJammer::Users.payables token
|
68
|
+
|
69
|
+
assert payables.id == 123
|
70
|
+
assert payables.amount_paid == 0.0
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should support retrieving an authenticated user's identity checks" do
|
74
|
+
stub_request(:get, 'https://btcjam.com/api/v1/identity_checks.json')
|
75
|
+
.to_return(body: { identity_checks: [] }.to_json)
|
76
|
+
|
77
|
+
token = '12345'
|
78
|
+
identity_checks = BTCJammer::Users.identity_checks token
|
79
|
+
|
80
|
+
assert identity_checks.class == Array
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should support retrieving an authenticated user's credit checks" do
|
84
|
+
stub_request(:get, 'https://btcjam.com/api/v1/credit_checks.json')
|
85
|
+
.to_return(body: { credit_checks: [] }.to_json)
|
86
|
+
|
87
|
+
token = '12345'
|
88
|
+
credit_checks = BTCJammer::Users.credit_checks token
|
89
|
+
|
90
|
+
assert credit_checks.class == Array
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should support retrieving an authenticated user's address checks" do
|
94
|
+
stub_request(:get, 'https://btcjam.com/api/v1/addr_checks.json')
|
95
|
+
.to_return(body: { addr_checks: [] }.to_json)
|
96
|
+
|
97
|
+
token = '12345'
|
98
|
+
addr_checks = BTCJammer::Users.addr_checks token
|
99
|
+
|
100
|
+
assert addr_checks.class == Array
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should support retrieving an authenticated user's automatic plans" do
|
104
|
+
stub_request(:get, 'https://btcjam.com/api/v1/automatic_plans.json')
|
105
|
+
.to_return(body: { automatic_plans: [] }.to_json)
|
106
|
+
|
107
|
+
token = '12345'
|
108
|
+
addr_checks = BTCJammer::Users.automatic_plans token
|
109
|
+
|
110
|
+
assert addr_checks.class == Array
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should support making investments for authenticated users' do
|
114
|
+
stub_request(:post, 'https://btcjam.com/api/v1/investments.json')
|
115
|
+
.with(body: { 'amount' => '0.0001', 'listing_id' => '334' },
|
116
|
+
headers: { 'Accept' => '*/*',
|
117
|
+
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
118
|
+
'Authorization' => 'Bearer 12345',
|
119
|
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
120
|
+
'User-Agent' => 'Faraday v0.9.2' })
|
121
|
+
.to_return(status: 200, body: {
|
122
|
+
listing_investment: { success: true } }.to_json,
|
123
|
+
headers: {})
|
124
|
+
|
125
|
+
token = '12345'
|
126
|
+
result = BTCJammer::Users.invest token, '334', 0.0001
|
127
|
+
|
128
|
+
assert result.success
|
129
|
+
end
|
130
|
+
end
|