bit_wallet 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/bit_wallet/accounts.rb +4 -20
- data/lib/bit_wallet/version.rb +1 -1
- data/spec/bit_wallet/account_spec.rb +2 -3
- data/spec/bit_wallet/accounts_spec.rb +1 -8
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_balance/should_be_able_to_override_the_min_conf.yml +3 -79
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_balance/should_default_to_the_config_min_conf.yml +3 -79
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_balance/should_return_the_balance_of_the_account.yml +7 -83
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_recent_transactions/should_default_to_list_10_transactions.yml +53 -91
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_recent_transactions/when_transaction_limit_is_6/should_list_the_6_most_recent_transactions.yml +41 -79
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_send_amount/_to_is_a_BitWallet_Address/should_send_it_to_the_address_of_the_given_BitWallet_Address.yml +14 -52
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_send_amount/account_does_not_have_enough_money/should_fail_with_the_InsufficientFunds_error.yml +11 -49
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_send_amount/should_send_money_to_the_given_address.yml +14 -52
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_send_many/should_send_the_amounts_of_money_to_the_specified_accounts.yml +17 -55
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/_total_received/should_return_the_total_amount_received_by_the_address.yml +3 -3
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/addresses/.yml +3 -3
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/on_initialization/should_be_assigned_that_name.yml +3 -79
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/on_initialization/should_have_a_default_name.yml +3 -3
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/on_initialization/when_the_account_name_already_exists/should_return_that_same_address.yml +3 -79
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/wallet/.yml +3 -3
- data/spec/fixtures/vcr_cassettes/BitWallet_Accounts/_new/should_create_a_new_BitWallet_Account_with_a_default_address.yml +3 -79
- data/spec/fixtures/vcr_cassettes/BitWallet_Accounts/_with_balance/should_return_accounts_with_a_balance_0.yml +23 -61
- data/spec/fixtures/vcr_cassettes/BitWallet_Wallet/_move/should_move_funds_from_one_account_to_another.yml +12 -50
- data/spec/fixtures/vcr_cassettes/BitWallet_Wallet/_recent_transactions/should_allow_overriding_of_the_transaction_limit.yml +53 -91
- data/spec/fixtures/vcr_cassettes/BitWallet_Wallet/_recent_transactions/should_return_the_most_recent_transactions_of_all_accounts_defaulting_to_10_transactions.yml +53 -91
- metadata +2 -10
- data/spec/fixtures/vcr_cassettes/BitWallet_Account/on_initialization/name_is_nil/raises_an_error.yml +0 -79
- data/spec/fixtures/vcr_cassettes/BitWallet_Accounts/_includes_account_name_account_/should_return_true_if_the_array_includes_the_account.yml +0 -117
- data/spec/fixtures/vcr_cassettes/BitWallet_Accounts/wallet/.yml +0 -79
- data/spec/fixtures/vcr_cassettes/BitWallet_Wallet/_accounts/should_return_array_of_BitWallet_Accounts.yml +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fce5a76715e28fb69f0391e3a763a2db3c2c1e48
|
4
|
+
data.tar.gz: 26a75f592cecd3e15341b33477058d3508c79d6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3517c5fa85d12f6b5715f05455a7effc6c31f2bbb0138295a1650f96d5fedc1dcde0a6940f51bd525066ec5ecff78651bcb181c666f6c6bd57baa439902d3014
|
7
|
+
data.tar.gz: a290f020b07faf475546d10e036eeb983c039202b3cea87f9681e437563752b50d12fdc43cad35c4c9c44de7cdecfa436b2e40358be7cb6d5d429c14e84e92dd
|
data/CHANGELOG.md
CHANGED
data/lib/bit_wallet/accounts.rb
CHANGED
@@ -10,31 +10,15 @@ module BitWallet
|
|
10
10
|
|
11
11
|
def initialize(wallet)
|
12
12
|
@wallet = wallet
|
13
|
-
|
14
|
-
existing_accounts.each do |name|
|
15
|
-
self.new(name)
|
16
|
-
end
|
17
13
|
end
|
18
14
|
|
19
15
|
def new(name)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
self << account
|
25
|
-
end
|
16
|
+
account = self.find {|a| a.name == name}
|
17
|
+
return account if account
|
18
|
+
account = BitWallet::Account.new(wallet, name)
|
19
|
+
self << account
|
26
20
|
account
|
27
21
|
end
|
28
22
|
|
29
|
-
def includes_account_name?(account_name)
|
30
|
-
self.find {|a| a.name == account_name}.present?
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def existing_accounts
|
36
|
-
client.listaccounts.keys
|
37
|
-
end
|
38
|
-
|
39
23
|
end
|
40
24
|
end
|
data/lib/bit_wallet/version.rb
CHANGED
@@ -19,8 +19,7 @@ describe BitWallet::Account, vcr: {record: :once}, bitcoin_cleaner: true do
|
|
19
19
|
:port,
|
20
20
|
:password))
|
21
21
|
account = wallet.accounts.new('nona')
|
22
|
-
|
23
|
-
wallet.accounts.includes_account_name?('nona').should be_true
|
22
|
+
expect(account.name).to eq "nona"
|
24
23
|
end
|
25
24
|
|
26
25
|
context 'when the account name already exists' do
|
@@ -28,7 +27,7 @@ describe BitWallet::Account, vcr: {record: :once}, bitcoin_cleaner: true do
|
|
28
27
|
wallet = BitWallet::Wallet.new(Config.slice(:username,
|
29
28
|
:port,
|
30
29
|
:password))
|
31
|
-
|
30
|
+
wallet.accounts.new('nona')
|
32
31
|
|
33
32
|
expect {
|
34
33
|
wallet.accounts.new('nona')
|
@@ -21,20 +21,13 @@ module BitWallet
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
describe '#includes_account_name?(account)' do
|
25
|
-
it 'should return true if the array includes the account' do
|
26
|
-
account = subject.new('accountname')
|
27
|
-
subject.includes_account_name?('accountname').should == true
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
24
|
describe '.with_balance' do
|
32
25
|
it 'should return accounts with a balance > 0' do
|
33
26
|
default_account = subject.new('')
|
34
27
|
account_1 = subject.new('nomoney')
|
35
28
|
account_2 = subject.new('moneyd')
|
36
29
|
|
37
|
-
default_account.send_amount
|
30
|
+
default_account.send_amount 5, to: account_2.addresses.first
|
38
31
|
|
39
32
|
accounts_with_balance = subject.with_balance
|
40
33
|
accounts_with_balance.should include(default_account)
|
@@ -1,81 +1,5 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"method":"listaccounts","params":[1],"id":"jsonrpc"}'
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- "*/*; q=0.5, application/xml"
|
12
|
-
Accept-Encoding:
|
13
|
-
- gzip, deflate
|
14
|
-
Content-Type:
|
15
|
-
- application/json
|
16
|
-
Content-Length:
|
17
|
-
- '53'
|
18
|
-
User-Agent:
|
19
|
-
- Ruby
|
20
|
-
response:
|
21
|
-
status:
|
22
|
-
code: 200
|
23
|
-
message: OK
|
24
|
-
headers:
|
25
|
-
Date:
|
26
|
-
- Sat, 23 Aug 2014 09:44:35 +0000
|
27
|
-
Connection:
|
28
|
-
- keep-alive
|
29
|
-
Content-Length:
|
30
|
-
- '56'
|
31
|
-
Content-Type:
|
32
|
-
- application/json
|
33
|
-
Server:
|
34
|
-
- bitcoin-json-rpc/v0.9.2.1-g354c0f3-beta
|
35
|
-
body:
|
36
|
-
encoding: UTF-8
|
37
|
-
string: |
|
38
|
-
{"result":{"":50.00000000},"error":null,"id":"jsonrpc"}
|
39
|
-
http_version:
|
40
|
-
recorded_at: Sat, 23 Aug 2014 09:44:35 GMT
|
41
|
-
- request:
|
42
|
-
method: post
|
43
|
-
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
44
|
-
body:
|
45
|
-
encoding: UTF-8
|
46
|
-
string: '{"method":"getnewaddress","params":[""],"id":"jsonrpc"}'
|
47
|
-
headers:
|
48
|
-
Accept:
|
49
|
-
- "*/*; q=0.5, application/xml"
|
50
|
-
Accept-Encoding:
|
51
|
-
- gzip, deflate
|
52
|
-
Content-Type:
|
53
|
-
- application/json
|
54
|
-
Content-Length:
|
55
|
-
- '55'
|
56
|
-
User-Agent:
|
57
|
-
- Ruby
|
58
|
-
response:
|
59
|
-
status:
|
60
|
-
code: 200
|
61
|
-
message: OK
|
62
|
-
headers:
|
63
|
-
Date:
|
64
|
-
- Sat, 23 Aug 2014 09:44:35 +0000
|
65
|
-
Connection:
|
66
|
-
- keep-alive
|
67
|
-
Content-Length:
|
68
|
-
- '76'
|
69
|
-
Content-Type:
|
70
|
-
- application/json
|
71
|
-
Server:
|
72
|
-
- bitcoin-json-rpc/v0.9.2.1-g354c0f3-beta
|
73
|
-
body:
|
74
|
-
encoding: UTF-8
|
75
|
-
string: |
|
76
|
-
{"result":"n1V9qhf9PbNXF2NE2iFkKiHFv3owW3trkb","error":null,"id":"jsonrpc"}
|
77
|
-
http_version:
|
78
|
-
recorded_at: Sat, 23 Aug 2014 09:44:35 GMT
|
79
3
|
- request:
|
80
4
|
method: post
|
81
5
|
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
@@ -99,7 +23,7 @@ http_interactions:
|
|
99
23
|
message: OK
|
100
24
|
headers:
|
101
25
|
Date:
|
102
|
-
-
|
26
|
+
- Sun, 24 Aug 2014 06:47:18 +0000
|
103
27
|
Connection:
|
104
28
|
- keep-alive
|
105
29
|
Content-Length:
|
@@ -111,7 +35,7 @@ http_interactions:
|
|
111
35
|
body:
|
112
36
|
encoding: UTF-8
|
113
37
|
string: |
|
114
|
-
{"result":"
|
38
|
+
{"result":"mgajLc8bC4TMsqEiRS2irxbMW29EWMcq43","error":null,"id":"jsonrpc"}
|
115
39
|
http_version:
|
116
|
-
recorded_at:
|
40
|
+
recorded_at: Sun, 24 Aug 2014 06:47:18 GMT
|
117
41
|
recorded_with: VCR 2.8.0
|
@@ -1,81 +1,5 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"method":"listaccounts","params":[1],"id":"jsonrpc"}'
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- "*/*; q=0.5, application/xml"
|
12
|
-
Accept-Encoding:
|
13
|
-
- gzip, deflate
|
14
|
-
Content-Type:
|
15
|
-
- application/json
|
16
|
-
Content-Length:
|
17
|
-
- '53'
|
18
|
-
User-Agent:
|
19
|
-
- Ruby
|
20
|
-
response:
|
21
|
-
status:
|
22
|
-
code: 200
|
23
|
-
message: OK
|
24
|
-
headers:
|
25
|
-
Date:
|
26
|
-
- Sat, 23 Aug 2014 09:44:28 +0000
|
27
|
-
Connection:
|
28
|
-
- keep-alive
|
29
|
-
Content-Length:
|
30
|
-
- '56'
|
31
|
-
Content-Type:
|
32
|
-
- application/json
|
33
|
-
Server:
|
34
|
-
- bitcoin-json-rpc/v0.9.2.1-g354c0f3-beta
|
35
|
-
body:
|
36
|
-
encoding: UTF-8
|
37
|
-
string: |
|
38
|
-
{"result":{"":50.00000000},"error":null,"id":"jsonrpc"}
|
39
|
-
http_version:
|
40
|
-
recorded_at: Sat, 23 Aug 2014 09:44:28 GMT
|
41
|
-
- request:
|
42
|
-
method: post
|
43
|
-
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
44
|
-
body:
|
45
|
-
encoding: UTF-8
|
46
|
-
string: '{"method":"getnewaddress","params":[""],"id":"jsonrpc"}'
|
47
|
-
headers:
|
48
|
-
Accept:
|
49
|
-
- "*/*; q=0.5, application/xml"
|
50
|
-
Accept-Encoding:
|
51
|
-
- gzip, deflate
|
52
|
-
Content-Type:
|
53
|
-
- application/json
|
54
|
-
Content-Length:
|
55
|
-
- '55'
|
56
|
-
User-Agent:
|
57
|
-
- Ruby
|
58
|
-
response:
|
59
|
-
status:
|
60
|
-
code: 200
|
61
|
-
message: OK
|
62
|
-
headers:
|
63
|
-
Date:
|
64
|
-
- Sat, 23 Aug 2014 09:44:28 +0000
|
65
|
-
Connection:
|
66
|
-
- keep-alive
|
67
|
-
Content-Length:
|
68
|
-
- '76'
|
69
|
-
Content-Type:
|
70
|
-
- application/json
|
71
|
-
Server:
|
72
|
-
- bitcoin-json-rpc/v0.9.2.1-g354c0f3-beta
|
73
|
-
body:
|
74
|
-
encoding: UTF-8
|
75
|
-
string: |
|
76
|
-
{"result":"mh8e67FEbWhyf13TbvSuvzrGjrWBWChqsp","error":null,"id":"jsonrpc"}
|
77
|
-
http_version:
|
78
|
-
recorded_at: Sat, 23 Aug 2014 09:44:28 GMT
|
79
3
|
- request:
|
80
4
|
method: post
|
81
5
|
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
@@ -99,7 +23,7 @@ http_interactions:
|
|
99
23
|
message: OK
|
100
24
|
headers:
|
101
25
|
Date:
|
102
|
-
-
|
26
|
+
- Sun, 24 Aug 2014 06:47:10 +0000
|
103
27
|
Connection:
|
104
28
|
- keep-alive
|
105
29
|
Content-Length:
|
@@ -111,7 +35,7 @@ http_interactions:
|
|
111
35
|
body:
|
112
36
|
encoding: UTF-8
|
113
37
|
string: |
|
114
|
-
{"result":"
|
38
|
+
{"result":"mrQVZdWQWUGEPJVdubb1YBwopRHmwrxQVh","error":null,"id":"jsonrpc"}
|
115
39
|
http_version:
|
116
|
-
recorded_at:
|
40
|
+
recorded_at: Sun, 24 Aug 2014 06:47:10 GMT
|
117
41
|
recorded_with: VCR 2.8.0
|
@@ -1,81 +1,5 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"method":"listaccounts","params":[1],"id":"jsonrpc"}'
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- "*/*; q=0.5, application/xml"
|
12
|
-
Accept-Encoding:
|
13
|
-
- gzip, deflate
|
14
|
-
Content-Type:
|
15
|
-
- application/json
|
16
|
-
Content-Length:
|
17
|
-
- '53'
|
18
|
-
User-Agent:
|
19
|
-
- Ruby
|
20
|
-
response:
|
21
|
-
status:
|
22
|
-
code: 200
|
23
|
-
message: OK
|
24
|
-
headers:
|
25
|
-
Date:
|
26
|
-
- Sat, 23 Aug 2014 09:44:42 +0000
|
27
|
-
Connection:
|
28
|
-
- keep-alive
|
29
|
-
Content-Length:
|
30
|
-
- '56'
|
31
|
-
Content-Type:
|
32
|
-
- application/json
|
33
|
-
Server:
|
34
|
-
- bitcoin-json-rpc/v0.9.2.1-g354c0f3-beta
|
35
|
-
body:
|
36
|
-
encoding: UTF-8
|
37
|
-
string: |
|
38
|
-
{"result":{"":50.00000000},"error":null,"id":"jsonrpc"}
|
39
|
-
http_version:
|
40
|
-
recorded_at: Sat, 23 Aug 2014 09:44:42 GMT
|
41
|
-
- request:
|
42
|
-
method: post
|
43
|
-
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
44
|
-
body:
|
45
|
-
encoding: UTF-8
|
46
|
-
string: '{"method":"getnewaddress","params":[""],"id":"jsonrpc"}'
|
47
|
-
headers:
|
48
|
-
Accept:
|
49
|
-
- "*/*; q=0.5, application/xml"
|
50
|
-
Accept-Encoding:
|
51
|
-
- gzip, deflate
|
52
|
-
Content-Type:
|
53
|
-
- application/json
|
54
|
-
Content-Length:
|
55
|
-
- '55'
|
56
|
-
User-Agent:
|
57
|
-
- Ruby
|
58
|
-
response:
|
59
|
-
status:
|
60
|
-
code: 200
|
61
|
-
message: OK
|
62
|
-
headers:
|
63
|
-
Date:
|
64
|
-
- Sat, 23 Aug 2014 09:44:42 +0000
|
65
|
-
Connection:
|
66
|
-
- keep-alive
|
67
|
-
Content-Length:
|
68
|
-
- '76'
|
69
|
-
Content-Type:
|
70
|
-
- application/json
|
71
|
-
Server:
|
72
|
-
- bitcoin-json-rpc/v0.9.2.1-g354c0f3-beta
|
73
|
-
body:
|
74
|
-
encoding: UTF-8
|
75
|
-
string: |
|
76
|
-
{"result":"mgZ6eXazQ367vVfuvHSgi8VQD8YK8wQPBg","error":null,"id":"jsonrpc"}
|
77
|
-
http_version:
|
78
|
-
recorded_at: Sat, 23 Aug 2014 09:44:42 GMT
|
79
3
|
- request:
|
80
4
|
method: post
|
81
5
|
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
@@ -99,7 +23,7 @@ http_interactions:
|
|
99
23
|
message: OK
|
100
24
|
headers:
|
101
25
|
Date:
|
102
|
-
-
|
26
|
+
- Sun, 24 Aug 2014 06:47:03 +0000
|
103
27
|
Connection:
|
104
28
|
- keep-alive
|
105
29
|
Content-Length:
|
@@ -111,9 +35,9 @@ http_interactions:
|
|
111
35
|
body:
|
112
36
|
encoding: UTF-8
|
113
37
|
string: |
|
114
|
-
{"result":"
|
38
|
+
{"result":"n2pYkqqAr6jYPqahnVjLMezeWPGvAddAB3","error":null,"id":"jsonrpc"}
|
115
39
|
http_version:
|
116
|
-
recorded_at:
|
40
|
+
recorded_at: Sun, 24 Aug 2014 06:47:03 GMT
|
117
41
|
- request:
|
118
42
|
method: post
|
119
43
|
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
@@ -137,7 +61,7 @@ http_interactions:
|
|
137
61
|
message: OK
|
138
62
|
headers:
|
139
63
|
Date:
|
140
|
-
-
|
64
|
+
- Sun, 24 Aug 2014 06:47:03 +0000
|
141
65
|
Connection:
|
142
66
|
- keep-alive
|
143
67
|
Content-Length:
|
@@ -151,7 +75,7 @@ http_interactions:
|
|
151
75
|
string: |
|
152
76
|
{"result":0.00000000,"error":null,"id":"jsonrpc"}
|
153
77
|
http_version:
|
154
|
-
recorded_at:
|
78
|
+
recorded_at: Sun, 24 Aug 2014 06:47:03 GMT
|
155
79
|
- request:
|
156
80
|
method: post
|
157
81
|
uri: http://bitcoinrpc:thisisjustapasswordfortesting@localhost:19001/
|
@@ -175,7 +99,7 @@ http_interactions:
|
|
175
99
|
message: OK
|
176
100
|
headers:
|
177
101
|
Date:
|
178
|
-
-
|
102
|
+
- Sun, 24 Aug 2014 06:47:03 +0000
|
179
103
|
Connection:
|
180
104
|
- keep-alive
|
181
105
|
Content-Length:
|
@@ -189,5 +113,5 @@ http_interactions:
|
|
189
113
|
string: |
|
190
114
|
{"result":0.00000000,"error":null,"id":"jsonrpc"}
|
191
115
|
http_version:
|
192
|
-
recorded_at:
|
116
|
+
recorded_at: Sun, 24 Aug 2014 06:47:03 GMT
|
193
117
|
recorded_with: VCR 2.8.0
|