Class: Alula::RpcResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/alula/rpc_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ RpcResponse

Returns a new instance of RpcResponse.



7
8
9
10
11
# File 'lib/alula/rpc_response.rb', line 7

def initialize(response)
  @request_id = response.data['id']
  @result = response.data['result']
  @http_status = response.data['http_status']
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/alula/rpc_response.rb', line 5

def data
  @data
end

#http_statusObject

Returns the value of attribute http_status.



5
6
7
# File 'lib/alula/rpc_response.rb', line 5

def http_status
  @http_status
end

#request_idObject

Returns the value of attribute request_id.



5
6
7
# File 'lib/alula/rpc_response.rb', line 5

def request_id
  @request_id
end

#resultObject

Returns the value of attribute result.



5
6
7
# File 'lib/alula/rpc_response.rb', line 5

def result
  @result
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/alula/rpc_response.rb', line 13

def ok?
  @result['success'] == true || (@result['errors'].nil? && @result['error'].nil?)
end