Class: Bytom::Peer
- Inherits:
-
Object
- Object
- Bytom::Peer
- Defined in:
- lib/bytom/api/peer.rb
Instance Method Summary collapse
-
#connect_peer(ip:, port:) ⇒ Object
Connect to specified peer.
-
#disconnect_peer(peer_id:) ⇒ Object
Disconnect to specified peer.
-
#initialize(client) ⇒ Peer
constructor
A new instance of Peer.
-
#list_peers ⇒ Object
Returns the list of connected peers.
Constructor Details
#initialize(client) ⇒ Peer
Returns a new instance of Peer.
6 7 8 |
# File 'lib/bytom/api/peer.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#connect_peer(ip:, port:) ⇒ Object
Connect to specified peer.
32 33 34 35 36 37 38 |
# File 'lib/bytom/api/peer.rb', line 32 def connect_peer(ip:, port:) params = { ip: ip, port: port } client.make_request('/connect-peer', 'post', params: params) end |
#disconnect_peer(peer_id:) ⇒ Object
Disconnect to specified peer.
22 23 24 |
# File 'lib/bytom/api/peer.rb', line 22 def disconnect_peer(peer_id:) client.make_request('/disconnect-peer', 'post', params: {peer_id: peer_id}) end |
#list_peers ⇒ Object
Returns the list of connected peers.
13 14 15 |
# File 'lib/bytom/api/peer.rb', line 13 def list_peers client.make_request('/list-peers', 'post', params: {}) end |