Class: RSMP::Version
Overview
Version message, lists supported versions and SXL information.
Constant Summary
Constants included from MessageSxlCodec
MessageSxlCodec::SXL_ITEM_SHAPES
Instance Attribute Summary
Attributes inherited from Message
#attributes, #direction, #json, #now, #out, #timestamp
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Version
constructor
A new instance of Version.
- #request? ⇒ Boolean
- #response? ⇒ Boolean
- #site_ids ⇒ Object
- #step ⇒ Object
- #sxls ⇒ Object
- #versions ⇒ Object
Methods inherited from Message
#attribute, bin_to_chars, build, build_alarm, create_message_instance, #ensure_message_id, #generate_json, #inspect, #m_id, #m_id_short, make_m_id, message_types, parse_attributes, shorten_m_id, #type, #valid?, #validate, #validate!, validate_attributes_structure, #validate_id?, validate_message_type, validate_mtype_field, #validate_type?, validate_type_field
Methods included from MessageSxlCodec
#decode_for, #encode_for, included
Constructor Details
#initialize(attributes = {}) ⇒ Version
Returns a new instance of Version.
214 215 216 217 218 |
# File 'lib/rsmp/message.rb', line 214 def initialize(attributes = {}) super({ 'type' => 'Version' }.merge attributes) end |
Instance Method Details
#request? ⇒ Boolean
228 229 230 |
# File 'lib/rsmp/message.rb', line 228 def request? step == 'Request' end |
#response? ⇒ Boolean
232 233 234 |
# File 'lib/rsmp/message.rb', line 232 def response? step == 'Response' end |
#site_ids ⇒ Object
242 243 244 |
# File 'lib/rsmp/message.rb', line 242 def site_ids attribute('siteId').map { |item| item['sId'] } end |
#step ⇒ Object
224 225 226 |
# File 'lib/rsmp/message.rb', line 224 def step @attributes['step'] end |
#sxls ⇒ Object
236 237 238 239 240 |
# File 'lib/rsmp/message.rb', line 236 def sxls (@attributes['SXLS'] || []).map do |item| item.transform_keys(&:to_s) end end |
#versions ⇒ Object
220 221 222 |
# File 'lib/rsmp/message.rb', line 220 def versions attribute('RSMP').map { |item| item['vers'] } end |