Class: Cosmos::JsonRpcSuccessResponse
- Inherits:
-
JsonRpcResponse
- Object
- JsonRpc
- JsonRpcResponse
- Cosmos::JsonRpcSuccessResponse
- Defined in:
- lib/cosmos/io/json_rpc.rb
Overview
Represents a JSON Remote Procedure Call Success Response
Class Method Summary collapse
-
.from_hash(hash) ⇒ JsonRpcSuccessResponse
Creates a JsonRpcSuccessResponse object from a Hash.
Instance Method Summary collapse
-
#initialize(result, id) ⇒ JsonRpcSuccessResponse
constructor
A new instance of JsonRpcSuccessResponse.
-
#result ⇒ Object
The result of the method request.
Methods inherited from JsonRpcResponse
Methods inherited from JsonRpc
Constructor Details
#initialize(result, id) ⇒ JsonRpcSuccessResponse
Returns a new instance of JsonRpcSuccessResponse.
281 282 283 284 |
# File 'lib/cosmos/io/json_rpc.rb', line 281 def initialize(result, id) super(id) @hash['result'.freeze] = result end |
Class Method Details
.from_hash(hash) ⇒ JsonRpcSuccessResponse
Creates a JsonRpcSuccessResponse object from a Hash
295 296 297 |
# File 'lib/cosmos/io/json_rpc.rb', line 295 def self.from_hash(hash) self.new(hash['result'.freeze], hash['id'.freeze]) end |
Instance Method Details
#result ⇒ Object
Returns The result of the method request.
287 288 289 |
# File 'lib/cosmos/io/json_rpc.rb', line 287 def result @hash['result'.freeze] end |