Class: OpenC3::JsonRpcSuccessResponse

Inherits:
JsonRpcResponse show all
Defined in:
lib/openc3/io/json_rpc.rb

Overview

Represents a JSON Remote Procedure Call Success Response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from JsonRpcResponse

from_json

Methods inherited from JsonRpc

#<=>, #as_json, #to_json

Constructor Details

#initialize(result, id) ⇒ JsonRpcSuccessResponse



343
344
345
346
# File 'lib/openc3/io/json_rpc.rb', line 343

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



357
358
359
# File 'lib/openc3/io/json_rpc.rb', line 357

def self.from_hash(hash)
  self.new(hash['result'.freeze], hash['id'.freeze])
end

Instance Method Details

#resultObject



349
350
351
# File 'lib/openc3/io/json_rpc.rb', line 349

def result
  @hash['result'.freeze]
end