sibit 0.20.1 → 0.20.2

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: 3b0578e225f53b1d3904fae19aa6f41ba7aea719bd137587821b3e2fba2a0373
4
- data.tar.gz: 82178b4a20da5d18d99101649c31ad8fd3188c88a4ea74577cf2413d1bf6f9e2
3
+ metadata.gz: 0734db295c639e548f4b51d170e87bbabe2c6b94d7d4ba7e858716b74f145185
4
+ data.tar.gz: 9ff51aecc8e78f13917907f62e6485800531dd7d36198df80b5a089831fcbfcc
5
5
  SHA512:
6
- metadata.gz: 756a8a1273e053f4a880220f8d33db38544e36f4a0d38118ee72cc1421d21311900859b9fbac5732c24260a9c48d7599f0865970db27e7046543ad52b2ceb223
7
- data.tar.gz: 64650acdb47d4671028075dd84e1d3f7f5c8eefb9c67e5b45212e5d6c5aaec1e1576419a126808b20a4e11fc6dc2bd16ea5f473accbb0d1dac936c2896308ecc
6
+ metadata.gz: '0095805aee3fbe209a73bcda6a9832e9aa26b43414232c6fa59d6fbed09a7648bcd6739e76a558106f86a152a9ebbf5b36c32afffd927f9a2f5feaa34fa4c4d4'
7
+ data.tar.gz: 0fde0492c34a1f636180f01d0a331da019e8b461b0819909869cd9f0b5b3f6fb9070f1d79fa6a80f87f3f8903975abeeb7a6e30e9b9b8a4fa5de7f8fbf522794
data/bin/sibit CHANGED
@@ -29,9 +29,12 @@ require 'retriable_proxy'
29
29
  require_relative '../lib/sibit'
30
30
  require_relative '../lib/sibit/version'
31
31
  require_relative '../lib/sibit/blockchain'
32
+ require_relative '../lib/sibit/blockchair'
32
33
  require_relative '../lib/sibit/btc'
33
34
  require_relative '../lib/sibit/bitcoinchain'
35
+ require_relative '../lib/sibit/cex'
34
36
  require_relative '../lib/sibit/earn'
37
+ require_relative '../lib/sibit/fake'
35
38
  require_relative '../lib/sibit/firstof'
36
39
 
37
40
  begin
@@ -62,7 +65,7 @@ Options are:"
62
65
  o.array(
63
66
  '--api',
64
67
  'Ordered List of APIs to use, e.g. "earn,blockchain,btc,bitcoinchain"',
65
- default: %w[earn blockchain btc bitcoinchain]
68
+ default: %w[earn blockchain btc bitcoinchain blockchair cex]
66
69
  )
67
70
  end
68
71
  rescue Slop::Error => ex
@@ -79,6 +82,12 @@ Options are:"
79
82
  api = Sibit::Btc.new(http: http, log: log, dry: opts[:dry])
80
83
  elsif a == 'bitcoinchain'
81
84
  api = Sibit::Bitcoinchain.new(http: http, log: log, dry: opts[:dry])
85
+ elsif a == 'blockchair'
86
+ api = Sibit::Blockchair.new(http: http, log: log, dry: opts[:dry])
87
+ elsif a == 'cex'
88
+ api = Sibit::Cex.new(http: http, log: log, dry: opts[:dry])
89
+ elsif a == 'fake'
90
+ api = Sibit::Fake.new
82
91
  elsif a == 'earn'
83
92
  api = Sibit::Earn.new(http: http, log: log, dry: opts[:dry])
84
93
  else
@@ -87,7 +96,7 @@ Options are:"
87
96
  api = RetriableProxy.for_object(api, on: Sibit::Error) if opts[:attempts] > 1
88
97
  api
89
98
  end
90
- sibit = Sibit.new(log: log, api: Sibit::FirstOf.new(apis, log: log))
99
+ sibit = Sibit.new(log: log, api: Sibit::FirstOf.new(apis, log: log, verbose: true))
91
100
  case opts.arguments[0]
92
101
  when 'price'
93
102
  puts sibit.price
@@ -31,5 +31,5 @@ Feature: Command Line Processing
31
31
  Then Exit code is zero
32
32
 
33
33
  Scenario: Bitcoin fees can be printed
34
- When I run bin/sibit with "fees --verbose"
34
+ When I run bin/sibit with "fees --verbose --api=fake"
35
35
  Then Exit code is zero
@@ -95,6 +95,7 @@ class Sibit
95
95
  data = json['data']
96
96
  raise Sibit::Error, "The block #{hash} not found" if data.nil?
97
97
  h = data['height']
98
+ raise Sibit::Error, "The block #{hash} found but the height is absent" if h.nil?
98
99
  @log.info("The height of #{hash} is #{h}")
99
100
  h
100
101
  end
@@ -124,7 +125,9 @@ class Sibit
124
125
  )
125
126
  data = json['data']
126
127
  raise Sibit::Error, "The address #{hash} not found" if data.nil?
127
- data['list'].each do |u|
128
+ txns = data['list']
129
+ next if txns.nil?
130
+ txns.each do |u|
128
131
  outs = Sibit::Json.new(http: @http, log: @log).get(
129
132
  URI("https://chain.api.btc.com/v3/tx/#{u['tx_hash']}?verbose=3")
130
133
  )['data']['outputs']
@@ -105,6 +105,7 @@ class Sibit
105
105
  done = false
106
106
  result = nil
107
107
  @list.each do |api|
108
+ @log.info("Calling #{api.class.name}##{method}()...")
108
109
  begin
109
110
  result = yield api
110
111
  done = true
@@ -26,5 +26,5 @@
26
26
  # License:: MIT
27
27
  class Sibit
28
28
  # Current version of the library.
29
- VERSION = '0.20.1'
29
+ VERSION = '0.20.2'
30
30
  end
@@ -55,7 +55,7 @@ and Ruby 2.3+.'
55
55
  s.add_runtime_dependency 'retriable_proxy', '1.0.2'
56
56
  s.add_runtime_dependency 'slop', '~> 4.6'
57
57
  s.add_development_dependency 'aruba', '~> 0.14.1'
58
- s.add_development_dependency 'codecov', '0.1.10'
58
+ s.add_development_dependency 'codecov', '0.2.8'
59
59
  s.add_development_dependency 'cucumber', '~> 1.3.17'
60
60
  s.add_development_dependency 'debase', '0.2.2'
61
61
  s.add_development_dependency 'minitest', '5.5.0'
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.20.1
4
+ version: 0.20.2
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-08-13 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.1.10
117
+ version: 0.2.8
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.1.10
124
+ version: 0.2.8
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: cucumber
127
127
  requirement: !ruby/object:Gem::Requirement