sibit 0.12.6 → 0.13.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84dbc9a25777fde7ba775b8adc200bc19719c2acf153e0513795e8a8f0ffc161
4
- data.tar.gz: 6520e17706434cd239f23e38d764ea4c0a82a8d319970ac5a7d46b5d6acaa55a
3
+ metadata.gz: e93c805c891cda23a83a22d1b2672e8bee9f50cd6bd6cdce29e5554f782faa4a
4
+ data.tar.gz: 1dbfc35d75a85cc9fa4c480429357f2361f588307ca87ee740a10acdfa558d83
5
5
  SHA512:
6
- metadata.gz: 7dd7c3cbef60a7ce2242a932d39d6812ddb704928d50f9a7343e1a349cc319d8913cbb7f221257ee2dc7d06a07053d6d7a19247ea35f538fe3b70c29b0a707ed
7
- data.tar.gz: f927d8c28599512da7bc0d2c44af18bfbb79c4683aa916324e368b321a306f648bb17a43add9aeedd71af14052a45bbfa1cbdfc6cfa7b753d5feb92e333b4efc
6
+ metadata.gz: ba8615db5e241046b2c47f11cb5c238973d39753eda17b96ecd942c385e680204bf4a5aeb2af2a247d7c8fac7f7f5963bd4761c009715ae65f7cb7e7055aa0b6
7
+ data.tar.gz: 02d888118626eb0cda9b9d282a310f33e1fc28cd587a7de871a2d2a283d60ac82c84e3b4a14c150a28201db085b11ca00a0c8a05f8bd0fbe449f96920ee2d44a
data/features/cli.feature CHANGED
@@ -11,7 +11,11 @@ Feature: Command Line Processing
11
11
  Then Exit code is zero
12
12
 
13
13
  Scenario: Bitcoin latest block hash can be retrieved
14
- When I run bin/sibit with "latest"
14
+ When I run bin/sibit with "latest --api=blockchain"
15
+ Then Exit code is zero
16
+
17
+ Scenario: Bitcoin latest block hash can be retrieved via Btc
18
+ When I run bin/sibit with "latest --api=btc"
15
19
  Then Exit code is zero
16
20
 
17
21
  Scenario: Bitcoin private key can be generated
data/lib/sibit/btc.rb CHANGED
@@ -70,7 +70,11 @@ class Sibit
70
70
 
71
71
  # Gets the hash of the latest block.
72
72
  def latest
73
- raise Sibit::Error, 'Not implemented yet'
73
+ uri = URI('https://chain.api.btc.com/v3/block/latest')
74
+ json = Sibit::Json.new(http: @http, log: @log).get(uri)
75
+ hash = json['data']['hash']
76
+ @log.info("The hash of the latest block is #{hash}")
77
+ hash
74
78
  end
75
79
  end
76
80
  end
data/lib/sibit/version.rb CHANGED
@@ -26,5 +26,5 @@
26
26
  # License:: MIT
27
27
  class Sibit
28
28
  # Current version of the library.
29
- VERSION = '0.12.6'
29
+ VERSION = '0.13.0'
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.6
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko