Class: ArkEcosystem::Client::ConnectionManager
- Inherits:
-
Object
- Object
- ArkEcosystem::Client::ConnectionManager
- Defined in:
- lib/arkecosystem/client/connection_manager.rb
Overview
Manager that holds all connections
Instance Attribute Summary collapse
-
#connections ⇒ Object
Returns the value of attribute connections.
-
#default ⇒ Object
Returns the value of attribute default.
Instance Method Summary collapse
-
#connect(connection, name = 'main') ⇒ Faraday::Response
Connection to the given connection.
-
#connection(name) ⇒ ArkEcosystem::Client::Connection
Get a connection instance.
-
#disconnect(name) ⇒ nil
Disconnect from the given connection.
-
#initialize ⇒ Faraday::Response
constructor
Create a new client instance.
Constructor Details
#initialize ⇒ Faraday::Response
Create a new client instance.
14 15 16 17 |
# File 'lib/arkecosystem/client/connection_manager.rb', line 14 def initialize @default = 'main' @connections = {} end |
Instance Attribute Details
#connections ⇒ Object
Returns the value of attribute connections.
9 10 11 |
# File 'lib/arkecosystem/client/connection_manager.rb', line 9 def connections @connections end |
#default ⇒ Object
Returns the value of attribute default.
9 10 11 |
# File 'lib/arkecosystem/client/connection_manager.rb', line 9 def default @default end |
Instance Method Details
#connect(connection, name = 'main') ⇒ Faraday::Response
Connection to the given connection.
25 26 27 |
# File 'lib/arkecosystem/client/connection_manager.rb', line 25 def connect(connection, name = 'main') @connections[name] = connection end |
#connection(name) ⇒ ArkEcosystem::Client::Connection
Get a connection instance.
43 44 45 |
# File 'lib/arkecosystem/client/connection_manager.rb', line 43 def connection(name) @connections[name] end |
#disconnect(name) ⇒ nil
Disconnect from the given connection.
34 35 36 |
# File 'lib/arkecosystem/client/connection_manager.rb', line 34 def disconnect(name) @connections.delete(name) end |