class MmJsonClient::JsonRpcHttp::Response

A standard formatted JSON-RPC response.

Attributes

error[R]
id[R]
result[R]
version[R]

Public Class Methods

new(json) click to toggle source
# File lib/mm_json_client/json_rpc_http/response.rb, line 14
def initialize(json)
  data = JSON.parse(json)
  @version = data['version']
  @result = data['result']
  @error = data['error'] && new_error(data['error'])
  @id = data['id']
rescue JSON::ParserError
  raise InvalidResponseFormat
end

Private Instance Methods

new_error(error_data) click to toggle source
# File lib/mm_json_client/json_rpc_http/response.rb, line 26
def new_error(error_data)
  MmJsonClient::JsonRpcHttp::Error.new(error_data)
end