Module: Nis::Endpoint::Node::PeerList
- Included in:
- Nis
- Defined in:
- lib/nis/endpoint/node/peer_list.rb
Instance Method Summary collapse
- #node_peerlist(state = :all) ⇒ Array <Nis::Struct::Node>
- #node_peerlist_active ⇒ Array <Nis::Struct::Node>
- #node_peerlist_all ⇒ Nis::Struct::NodeCollection
- #node_peerlist_reachable ⇒ Array <Nis::Struct::Node>
- #node_peerlist_state(state) ⇒ Object
Instance Method Details
#node_peerlist(state = :all) ⇒ Array <Nis::Struct::Node>
27 28 29 30 31 32 33 34 35 |
# File 'lib/nis/endpoint/node/peer_list.rb', line 27 def node_peerlist(state = :all) if node_peerlist_state(state) == :all node_peerlist_all else request!(:get, "/node/peer-list/#{node_peerlist_state(state)}") do |res| res[:data].map { |n| Nis::Struct::Node.build(n) } end end end |
#node_peerlist_active ⇒ Array <Nis::Struct::Node>
19 20 21 22 23 |
# File 'lib/nis/endpoint/node/peer_list.rb', line 19 def node_peerlist_active request!(:get, '/node/peer-list/active') do |res| res[:data].map { |n| Nis::Struct::Node.build(n) } end end |
#node_peerlist_all ⇒ Nis::Struct::NodeCollection
5 6 7 |
# File 'lib/nis/endpoint/node/peer_list.rb', line 5 def node_peerlist_all Nis::Struct::NodeCollection.build request!(:get, '/node/peer-list/all') end |
#node_peerlist_reachable ⇒ Array <Nis::Struct::Node>
11 12 13 14 15 |
# File 'lib/nis/endpoint/node/peer_list.rb', line 11 def node_peerlist_reachable request!(:get, '/node/peer-list/reachable') do |res| res[:data].map { |n| Nis::Struct::Node.build(n) } end end |
#node_peerlist_state(state) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/nis/endpoint/node/peer_list.rb', line 37 def node_peerlist_state(state) case state.to_s when 'active' then :active when 'reachable' then :reachable else :all end end |