bit_wallet 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +5 -1
- data/lib/bit_wallet/account.rb +4 -4
- data/lib/bit_wallet/address.rb +1 -1
- data/lib/bit_wallet/version.rb +1 -1
- data/lib/bit_wallet/wallet.rb +1 -1
- data/lib/bit_wallet.rb +5 -2
- data/spec/bit_wallet/account_spec.rb +6 -5
- data/spec/bit_wallet/address_spec.rb +1 -1
- data/spec/bit_wallet_spec.rb +11 -4
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGMwMmY5MDYyNDg3ZjY0YzM1MDNiMTgyZDBkOTAyNDg5ODNjYTBmNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzYyMzJjYzI0M2I0NWFkNGY1ZjE4ZjBkZmUwODE1MjhlYTM1ZWQ4NQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjJlMjA2ZDJiZTU3MGU4Y2I1NDFhZWI1YjczYTdmMmRkMGNhNDhlNDFlYzAz
|
10
|
+
NmE1MzlhMjdmOTk1ZTYxMTgxMjc0Y2RlYjAyMTIxNDgyMWM2NjA0MjJhNTkx
|
11
|
+
ZjQ2OTI0OTZkMzcxMjY2YWQ5YjNhNGE5NDY1OTYwNmY5ZGI2NDY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjdhZmE1YzZiMDY1M2M4NGRjOGNhZTcwZWNkM2IyNTVkMTE0ZWUwMDcwNDg4
|
14
|
+
ZDU4ZTFlYTNiMjhlY2UyNzQxMjVjMDJjMzYzNDdhOGUzNTM2OGZjZDEzZGQ1
|
15
|
+
NGY1ODVkNDMyODFkOTQ2MGEzNzE0MGFjYzJkM2ZjMDNkZjhjOGQ=
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-1.
|
1
|
+
ruby-2.1.1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Or install it yourself as:
|
|
19
19
|
## Usage
|
20
20
|
|
21
21
|
wallet = BitWallet.new(:username => 'username', :password => 'password')
|
22
|
-
# You can also pass :port
|
22
|
+
# You can also pass :port, :host, :ssl (Boolean)
|
23
23
|
|
24
24
|
wallet.accounts.with_balance # returns array of the accounts with balance > 0
|
25
25
|
account = wallet.accounts.new('account name')
|
@@ -56,8 +56,12 @@ A transaction has the following methods:
|
|
56
56
|
|
57
57
|
## Contributing
|
58
58
|
|
59
|
+
I suggest you do your development in this [Vagrant box](https://github.com/ramontayag/ruby-bitcoin-box). I use it for my development.
|
60
|
+
|
59
61
|
1. Fork it
|
60
62
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
63
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
62
64
|
4. Push to the branch (`git push origin my-new-feature`)
|
63
65
|
5. Create new Pull Request
|
66
|
+
|
67
|
+
If you find this useful, consider sharing some BTC love: `1PwQWijmJ39hWXk9X3CdAhEdExdkANEAPk`
|
data/lib/bit_wallet/account.rb
CHANGED
@@ -14,7 +14,7 @@ module BitWallet
|
|
14
14
|
@addresses ||= Addresses.new(self)
|
15
15
|
end
|
16
16
|
|
17
|
-
def balance(min_conf=BitWallet.
|
17
|
+
def balance(min_conf=BitWallet.min_conf)
|
18
18
|
client.getbalance(self.name, min_conf)
|
19
19
|
end
|
20
20
|
|
@@ -28,13 +28,13 @@ module BitWallet
|
|
28
28
|
client.sendfrom(self.name,
|
29
29
|
options[:to],
|
30
30
|
amount,
|
31
|
-
BitWallet.
|
31
|
+
BitWallet.min_conf)
|
32
32
|
rescue Bitcoin::Errors::RPCError => e
|
33
33
|
parse_error e.message
|
34
34
|
end
|
35
35
|
|
36
36
|
def total_received
|
37
|
-
client.getreceivedbyaccount(self.name, BitWallet.
|
37
|
+
client.getreceivedbyaccount(self.name, BitWallet.min_conf)
|
38
38
|
end
|
39
39
|
|
40
40
|
def ==(other_account)
|
@@ -57,7 +57,7 @@ module BitWallet
|
|
57
57
|
|
58
58
|
txid = client.send_many(self.name,
|
59
59
|
addresses_values,
|
60
|
-
BitWallet.
|
60
|
+
BitWallet.min_conf)
|
61
61
|
txid
|
62
62
|
rescue => e
|
63
63
|
parse_error e.message
|
data/lib/bit_wallet/address.rb
CHANGED
data/lib/bit_wallet/version.rb
CHANGED
data/lib/bit_wallet/wallet.rb
CHANGED
data/lib/bit_wallet.rb
CHANGED
@@ -42,11 +42,11 @@ describe BitWallet::Account, vcr: true do
|
|
42
42
|
|
43
43
|
it 'should return the balance of the account' do
|
44
44
|
subject.balance.should ==
|
45
|
-
subject.client.getbalance(subject.name, BitWallet.
|
45
|
+
subject.client.getbalance(subject.name, BitWallet.min_conf)
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should default to the config min_conf' do
|
49
|
-
BitWallet.
|
49
|
+
BitWallet.min_conf = 2
|
50
50
|
subject.client.should_receive(:getbalance).with(subject.name, 2)
|
51
51
|
subject.balance(2)
|
52
52
|
end
|
@@ -95,7 +95,7 @@ describe BitWallet::Account, vcr: true do
|
|
95
95
|
describe '#total_received' do
|
96
96
|
it 'should return the total amount received by the address' do
|
97
97
|
subject.client.stub(:getreceivedbyaccount).
|
98
|
-
with(subject.name, BitWallet.
|
98
|
+
with(subject.name, BitWallet.min_conf).
|
99
99
|
and_return(2.1)
|
100
100
|
subject.total_received.should == 2.1
|
101
101
|
end
|
@@ -138,9 +138,10 @@ describe BitWallet::Account, vcr: true do
|
|
138
138
|
account_2 = wallet.accounts.new('account_2')
|
139
139
|
account_2_address = account_2.addresses.first
|
140
140
|
|
141
|
-
default_account.send_many(account_1_address_str => 0.4,
|
142
|
-
|
141
|
+
tx_id = default_account.send_many(account_1_address_str => 0.4,
|
142
|
+
account_2_address => 2.323)
|
143
143
|
|
144
|
+
expect(tx_id).to be_a(String)
|
144
145
|
account_1.balance.should == 0.4
|
145
146
|
account_2.balance.should == 2.323
|
146
147
|
end
|
@@ -28,7 +28,7 @@ describe BitWallet::Address, vcr: true do
|
|
28
28
|
describe '#total_received' do
|
29
29
|
it 'should return the total amount received by the address' do
|
30
30
|
subject.client.stub(:getreceivedbyaddress).
|
31
|
-
with(subject.address, BitWallet.
|
31
|
+
with(subject.address, BitWallet.min_conf).
|
32
32
|
and_return(2.1)
|
33
33
|
subject.total_received.should == 2.1
|
34
34
|
end
|
data/spec/bit_wallet_spec.rb
CHANGED
@@ -2,10 +2,17 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe BitWallet do
|
4
4
|
|
5
|
-
describe
|
6
|
-
it
|
7
|
-
described_class.
|
8
|
-
described_class.
|
5
|
+
describe "#min_conf" do
|
6
|
+
it "can be set" do
|
7
|
+
described_class.min_conf = 2
|
8
|
+
expect(described_class.min_conf).to eq 2
|
9
|
+
end
|
10
|
+
|
11
|
+
context "it is nil" do
|
12
|
+
it "is 0" do
|
13
|
+
described_class.min_conf = nil
|
14
|
+
expect(described_class.min_conf).to eq 0
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
11
18
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bit_wallet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ramon Tayag
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitcoin-client
|