Class: Nem::Endpoint::Node
- Inherits:
-
Base
- Object
- Base
- Nem::Endpoint::Node
show all
- Defined in:
- lib/nem/endpoint/node.rb
Defined Under Namespace
Classes: PeerlistAll
Instance Method Summary
collapse
Methods inherited from Base
#current_node, #initialize, #next_node!, #request, #request!
Instance Method Details
#boot(boot_node_request) ⇒ nil
79
80
81
|
# File 'lib/nem/endpoint/node.rb', line 79
def boot(boot_node_request)
request!(:post, '/node/boot', boot_node_request)
end
|
#experiences ⇒ Nem::Model::ExtendedNodeExperiencePair
24
25
26
27
28
29
30
|
# File 'lib/nem/endpoint/node.rb', line 24
def experiences
request!(:get, '/node/experiences') do |res|
res[:data].map do |struct|
Nem::Model::Experience.new_from_experience(struct)
end
end
end
|
#max_chain_height ⇒ integer
6
7
8
|
# File 'lib/nem/endpoint/node.rb', line 6
def max_chain_height
request!(:get, '/node/active-peers/max-chain-height')[:height]
end
|
#peerlist(type = :all) ⇒ Array <Nem::Model::Node>
68
69
70
71
72
73
74
|
# File 'lib/nem/endpoint/node.rb', line 68
def peerlist(type = :all)
case type.to_s
when /\Aactive/ then peerlist_active
when /\Areach/ then peerlist_reachable
else peerlist_all
end
end
|
34
35
36
37
38
39
40
|
# File 'lib/nem/endpoint/node.rb', line 34
def peerlist_active
request!(:get, '/node/peer-list/active') do |res|
res[:data].map do |n|
Nem::Model::Node.new_from_node(n)
end
end
end
|
58
59
60
61
62
63
64
|
# File 'lib/nem/endpoint/node.rb', line 58
def peerlist_reachable
request!(:get, '/node/peer-list/reachable') do |res|
res[:data].map do |n|
Nem::Model::Node.new_from_node(n)
end
end
end
|