sibit 0.19.2 → 0.19.3
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/.rultor.yml +2 -2
- data/lib/sibit/btc.rb +6 -1
- data/lib/sibit/version.rb +1 -1
- data/test/test_btc.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1954a732f204708506dbbba992e87c8e1e49f111cbfb822d493214e031b06ee2
|
|
4
|
+
data.tar.gz: 6cd88b88f880045ce63597644280d6d27df2ee0249189c13abdbcdda8ed00203
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d301e854ae0915e62bd6d9903f7ed2e5ef37b6e68f1a7b94d813ca9c5d4c0f0f8a590019a3cdc8f15b7aeb6ffa9eeb391e5da17af8e1518be22bf2c3cdde68a
|
|
7
|
+
data.tar.gz: 9772fc2ec4c8f445bad36b6c7403ed97dff4a050b79609bf8cefc083c69358b319e4cc5a6c8020e51aae739177fa931b3a83e14d3ae0b3ebec75d3037c7c3b3f
|
data/.rultor.yml
CHANGED
|
@@ -5,7 +5,7 @@ install: |
|
|
|
5
5
|
sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
|
|
6
6
|
release:
|
|
7
7
|
script: |-
|
|
8
|
-
bundle exec rake
|
|
8
|
+
bundle exec rake clean test rubocop copyright
|
|
9
9
|
sed -i "s/1\.0\.snapshot/${tag}/g" lib/sibit/version.rb
|
|
10
10
|
git add lib/sibit/version.rb
|
|
11
11
|
git commit -m "version set to ${tag}"
|
|
@@ -14,7 +14,7 @@ release:
|
|
|
14
14
|
gem push *.gem --config-file ../rubygems.yml
|
|
15
15
|
merge:
|
|
16
16
|
script: |-
|
|
17
|
-
bundle exec rake
|
|
17
|
+
bundle exec rake clean test rubocop copyright
|
|
18
18
|
deploy:
|
|
19
19
|
script: |-
|
|
20
20
|
echo "There is nothing to deploy"
|
data/lib/sibit/btc.rb
CHANGED
|
@@ -58,7 +58,12 @@ class Sibit
|
|
|
58
58
|
@log.info("The balance of #{address} is zero (not found)")
|
|
59
59
|
return 0
|
|
60
60
|
end
|
|
61
|
-
|
|
61
|
+
data = json['data']
|
|
62
|
+
if data.nil?
|
|
63
|
+
@log.info("The balance of #{address} is probably zero (not found)")
|
|
64
|
+
return 0
|
|
65
|
+
end
|
|
66
|
+
txns = data['list']
|
|
62
67
|
balance = txns.map { |tx| tx['value'] }.inject(&:+) || 0
|
|
63
68
|
@log.info("The balance of #{address} is #{balance}, total txns: #{txns.count}")
|
|
64
69
|
balance
|
data/lib/sibit/version.rb
CHANGED
data/test/test_btc.rb
CHANGED
|
@@ -42,6 +42,17 @@ class TestBtc < Minitest::Test
|
|
|
42
42
|
assert_equal(0, balance)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
def test_get_broken_balance
|
|
46
|
+
stub_request(
|
|
47
|
+
:get,
|
|
48
|
+
'https://chain.api.btc.com/v3/address/1MZT1fa6y8H9UmbZV6HqKF4UY41o9MGT5f/unspent'
|
|
49
|
+
).to_return(body: '{}')
|
|
50
|
+
sibit = Sibit::Btc.new
|
|
51
|
+
balance = sibit.balance('1MZT1fa6y8H9UmbZV6HqKF4UY41o9MGT5f')
|
|
52
|
+
assert(balance.is_a?(Integer))
|
|
53
|
+
assert_equal(0, balance)
|
|
54
|
+
end
|
|
55
|
+
|
|
45
56
|
def test_get_empty_balance
|
|
46
57
|
stub_request(
|
|
47
58
|
:get,
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sibit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.19.
|
|
4
|
+
version: 0.19.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-07-
|
|
11
|
+
date: 2020-07-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: backtrace
|