lib/sibit/blockchain.rb in sibit-0.17.0 vs lib/sibit/blockchain.rb in sibit-0.18.0
- old
+ new
@@ -45,17 +45,22 @@
@log = log
@dry = dry
end
# Current price of BTC in USD (float returned).
- def price(currency)
+ def price(currency = 'USD')
h = Sibit::Json.new(http: @http, log: @log).get(
URI('https://blockchain.info/ticker')
)[currency]
raise Error, "Unrecognized currency #{currency}" if h.nil?
price = h['15m']
@log.info("The price of BTC is #{price} USD")
price
+ end
+
+ # Get hash of the block after this one.
+ def next_of(_hash)
+ raise Sibit::Error, 'Blockchain API doesn\'t provide next_of()'
end
# The height of the block.
def height(hash)
json = Sibit::Json.new(http: @http, log: @log).get(