Class: Raiblocks::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/raiblocks/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host: 'localhost', port: 7076) ⇒ Client

Returns a new instance of Client.



13
14
15
16
# File 'lib/raiblocks/client.rb', line 13

def initialize(host: 'localhost', port: 7076)
  @host = host
  @port = port
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



11
12
13
# File 'lib/raiblocks/client.rb', line 11

def host
  @host
end

#portObject

Returns the value of attribute port.



11
12
13
# File 'lib/raiblocks/client.rb', line 11

def port
  @port
end

Instance Method Details

#call(action, params = {}) ⇒ Object



18
19
20
21
22
# File 'lib/raiblocks/client.rb', line 18

def call(action, params = {})
  args = { action: action }
  args.merge!(params) if params.is_a?(Hash)
  post(args)
end