lib/submodules/ably-ruby/lib/ably/models/protocol_message.rb in ably-rest-1.1.8 vs lib/submodules/ably-ruby/lib/ably/models/protocol_message.rb in ably-rest-1.2.0

- old
+ new

@@ -64,10 +64,18 @@ message: 15, sync: 16, auth: 17 ) + ATTACH_FLAGS_MAPPING = { + resume: 32, # 2^5 + presence: 65536, # 2^16 + publish: 131072, # 2^17 + subscribe: 262144, # 2^18 + presence_subscribe: 524288, # 2^19 + } + # Indicates this protocol message action will generate an ACK response such as :message or :presence # @api private def self.ack_required?(for_action) ACTION(for_action).match_any?(ACTION.Presence, ACTION.Message) end @@ -183,10 +191,14 @@ def has_correct_message_size? message_size <= connection_details.max_message_size end + def params + @params ||= attributes[:params].to_h + end + def flags Integer(attributes[:flags]) rescue TypeError 0 end @@ -216,30 +228,30 @@ flags & 16 == 16 # 2^4 end # @api private def has_attach_resume_flag? - flags & 32 == 32 # 2^5 + flags & ATTACH_FLAGS_MAPPING[:resume] == ATTACH_FLAGS_MAPPING[:resume] # 2^5 end # @api private def has_attach_presence_flag? - flags & 65536 == 65536 # 2^16 + flags & ATTACH_FLAGS_MAPPING[:presence] == ATTACH_FLAGS_MAPPING[:presence] # 2^16 end # @api private def has_attach_publish_flag? - flags & 131072 == 131072 # 2^17 + flags & ATTACH_FLAGS_MAPPING[:publish] == ATTACH_FLAGS_MAPPING[:publish] # 2^17 end # @api private def has_attach_subscribe_flag? - flags & 262144 == 262144 # 2^18 + flags & ATTACH_FLAGS_MAPPING[:subscribe] == ATTACH_FLAGS_MAPPING[:subscribe] # 2^18 end # @api private def has_attach_presence_subscribe_flag? - flags & 524288 == 524288 # 2^19 + flags & ATTACH_FLAGS_MAPPING[:presence_subscribe] == ATTACH_FLAGS_MAPPING[:presence_subscribe] # 2^19 end def connection_details @connection_details ||= Ably::Models::ConnectionDetails(attributes[:connection_details]) end