-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathnis.rb
34 lines (24 loc) · 808 Bytes
/
nis.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'pp'
require 'nem'
# Nem.logger.level = Logger::DEBUG
# output debug log example
# Nem.configure do |conf|
# conf.logger = Logger.new('./nem-ruby.log')
# conf.logger.level = Logger::DEBUG
# end
# Create Node instance
node = Nem::Node.new(host: 'bigalice2.nem.ninja')
# # It returns Nem::NemRequestResult object.
pp node.heartbeat
pp node.status
# Also call Nem::Node#request method.
# The method receive [HTTP Method], [API Path], [Parameters]
# It returns hash which converted API JSON response.
# by API path /heartbeat, /status
pp node.request :get, 'heartbeat'
pp node.request :get, 'status'
pp node.request :get, 'account/get', address: 'TBULEAUG2CZQISUR442HWA6UAKGWIXHDABJVIPS4'
# ---- only accept local node
# node = Nem::Node.new
# Create local Node instance
# pp node.shutdown