Class: Rodzilla::JsonRpc::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/rodzilla/json_rpc/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

Returns a new instance of Response.



6
7
8
# File 'lib/rodzilla/json_rpc/response.rb', line 6

def initialize
  @error = nil
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



4
5
6
# File 'lib/rodzilla/json_rpc/response.rb', line 4

def error
  @error
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/rodzilla/json_rpc/response.rb', line 4

def id
  @id
end

#resultObject

Returns the value of attribute result.



4
5
6
# File 'lib/rodzilla/json_rpc/response.rb', line 4

def result
  @result
end

Instance Method Details

#read_http_response(http_response) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rodzilla/json_rpc/response.rb', line 10

def read_http_response(http_response)
  body = http_response.parsed_response
  @id     = body["id"]
  @error  = body["error"]
  @result = body["result"]
  self
end