Class: Nem::Endpoint::Debug
Defined Under Namespace
Classes: Connection
Instance Method Summary collapse
- #connections(dir) ⇒ Object
- #connections_incoming ⇒ Object
- #connections_outgoing ⇒ Object
- #time_syncronization ⇒ Nem::Model::Timesync
- #timers ⇒ Object
Methods inherited from Base
#current_node, #initialize, #next_node!, #request, #request!
Constructor Details
This class inherits a constructor from Nem::Endpoint::Base
Instance Method Details
#connections(dir) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/nem/endpoint/debug.rb', line 50 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
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/nem/endpoint/debug.rb', line 25 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
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/nem/endpoint/debug.rb', line 38 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 ⇒ Nem::Model::Timesync
6 7 8 9 10 11 12 |
# File 'lib/nem/endpoint/debug.rb', line 6 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
15 16 17 18 19 20 21 |
# File 'lib/nem/endpoint/debug.rb', line 15 def timers request!(:get, '/debug/timers') do |res| res[:data].map do |timer| Nem::Model::Timer.new_from_timer(timer) end end end |