bitreserve 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +3 -0
- data/.travis.yml +13 -0
- data/Gemfile +7 -1
- data/README.md +5 -0
- data/Rakefile +2 -3
- data/bitreserve.gemspec +2 -0
- data/lib/bitreserve.rb +16 -6
- data/lib/bitreserve/api.rb +22 -0
- data/lib/bitreserve/api/auth_token.rb +16 -0
- data/lib/bitreserve/api/card.rb +36 -0
- data/lib/bitreserve/api/contact.rb +34 -0
- data/lib/bitreserve/api/endpoints.rb +26 -0
- data/lib/bitreserve/api/private_transaction.rb +58 -0
- data/lib/bitreserve/api/public_transaction.rb +23 -0
- data/lib/bitreserve/api/ticker.rb +23 -0
- data/lib/bitreserve/api/transparency.rb +10 -0
- data/lib/bitreserve/api/user.rb +23 -0
- data/lib/bitreserve/client.rb +22 -0
- data/lib/bitreserve/entities/asset.rb +7 -0
- data/lib/bitreserve/entities/auth_token.rb +7 -0
- data/lib/bitreserve/entities/base_entity.rb +28 -0
- data/lib/bitreserve/entities/card.rb +8 -0
- data/lib/bitreserve/entities/contact.rb +7 -0
- data/lib/bitreserve/entities/phone.rb +7 -0
- data/lib/bitreserve/entities/ticker.rb +7 -0
- data/lib/bitreserve/entities/transaction.rb +7 -0
- data/lib/bitreserve/entities/user.rb +19 -0
- data/lib/bitreserve/helpers.rb +23 -0
- data/lib/bitreserve/request.rb +31 -14
- data/lib/bitreserve/request_data.rb +7 -0
- data/lib/bitreserve/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/me.yml +185 -0
- data/spec/fixtures/vcr_cassettes/me/card.yml +61 -0
- data/spec/fixtures/vcr_cassettes/me/cards.yml +67 -0
- data/spec/fixtures/vcr_cassettes/me/contact.yml +61 -0
- data/spec/fixtures/vcr_cassettes/me/contacts.yml +61 -0
- data/spec/fixtures/vcr_cassettes/me/created_card.yml +61 -0
- data/spec/fixtures/vcr_cassettes/me/created_contact.yml +61 -0
- data/spec/fixtures/vcr_cassettes/me/phones.yml +61 -0
- data/spec/fixtures/vcr_cassettes/me/transactions/cancel.yml +61 -0
- data/spec/fixtures/vcr_cassettes/me/transactions/commit.yml +62 -0
- data/spec/fixtures/vcr_cassettes/me/transactions/create.yml +61 -0
- data/spec/fixtures/vcr_cassettes/me/transactions/create_waiting_cancel.yml +118 -0
- data/spec/fixtures/vcr_cassettes/me/transactions/create_waiting_resend.yml +118 -0
- data/spec/fixtures/vcr_cassettes/me/transactions/resend.yml +61 -0
- data/spec/fixtures/vcr_cassettes/reserve/transaction.yml +60 -0
- data/spec/fixtures/vcr_cassettes/reserve/transactions.yml +60 -0
- data/spec/fixtures/vcr_cassettes/tickers.yml +60 -0
- data/spec/fixtures/vcr_cassettes/transparency.yml +60 -0
- data/spec/integration/api/card_spec.rb +47 -0
- data/spec/integration/api/contact_spec.rb +53 -0
- data/spec/integration/api/private_transactions_spec.rb +74 -0
- data/spec/integration/api/public_transaction_spec.rb +34 -0
- data/spec/integration/api/ticker_spec.rb +21 -0
- data/spec/integration/api/transparency_spec.rb +21 -0
- data/spec/integration/api/user_spec.rb +32 -0
- data/spec/spec_helper.rb +19 -1
- data/spec/support/vcr.rb +8 -0
- data/spec/support/webmock.rb +24 -0
- data/spec/unit/api/auth_spec.rb +22 -0
- data/spec/unit/api/card_spec.rb +47 -0
- data/spec/unit/api/contact_spec.rb +53 -0
- data/spec/unit/api/private_transaction_spec.rb +114 -0
- data/spec/unit/api/public_transaction_spec.rb +34 -0
- data/spec/unit/api/ticker_spec.rb +34 -0
- data/spec/unit/api/transparency_spec.rb +21 -0
- data/spec/unit/api/user_spec.rb +33 -0
- data/spec/unit/auth_request_spec.rb +32 -0
- data/spec/unit/client_spec.rb +23 -0
- data/spec/unit/entities/base_entity_spec.rb +32 -0
- data/spec/unit/entities/user_spec.rb +26 -0
- data/spec/unit/helper_spec.rb +37 -0
- data/spec/unit/request_spec.rb +58 -0
- metadata +136 -8
- data/lib/bitreserve/endpoints.rb +0 -5
- data/lib/bitreserve/ticker.rb +0 -7
- data/spec/request_spec.rb +0 -37
- data/spec/ticker_spec.rb +0 -15
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'webmock/rspec'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
5
|
+
|
6
|
+
module WebMockHelpers
|
7
|
+
def self.bitreserve_stub_request(method, url, response = [])
|
8
|
+
WebMock::API.stub_request(method, Bitreserve::Request.base_uri + url).
|
9
|
+
to_return(body: response.to_json, headers: { 'Content-Type' => 'application/json' })
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.bitreserve_stub_request_with_auth(method, url, response = [], auth = nil)
|
13
|
+
new_url = generate_auth_url(url, auth)
|
14
|
+
WebMock::API.stub_request(method, new_url).
|
15
|
+
to_return(body: response.to_json, headers: { 'Content-Type' => 'application/json' })
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def self.generate_auth_url(url, auth)
|
21
|
+
uri = URI.parse(Bitreserve::AuthRequest.base_uri)
|
22
|
+
uri.scheme + '://' + auth[:username] + ':' + auth[:password] + '@' + uri.host + url
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
module API
|
5
|
+
describe AuthToken do
|
6
|
+
let(:client) { Client.new }
|
7
|
+
|
8
|
+
context '#generate_access_token' do
|
9
|
+
it 'generates a personal access token' do
|
10
|
+
auth = { username: 'user', password: 'pass' }
|
11
|
+
request_data = RequestData.new(Endpoints::AUTH, Entities::AuthToken, client.authorization_header, nil, auth)
|
12
|
+
allow(Request).to receive(:perform_with_object)
|
13
|
+
|
14
|
+
client.generate_access_token(auth)
|
15
|
+
|
16
|
+
expect(Request).to have_received(:perform_with_object).
|
17
|
+
with(:post, request_data)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
module API
|
5
|
+
describe Card do
|
6
|
+
let(:client) { Client.new }
|
7
|
+
|
8
|
+
context '#all_cards' do
|
9
|
+
it 'gets all the cards' do
|
10
|
+
request_data = RequestData.new(Endpoints::CARD, Entities::Card, client.authorization_header)
|
11
|
+
allow(Request).to receive(:perform_with_objects)
|
12
|
+
|
13
|
+
client.all_cards
|
14
|
+
|
15
|
+
expect(Request).to have_received(:perform_with_objects).
|
16
|
+
with(:get, request_data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context '#find_card' do
|
21
|
+
it 'gets a specific card' do
|
22
|
+
id = '1234'
|
23
|
+
request_data = RequestData.new(Endpoints::CARD + "/#{id}", Entities::Card, client.authorization_header)
|
24
|
+
allow(Request).to receive(:perform_with_object)
|
25
|
+
|
26
|
+
client.find_card(id: id)
|
27
|
+
|
28
|
+
expect(Request).to have_received(:perform_with_object).
|
29
|
+
with(:get, request_data)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context '#create_card' do
|
34
|
+
it 'creates a card' do
|
35
|
+
data = { label: 'New card', currency: 'EUR' }
|
36
|
+
request_data = RequestData.new(Endpoints::CARD, Entities::Card, client.authorization_header, data)
|
37
|
+
allow(Request).to receive(:perform_with_object)
|
38
|
+
|
39
|
+
client.create_card(data)
|
40
|
+
|
41
|
+
expect(Request).to have_received(:perform_with_object).
|
42
|
+
with(:post, request_data)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
module API
|
5
|
+
describe Card do
|
6
|
+
let(:client) { Bitreserve::Client.new }
|
7
|
+
|
8
|
+
context '#all_contacts' do
|
9
|
+
it 'gets all the contacts' do
|
10
|
+
request_data = RequestData.new(Endpoints::USER_CONTACTS, Entities::Contact, client.authorization_header)
|
11
|
+
allow(Request).to receive(:perform_with_objects)
|
12
|
+
|
13
|
+
client.all_contacts
|
14
|
+
|
15
|
+
expect(Request).to have_received(:perform_with_objects).
|
16
|
+
with(:get, request_data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context '#find_contact' do
|
21
|
+
it 'gets a specific contact' do
|
22
|
+
id = '1234'
|
23
|
+
request_data = RequestData.new(Endpoints::USER_CONTACTS + "/#{id}", Entities::Contact, client.authorization_header)
|
24
|
+
allow(Request).to receive(:perform_with_object)
|
25
|
+
|
26
|
+
client.find_contact(id: id)
|
27
|
+
|
28
|
+
expect(Request).to have_received(:perform_with_object).
|
29
|
+
with(:get, request_data)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context '#create_contact' do
|
34
|
+
it 'creates a contact' do
|
35
|
+
data = {
|
36
|
+
first_name: 'first-name',
|
37
|
+
last_name: 'last-name',
|
38
|
+
emails: ['fake@email.com'],
|
39
|
+
company: 'company-name',
|
40
|
+
addresses: ['fake-address-1', 'fake-address-2']
|
41
|
+
}
|
42
|
+
request_data = RequestData.new(Endpoints::USER_CONTACTS, Entities::Contact, client.authorization_header, Bitreserve::Helpers.camelized_hash(data))
|
43
|
+
allow(Request).to receive(:perform_with_object)
|
44
|
+
|
45
|
+
client.create_contact(data)
|
46
|
+
|
47
|
+
expect(Request).to have_received(:perform_with_object).
|
48
|
+
with(:post, request_data)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
module API
|
5
|
+
describe PrivateTransaction do
|
6
|
+
let(:client) { Client.new }
|
7
|
+
|
8
|
+
context '#create_transaction' do
|
9
|
+
it 'creates a transaction for a specific card' do
|
10
|
+
card_id = '1234'
|
11
|
+
request_data = RequestData.new(
|
12
|
+
Endpoints.with_placeholders(Endpoints::CARD_PRIVATE_TRANSACTIONS, ':card' => card_id),
|
13
|
+
Entities::Transaction,
|
14
|
+
client.authorization_header,
|
15
|
+
card_id: card_id, denomination: { currency: 'USD', amount: 10 }, destination: 'foo@bar.com'
|
16
|
+
)
|
17
|
+
allow(Request).to receive(:perform_with_object)
|
18
|
+
|
19
|
+
client.create_transaction(card_id: card_id, currency: 'USD', amount: 10, destination: 'foo@bar.com')
|
20
|
+
|
21
|
+
expect(Request).to have_received(:perform_with_object).
|
22
|
+
with(:post, request_data)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context '#commit_transaction' do
|
27
|
+
it 'commits a transaction for a specific card' do
|
28
|
+
card_id = '1234'
|
29
|
+
transaction_id = '4567'
|
30
|
+
request_data = RequestData.new(
|
31
|
+
Endpoints.with_placeholders(Endpoints::COMMIT_TRANSACTION, ':card' => card_id, ':id' => transaction_id),
|
32
|
+
Entities::Transaction,
|
33
|
+
client.authorization_header
|
34
|
+
)
|
35
|
+
allow(Request).to receive(:perform_with_object)
|
36
|
+
|
37
|
+
client.commit_transaction(card_id: card_id, transaction_id: transaction_id)
|
38
|
+
|
39
|
+
expect(Request).to have_received(:perform_with_object).
|
40
|
+
with(:post, request_data)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#cancel_transaction' do
|
45
|
+
it 'cancels a transaction for a specific card' do
|
46
|
+
card_id = '1234'
|
47
|
+
transaction_id = '4567'
|
48
|
+
request_data = RequestData.new(
|
49
|
+
Endpoints.with_placeholders(Endpoints::CANCEL_TRANSACTION, ':card' => card_id, ':id' => transaction_id),
|
50
|
+
Entities::Transaction,
|
51
|
+
client.authorization_header
|
52
|
+
)
|
53
|
+
allow(Request).to receive(:perform_with_object)
|
54
|
+
|
55
|
+
client.cancel_transaction(card_id: card_id, transaction_id: transaction_id)
|
56
|
+
|
57
|
+
expect(Request).to have_received(:perform_with_object).
|
58
|
+
with(:post, request_data)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context '#resend_transaction' do
|
63
|
+
it 'resends a transaction for a specific card' do
|
64
|
+
card_id = '1234'
|
65
|
+
transaction_id = '4567'
|
66
|
+
request_data = RequestData.new(
|
67
|
+
Endpoints.with_placeholders(Endpoints::RESEND_TRANSACTION, ':card' => card_id, ':id' => transaction_id),
|
68
|
+
Entities::Transaction,
|
69
|
+
client.authorization_header
|
70
|
+
)
|
71
|
+
allow(Request).to receive(:perform_with_object)
|
72
|
+
|
73
|
+
client.resend_transaction(card_id: card_id, transaction_id: transaction_id)
|
74
|
+
|
75
|
+
expect(Request).to have_received(:perform_with_object).
|
76
|
+
with(:post, request_data)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context '#all_user_transactions' do
|
81
|
+
it 'lists all the transactions associated with the current user' do
|
82
|
+
request_data = RequestData.new(
|
83
|
+
Endpoints::USER_PRIVATE_TRANSACTIONS,
|
84
|
+
Entities::Transaction,
|
85
|
+
client.authorization_header
|
86
|
+
)
|
87
|
+
allow(Request).to receive(:perform_with_objects)
|
88
|
+
|
89
|
+
client.all_user_transactions
|
90
|
+
|
91
|
+
expect(Request).to have_received(:perform_with_objects).
|
92
|
+
with(:get, request_data)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context '#all_card_transactions' do
|
97
|
+
it 'lists all the transactions associated with a specific card' do
|
98
|
+
card_id = '1234'
|
99
|
+
request_data = RequestData.new(
|
100
|
+
Endpoints.with_placeholders(Endpoints::CARD_PRIVATE_TRANSACTIONS, ':card' => card_id),
|
101
|
+
Entities::Transaction,
|
102
|
+
client.authorization_header
|
103
|
+
)
|
104
|
+
allow(Request).to receive(:perform_with_objects)
|
105
|
+
|
106
|
+
client.all_card_transactions(card_id: card_id)
|
107
|
+
|
108
|
+
expect(Request).to have_received(:perform_with_objects).
|
109
|
+
with(:get, request_data)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
module API
|
5
|
+
describe PublicTransaction do
|
6
|
+
let(:client) { Bitreserve::Client.new }
|
7
|
+
|
8
|
+
context '#all_public_transactions' do
|
9
|
+
it 'gets all public transactions' do
|
10
|
+
request_data = RequestData.new(Endpoints::PUBLIC_TRANSACTIONS, Entities::Transaction, client.authorization_header)
|
11
|
+
allow(Request).to receive(:perform_with_objects)
|
12
|
+
|
13
|
+
client.all_public_transactions
|
14
|
+
|
15
|
+
expect(Request).to have_received(:perform_with_objects).
|
16
|
+
with(:get, request_data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context '#find_public_transaction' do
|
21
|
+
it 'gets a public transaction' do
|
22
|
+
id = '1234'
|
23
|
+
request_data = RequestData.new(Endpoints::PUBLIC_TRANSACTIONS + "/#{id}", Entities::Transaction, client.authorization_header)
|
24
|
+
allow(Request).to receive(:perform_with_object)
|
25
|
+
|
26
|
+
client.find_public_transaction(id: id)
|
27
|
+
|
28
|
+
expect(Request).to have_received(:perform_with_object).
|
29
|
+
with(:get, request_data)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
module API
|
5
|
+
describe Ticker do
|
6
|
+
let(:client) { Bitreserve::Client.new }
|
7
|
+
|
8
|
+
context '#all_tickers' do
|
9
|
+
it 'gets all the tickers' do
|
10
|
+
request_data = Bitreserve::RequestData.new(Endpoints::TICKER, Bitreserve::Entities::Ticker, client.authorization_header)
|
11
|
+
allow(Request).to receive(:perform_with_objects)
|
12
|
+
|
13
|
+
client.all_tickers
|
14
|
+
|
15
|
+
expect(Request).to have_received(:perform_with_objects).
|
16
|
+
with(:get, request_data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context '#find_ticker' do
|
21
|
+
it 'gets a specific ticker' do
|
22
|
+
currency = 'USD'
|
23
|
+
request_data = Bitreserve::RequestData.new(Endpoints::TICKER + "/#{currency}", Bitreserve::Entities::Ticker, client.authorization_header)
|
24
|
+
allow(Request).to receive(:perform_with_objects)
|
25
|
+
|
26
|
+
client.find_ticker(currency: currency)
|
27
|
+
|
28
|
+
expect(Request).to have_received(:perform_with_objects).
|
29
|
+
with(:get, request_data)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
module API
|
5
|
+
describe Transparency do
|
6
|
+
let(:client) { Client.new }
|
7
|
+
|
8
|
+
context '#statistics' do
|
9
|
+
it 'gets all the bitreserve reserve stats' do
|
10
|
+
request_data = RequestData.new(Endpoints::STATS, Entities::Asset, client.authorization_header)
|
11
|
+
allow(Request).to receive(:perform_with_objects)
|
12
|
+
|
13
|
+
client.statistics
|
14
|
+
|
15
|
+
expect(Request).to have_received(:perform_with_objects).
|
16
|
+
with(:get, request_data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
module API
|
5
|
+
describe User do
|
6
|
+
let(:client) { Bitreserve::Client.new }
|
7
|
+
|
8
|
+
context '#me' do
|
9
|
+
it 'gets my personal information' do
|
10
|
+
request_data = RequestData.new(Endpoints::USER, Entities::User, client.authorization_header)
|
11
|
+
allow(Request).to receive(:perform_with_object)
|
12
|
+
|
13
|
+
client.me
|
14
|
+
|
15
|
+
expect(Request).to have_received(:perform_with_object).
|
16
|
+
with(:get, request_data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context '#phones' do
|
21
|
+
it 'gets my associated phone numbers' do
|
22
|
+
request_data = RequestData.new(Endpoints::USER_PHONES, Entities::Phone, client.authorization_header)
|
23
|
+
allow(Request).to receive(:perform_with_objects)
|
24
|
+
|
25
|
+
client.phones
|
26
|
+
|
27
|
+
expect(Request).to have_received(:perform_with_objects).
|
28
|
+
with(:get, request_data)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
shared_examples 'perform auth request method' do |method_name|
|
5
|
+
let(:object_class) { double('ObjectClass', new: nil, from_collection: nil) }
|
6
|
+
let(:request) { spy('request') }
|
7
|
+
let(:client) { Bitreserve::Client.new }
|
8
|
+
|
9
|
+
context ".#{method_name}" do
|
10
|
+
it 'makes a call with basic auth' do
|
11
|
+
url = '/some-url'
|
12
|
+
auth = { username: 'user', password: 'pass' }
|
13
|
+
WebMockHelpers.bitreserve_stub_request_with_auth(:get, url, [], auth)
|
14
|
+
allow(AuthRequest).to receive(:get).and_call_original
|
15
|
+
|
16
|
+
AuthRequest.public_send(method_name, :get, request_data(url, client, nil, auth))
|
17
|
+
|
18
|
+
expect(AuthRequest).to have_received(:get).with(url, basic_auth: auth, headers: client.authorization_header)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def request_data(url = anything, client = nil, payload = nil, auth = nil)
|
23
|
+
client ||= double('Client', authorization_header: {})
|
24
|
+
RequestData.new(url, object_class, client.authorization_header, payload, auth)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe AuthRequest do
|
29
|
+
include_examples 'perform auth request method', :perform_with_object
|
30
|
+
include_examples 'perform auth request method', :perform_with_objects
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Bitreserve
|
4
|
+
describe Client do
|
5
|
+
it 'takes a token on initialization' do
|
6
|
+
token = 'x'
|
7
|
+
|
8
|
+
client = Client.new(token: token)
|
9
|
+
|
10
|
+
expect(client.bearer_token).to eq token
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'gets the token from the ENV if none is provided' do
|
14
|
+
token = 'x'
|
15
|
+
|
16
|
+
with_modified_env BITRESERVE_AUTH_TOKEN: token do
|
17
|
+
client = Client.new
|
18
|
+
|
19
|
+
expect(client.bearer_token).to eq token
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|