blockchain-wallet 0.0.4 → 0.0.5
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 +4 -4
- data/lib/blockchain/wallet.rb +2 -2
- data/lib/blockchain/wallet/version.rb +1 -1
- data/spec/BlockChainWalletSpec.rb +25 -7
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af43ea8a7770600a0fbdb8bd7f1c322160f53075
|
|
4
|
+
data.tar.gz: 88db9b96313341adfecc41065d329b0f7883d333
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c3f40320d872d9046ca7abefec2d3a43aaf3e13f03fbb399f72f30e90c6228e75dca7a023a029740c2e8569e6b668a0810fa5d2d52d783d0107336b9f0539aa
|
|
7
|
+
data.tar.gz: 09093e2df21f8e05766ce7a2fa2244466e1e63da9331979ad6eaf33e64c76d2bd497098a9b432e77497d66ea84945b3e148e1dc5781a22ea29af121c69a882c6
|
data/lib/blockchain/wallet.rb
CHANGED
|
@@ -54,7 +54,7 @@ module Blockchain
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def payment(address, amount, from = nil, shared = nil, fee = nil, note = nil)
|
|
57
|
-
url = build_url("payment", {:password => @password, :second_password => @second_password, :to => address, :amount => bitcoins_to_satoshi(amount),
|
|
57
|
+
url = build_url("payment", {:password => @password, :second_password => @second_password, :to => address, :amount => Wallet::bitcoins_to_satoshi(amount),
|
|
58
58
|
:from => from, :shared => shared, :fee => fee, :note => note})
|
|
59
59
|
handle(url) { |answer| answer }
|
|
60
60
|
end
|
|
@@ -75,7 +75,7 @@ module Blockchain
|
|
|
75
75
|
def handle(url)
|
|
76
76
|
answer = execute_request(url)
|
|
77
77
|
check_error(answer)
|
|
78
|
-
answer['balance'] = satoshi_to_bitcoins(answer['balance']) if answer['balance']
|
|
78
|
+
answer['balance'] = Wallet::satoshi_to_bitcoins(answer['balance']) if answer['balance']
|
|
79
79
|
yield ImmutableStruct.new(*answer.keys.map(&:to_sym)).new(*answer.values)
|
|
80
80
|
end
|
|
81
81
|
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
require File.expand_path("../../lib/blockchain/wallet", __FILE__)
|
|
2
2
|
|
|
3
|
-
describe Blockchain, ".addresses" do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
describe Blockchain::Wallet, ".addresses" do
|
|
4
|
+
|
|
5
|
+
before do
|
|
6
|
+
@wallet = Blockchain::Wallet.new("b14d36af-2fa6-4d76-91b5-ff70b8370ec7", "n$grJ74hAshfggnb6864%j78@#^hChttp://ya.ru@contentpurl", nil)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should returns all addresses" do
|
|
10
|
+
addresses=@wallet.addresses
|
|
7
11
|
addresses.should_not be_empty
|
|
8
12
|
end
|
|
13
|
+
|
|
14
|
+
after do
|
|
15
|
+
@account = nil
|
|
16
|
+
end
|
|
17
|
+
|
|
9
18
|
end
|
|
10
19
|
|
|
11
|
-
describe Blockchain, ".address_balance" do
|
|
20
|
+
describe Blockchain::Wallet, ".address_balance" do
|
|
21
|
+
|
|
22
|
+
before do
|
|
23
|
+
@wallet = Blockchain::Wallet.new("b14d36af-2fa6-4d76-91b5-ff70b8370ec7", "n$grJ74hAshfggnb6864%j78@#^hChttp://ya.ru@contentpurl", nil)
|
|
24
|
+
end
|
|
25
|
+
|
|
12
26
|
it "should return '1JX7FrBm4Y96Z8BN6m9fWLN3bWVrEZ7dVs' balance >=0" do
|
|
13
|
-
wallet
|
|
14
|
-
address_balance=wallet.address_balance("1JX7FrBm4Y96Z8BN6m9fWLN3bWVrEZ7dVs")
|
|
27
|
+
address_balance=@wallet.address_balance("1JX7FrBm4Y96Z8BN6m9fWLN3bWVrEZ7dVs")
|
|
15
28
|
address_balance.balance.should >=(0)
|
|
16
29
|
end
|
|
30
|
+
|
|
31
|
+
after do
|
|
32
|
+
@account = nil
|
|
33
|
+
end
|
|
34
|
+
|
|
17
35
|
end
|