Class: Nem::Endpoint::Debug
- Inherits:
-
Base
- Object
- Base
- Nem::Endpoint::Debug
show all
- Defined in:
- lib/nem/endpoint/debug.rb
Defined Under Namespace
Classes: Connection
Instance Method Summary
collapse
Methods inherited from Base
#current_node, #initialize, #next_node!, #request, #request!
Instance Method Details
#connections(dir) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/nem/endpoint/debug.rb', line 45
def connections(dir)
case dir.to_s
when /\Ain/ then connections_incoming
when /\Aout/ then connections_outgoing
else raise "direction should be :incoming or :outgoing. dir: #{dir}"
end
end
|
#connections_incoming ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/nem/endpoint/debug.rb', line 21
def connections_incoming
request!(:get, '/debug/connections/incoming') do |res|
outstanding = res[:outstanding].map do |con|
Nem::Model::Connection.new_from_connection(con)
end
most_recent = res[:'most-recent'].map do |con|
Nem::Model::Connection.new_from_connection(con)
end
Connection.new(outstanding, most_recent)
end
end
|
#connections_outgoing ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/nem/endpoint/debug.rb', line 33
def connections_outgoing
request!(:get, '/debug/connections/outgoing') do |res|
outstanding = res[:outstanding].map do |con|
Nem::Model::Connection.new_from_connection(con)
end
most_recent = res[:'most-recent'].map do |con|
Nem::Model::Connection.new_from_connection(con)
end
Connection.new(outstanding, most_recent)
end
end
|
#time_syncronization ⇒ Object
4
5
6
7
8
9
10
|
# File 'lib/nem/endpoint/debug.rb', line 4
def time_syncronization
request!(:get, '/debug/time-synchronization') do |res|
res[:data].map do |sync|
Nem::Model::Timesync.new_from_timer(sync)
end
end
end
|
#timers ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/nem/endpoint/debug.rb', line 12
def timers
request!(:get, '/debug/timers') do |res|
res[:data].map do |timer|
Nem::Model::Timer.new_from_timer(timer)
end
end
end
|