Class: Nanook
- Inherits:
-
Object
- Object
- Nanook
- Defined in:
- lib/nanook.rb,
lib/nanook/key.rb,
lib/nanook/rpc.rb,
lib/nanook/node.rb,
lib/nanook/util.rb,
lib/nanook/block.rb,
lib/nanook/error.rb,
lib/nanook/wallet.rb,
lib/nanook/account.rb,
lib/nanook/version.rb,
lib/nanook/work_peer.rb,
lib/nanook/wallet_account.rb
Overview
Initializing
Connect to the default RPC host at localhost:7076 and with a timeout of 500 seconds:
nanook = Nanook.new
To connect to another host instead:
nanook = Nanook.new("http://ip6-localhost.com:7076")
To give a specific timeout value:
Nanook.new(timeout: 600)
Nanook.new("http://ip6-localhost.com:7076", timeout: 600)
Defined Under Namespace
Classes: Account, Block, Error, Key, Node, Rpc, Util, Wallet, WalletAccount, WorkPeer
Constant Summary collapse
- VERSION =
"1.0.2"
Instance Method Summary collapse
-
#account(account = nil) ⇒ Object
Returns a Nanook::Account instance.
- #block(block = nil) ⇒ Object
-
#initialize(uri = Nanook::Rpc::DEFAULT_URI, timeout: Nanook::Rpc::DEFAULT_TIMEOUT) ⇒ Nanook
constructor
Arguments.
-
#inspect ⇒ Object
:nodoc.
- #key(key = nil) ⇒ Object
- #node ⇒ Object
- #wallet(wallet = nil) ⇒ Object
- #work_peers ⇒ Object
Constructor Details
#initialize(uri = Nanook::Rpc::DEFAULT_URI, timeout: Nanook::Rpc::DEFAULT_TIMEOUT) ⇒ Nanook
Arguments
-
uri
- RPC host to connect to (default is “localhost:7076”) -
timeout:
- Connection timeout in number of seconds (default is 500)
Examples
Nanook.new # Connect to http://localhost:7076 with 500s timeout
Nanook.new(timeout: 600)
Nanook.new("http://ip6-localhost.com:7076", timeout: 600)
33 34 35 |
# File 'lib/nanook.rb', line 33 def initialize(uri=Nanook::Rpc::DEFAULT_URI, timeout:Nanook::Rpc::DEFAULT_TIMEOUT) @rpc = Nanook::Rpc.new(uri, timeout: timeout) end |
Instance Method Details
#account(account = nil) ⇒ Object
44 45 46 |
# File 'lib/nanook.rb', line 44 def account(account=nil) Nanook::Account.new(@rpc, account) end |
#block(block = nil) ⇒ Object
48 49 50 |
# File 'lib/nanook.rb', line 48 def block(block=nil) Nanook::Block.new(@rpc, block) end |
#inspect ⇒ Object
:nodoc
52 53 54 |
# File 'lib/nanook.rb', line 52 def inspect # :nodoc "#{self.class.name}(rpc: #{@rpc.inspect}, object_id: \"#{"0x00%x" % (object_id << 1)}\")" end |
#key(key = nil) ⇒ Object
56 57 58 |
# File 'lib/nanook.rb', line 56 def key(key=nil) Nanook::Key.new(@rpc, key) end |