Method: Sibit#initialize
- Defined in:
- lib/sibit.rb
#initialize(log: $stdout, api: Sibit::Blockchain.new(log: Sibit::Log.new(log))) ⇒ Sibit
Constructor.
You may provide the log you want to see the messages in. If you don’t provide anything, the console will be used. The object you provide has to respond to the method info or puts in order to receive logging messages.
It is recommended to wrap the API in a RetriableProxy from retriable_proxy gem and to configure it to retry on Sibit::Error:
RetriableProxy.for_object(api, on: Sibit::Error)
This will help you avoid some temporary network issues.
The api argument can be an object or an array of objects. If an array is provided, we will make an attempt to try them one by one, until one of them succeedes.
50 51 52 53 |
# File 'lib/sibit.rb', line 50 def initialize(log: $stdout, api: Sibit::Blockchain.new(log: Sibit::Log.new(log))) @log = Sibit::Log.new(log) @api = api end |