Class: Nano::Client
- Inherits:
-
Object
- Object
- Nano::Client
- Includes:
- ApplicationHelper
- Defined in:
- lib/nano_rpc/client.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
- #call(action, params = {}) ⇒ Object
-
#initialize(host: 'localhost', port: 7076) ⇒ Client
constructor
A new instance of Client.
-
#inspect ⇒ Object
Condense host/port on object inspection.
Constructor Details
#initialize(host: 'localhost', port: 7076) ⇒ Client
Returns a new instance of Client.
15 16 17 18 |
# File 'lib/nano_rpc/client.rb', line 15 def initialize(host: 'localhost', port: 7076) @host = host @port = port end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
13 14 15 |
# File 'lib/nano_rpc/client.rb', line 13 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
13 14 15 |
# File 'lib/nano_rpc/client.rb', line 13 def port @port end |
Instance Method Details
#call(action, params = {}) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/nano_rpc/client.rb', line 25 def call(action, params = {}) args = { action: action } args.merge!(params) if params.is_a?(Hash) args = extract_proxy_args(args) rpc_post(args) end |
#inspect ⇒ Object
Condense host/port on object inspection
21 22 23 |
# File 'lib/nano_rpc/client.rb', line 21 def inspect "#{inspect_prefix}, @url=\"#{@host}:#{port}\">" end |