Class: Sumac::Message::Exchange
- Inherits:
-
Sumac::Message
- Object
- Sumac::Message
- Sumac::Message::Exchange
- Defined in:
- lib/sumac/message/exchange.rb,
lib/sumac/message/exchange/id.rb,
lib/sumac/message/exchange/base.rb,
lib/sumac/message/exchange/call_request.rb,
lib/sumac/message/exchange/notification.rb,
lib/sumac/message/exchange/call_response.rb,
lib/sumac/message/exchange/forget_notification.rb,
lib/sumac/message/exchange/shutdown_notification.rb,
lib/sumac/message/exchange/compatibility_notification.rb,
lib/sumac/message/exchange/initialization_notification.rb
Direct Known Subclasses
Defined Under Namespace
Modules: ID Classes: Base, CallRequest, CallResponse, CompatibilityNotification, ForgetNotification, InitializationNotification, Notification, ShutdownNotification
Class Method Summary collapse
Methods inherited from Sumac::Message
from_json, #initialize, #to_json
Constructor Details
This class inherits a constructor from Sumac::Message
Class Method Details
.from_json_structure(connection, json_structure) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sumac/message/exchange.rb', line 5 def self.from_json_structure(connection, json_structure) raise MessageError unless json_structure.is_a?(Hash) && json_structure['message_type'] == 'exchange' exchange_class = case json_structure['exchange_type'] when 'compatibility_notification' CompatibilityNotification when 'initialization_notification' InitializationNotification when 'shutdown_notification' ShutdownNotification when 'forget_notification' ForgetNotification when 'call_request' CallRequest when 'call_response' CallResponse else raise MessageError end exchange = exchange_class.from_json_structure(connection, json_structure) exchange end |