Class: Sumac::Message::Exchange::CompatibilityNotification
- Inherits:
-
Notification
- Object
- Sumac::Message
- Sumac::Message::Exchange
- Base
- Notification
- Sumac::Message::Exchange::CompatibilityNotification
- Defined in:
- lib/sumac/message/exchange/compatibility_notification.rb
Instance Method Summary collapse
-
#initialize(connection) ⇒ CompatibilityNotification
constructor
A new instance of CompatibilityNotification.
- #invert_orgin ⇒ Object
- #parse_json_structure(json_structure) ⇒ Object
- #protocol_version ⇒ Object
- #protocol_version=(new_protocol_version) ⇒ Object
- #to_json_structure ⇒ Object
Methods inherited from Base
Methods inherited from Sumac::Message::Exchange
Methods inherited from Sumac::Message
Constructor Details
#initialize(connection) ⇒ CompatibilityNotification
Returns a new instance of CompatibilityNotification.
6 7 8 9 |
# File 'lib/sumac/message/exchange/compatibility_notification.rb', line 6 def initialize(connection) super @protocol_version = nil end |
Instance Method Details
#invert_orgin ⇒ Object
39 40 41 42 |
# File 'lib/sumac/message/exchange/compatibility_notification.rb', line 39 def invert_orgin raise MessageError unless setup? nil end |
#parse_json_structure(json_structure) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/sumac/message/exchange/compatibility_notification.rb', line 11 def parse_json_structure(json_structure) raise MessageError unless json_structure.is_a?(Hash) && json_structure['message_type'] == 'exchange' && json_structure['exchange_type'] == 'compatibility_notification' raise MessageError unless json_structure['protocol_version'].is_a?(Integer) @protocol_version = json_structure['protocol_version'] nil end |
#protocol_version ⇒ Object
29 30 31 32 |
# File 'lib/sumac/message/exchange/compatibility_notification.rb', line 29 def protocol_version raise MessageError unless setup? @protocol_version end |
#protocol_version=(new_protocol_version) ⇒ Object
34 35 36 37 |
# File 'lib/sumac/message/exchange/compatibility_notification.rb', line 34 def protocol_version=(new_protocol_version) raise MessageError unless new_protocol_version.is_a?(Integer) @protocol_version = new_protocol_version end |
#to_json_structure ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/sumac/message/exchange/compatibility_notification.rb', line 20 def to_json_structure raise MessageError unless setup? { 'message_type' => 'exchange', 'exchange_type' => 'compatibility_notification', 'protocol_version' => @protocol_version } end |