class Sumac::Message::Exchange::CallResponse
Public Class Methods
new(connection)
click to toggle source
Calls superclass method
Sumac::Message::Exchange::ID::new
# File lib/sumac/message/exchange/call_response.rb, line 7 def initialize(connection) super @return_value = nil @exception = nil end
Public Instance Methods
exception()
click to toggle source
# File lib/sumac/message/exchange/call_response.rb, line 57 def exception raise MessageError unless setup? @exception == nil ? nil : @exception.to_native_object end
exception=(new_exception_value)
click to toggle source
# File lib/sumac/message/exchange/call_response.rb, line 62 def exception=(new_exception_value) raise unless @return_value == nil @exception = Object.from_native_object(@connection, new_exception_value) raise MessageError unless @exception.class.one_of?(Object::Exception, Object::NativeException) end
invert_orgin()
click to toggle source
# File lib/sumac/message/exchange/call_response.rb, line 68 def invert_orgin raise MessageError unless setup? @return_value.invert_orgin if @return_value.respond_to?(:invert_orgin) nil end
parse_json_structure(json_structure)
click to toggle source
# File lib/sumac/message/exchange/call_response.rb, line 13 def parse_json_structure(json_structure) raise MessageError unless json_structure.is_a?(Hash) && json_structure['message_type'] == 'exchange' && json_structure['exchange_type'] == 'call_response' raise MessageError unless json_structure['id'].is_a?(Integer) @id = json_structure['id'] case when json_structure['return_value'] && !json_structure['exception'] @return_value = Object.from_json_structure(@connection, json_structure['return_value']) when !json_structure['return_value'] && json_structure['exception'] @exception = Object.from_json_structure(@connection, json_structure['exception']) raise MessageError unless @exception.class.one_of?(Object::Exception, Object::NativeException) else raise MessageError end nil end
return_value()
click to toggle source
# File lib/sumac/message/exchange/call_response.rb, line 47 def return_value raise MessageError unless setup? @return_value == nil ? nil : @return_value.to_native_object end
return_value=(new_return_value)
click to toggle source
# File lib/sumac/message/exchange/call_response.rb, line 52 def return_value=(new_return_value) raise unless @exception == nil @return_value = Object.from_native_object(@connection, new_return_value) end
to_json_structure()
click to toggle source
# File lib/sumac/message/exchange/call_response.rb, line 31 def to_json_structure raise MessageError unless setup? json_structure = { 'message_type' => 'exchange', 'exchange_type' => 'call_response', 'id' => @id } if @return_value json_structure['return_value'] = @return_value.to_json_structure else json_structure['exception'] = @exception.to_json_structure end json_structure end
Private Instance Methods
setup?()
click to toggle source
Calls superclass method
Sumac::Message::Exchange::ID#setup?
# File lib/sumac/message/exchange/call_response.rb, line 76 def setup? super && ((@return_value != nil) ^ (@exception != nil)) end