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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTAwZTc0MjQyZGNhNDU3NWVjMzVlMGVjZjdjNmYyMjFmMjdhOTJjNQ==
4
+ OGMwMmY5MDYyNDg3ZjY0YzM1MDNiMTgyZDBkOTAyNDg5ODNjYTBmNg==
5
5
  data.tar.gz: !binary |-
6
- OTJjMDBjYzZkYTVjMGE0NzAyNmQ0ZTU3ZjJiNTNlOWM1NGViMDViYQ==
6
+ NzYyMzJjYzI0M2I0NWFkNGY1ZjE4ZjBkZmUwODE1MjhlYTM1ZWQ4NQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjhhOTkxY2QxNWUzZjVmMjVlZGE1YTE0ODE2ODAwN2Y3YzE0OWQwZTQ2M2Qz
10
- ZGM5ZWUxMDE4NGRkNjI5OWYyMmE5ZjFkZjdjNWFiM2M3MGRmMjU0OWNiZTcz
11
- MTEyMjhlZTMzY2U3M2MyZTAwZjY5NzhkMGNhMTFjN2JhMjE2MGQ=
9
+ NjJlMjA2ZDJiZTU3MGU4Y2I1NDFhZWI1YjczYTdmMmRkMGNhNDhlNDFlYzAz
10
+ NmE1MzlhMjdmOTk1ZTYxMTgxMjc0Y2RlYjAyMTIxNDgyMWM2NjA0MjJhNTkx
11
+ ZjQ2OTI0OTZkMzcxMjY2YWQ5YjNhNGE5NDY1OTYwNmY5ZGI2NDY=
12
12
  data.tar.gz: !binary |-
13
- OWUyNDAzNGNkNDc3NDQ0ZjMxMGFhYmE3Y2UyNGY4YjZmMzRiNzNmYTg2N2Jl
14
- OTA2MGJlYzcxOTg4NWE3NDY1OWU1MjkwOTY0Y2E3NzI3NTRkZjllMTQ2N2M3
15
- Mzk2MmNjN2U1OWEyYzIwMDRjYWViOTFiZWYyMzVmYjQ0NTg3NjY=
13
+ MjdhZmE1YzZiMDY1M2M4NGRjOGNhZTcwZWNkM2IyNTVkMTE0ZWUwMDcwNDg4
14
+ ZDU4ZTFlYTNiMjhlY2UyNzQxMjVjMDJjMzYzNDdhOGUzNTM2OGZjZDEzZGQ1
15
+ NGY1ODVkNDMyODFkOTQ2MGEzNzE0MGFjYzJkM2ZjMDNkZjhjOGQ=
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-1.9.3-p286
1
+ ruby-2.1.1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.7.0
2
+
3
+ - `min_conf` is configurable directly via `BitWallet.min_conf` instead of `BitWallet.config.min_conf`
4
+
1
5
  # v0.6.1
2
6
 
3
7
  - Fix warning where Wallet#client was being accessed but it was private
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 and :host
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`
@@ -14,7 +14,7 @@ module BitWallet
14
14
  @addresses ||= Addresses.new(self)
15
15
  end
16
16
 
17
- def balance(min_conf=BitWallet.config.min_conf)
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.config.min_conf)
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.config.min_conf)
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.config.min_conf)
60
+ BitWallet.min_conf)
61
61
  txid
62
62
  rescue => e
63
63
  parse_error e.message
@@ -15,7 +15,7 @@ module BitWallet
15
15
  end
16
16
 
17
17
  def total_received
18
- client.getreceivedbyaddress(self.address, BitWallet.config.min_conf)
18
+ client.getreceivedbyaddress(self.address, BitWallet.min_conf)
19
19
  end
20
20
 
21
21
  def ==(other_address)
@@ -1,3 +1,3 @@
1
1
  module BitWallet
2
- VERSION = '0.6.1'
2
+ VERSION = '0.7.0'
3
3
  end
@@ -19,7 +19,7 @@ module BitWallet
19
19
  def move(from_account,
20
20
  to_account,
21
21
  amount,
22
- min_conf=BitWallet.config.min_conf,
22
+ min_conf=BitWallet.min_conf,
23
23
  comment=nil)
24
24
 
25
25
  from_account_str = if from_account.respond_to?(:name)
data/lib/bit_wallet.rb CHANGED
@@ -19,8 +19,11 @@ require 'bit_wallet/handles_error'
19
19
 
20
20
  module BitWallet
21
21
 
22
- mattr_accessor :config
23
- @@config = OpenStruct.new
22
+ mattr_writer :min_conf
23
+
24
+ def self.min_conf
25
+ @@min_conf || 0
26
+ end
24
27
 
25
28
  def self.at(*args)
26
29
  Wallet.new(*args)
@@ -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.config.min_conf)
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.config.min_conf = 2
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.config.min_conf).
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
- account_2_address => 2.323)
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.config.min_conf).
31
+ with(subject.address, BitWallet.min_conf).
32
32
  and_return(2.1)
33
33
  subject.total_received.should == 2.1
34
34
  end
@@ -2,10 +2,17 @@ require 'spec_helper'
2
2
 
3
3
  describe BitWallet do
4
4
 
5
- describe '.config' do
6
- it 'should be a configurable object' do
7
- described_class.config.min_conf = 22
8
- described_class.config.min_conf.should == 22
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
@@ -33,7 +33,7 @@ RSpec.configure do |config|
33
33
  config.include FactoryGirl::Syntax::Methods
34
34
 
35
35
  config.before(:each) do
36
- BitWallet.config.min_conf = 0
36
+ BitWallet.min_conf = 0
37
37
  end
38
38
 
39
39
  config.order = "random"
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.6.1
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-04 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitcoin-client