sibit 0.19.2 → 0.19.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db71c5de986c5aeacfb60ddde907c84eade4b53e2b764f513cd6ea20c7a95c45
4
- data.tar.gz: c79bc1c5b9c544bcc16a61fff3912f09dd5b05152d5cbf667b418d5207d37575
3
+ metadata.gz: 1954a732f204708506dbbba992e87c8e1e49f111cbfb822d493214e031b06ee2
4
+ data.tar.gz: 6cd88b88f880045ce63597644280d6d27df2ee0249189c13abdbcdda8ed00203
5
5
  SHA512:
6
- metadata.gz: 951c554ef902b64007c6807976c99f44f909a28730bff366135d5fb2728cae935df206fd065f9500d4f885982c10175c9775ba3001bb37de42ad2f2969dd45ee
7
- data.tar.gz: b60396b85498717187962637e00008b394eddcb030cdfb5839b3d043bfc086974f05f638057940f621ab1d7d60016857ed19d7bb0354325adcd3e5ebc964f3da
6
+ metadata.gz: 6d301e854ae0915e62bd6d9903f7ed2e5ef37b6e68f1a7b94d813ca9c5d4c0f0f8a590019a3cdc8f15b7aeb6ffa9eeb391e5da17af8e1518be22bf2c3cdde68a
7
+ data.tar.gz: 9772fc2ec4c8f445bad36b6c7403ed97dff4a050b79609bf8cefc083c69358b319e4cc5a6c8020e51aae739177fa931b3a83e14d3ae0b3ebec75d3037c7c3b3f
@@ -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"
@@ -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
- txns = json['data']['list']
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
@@ -26,5 +26,5 @@
26
26
  # License:: MIT
27
27
  class Sibit
28
28
  # Current version of the library.
29
- VERSION = '0.19.2'
29
+ VERSION = '0.19.3'
30
30
  end
@@ -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.2
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-08 00:00:00.000000000 Z
11
+ date: 2020-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace