Sha256: a8a58f384ea3e9376ef3ee8028e01c8420d7a35b2bd45bc6df92802abf9e8b85
Contents?: true
Size: 1.06 KB
Versions: 9
Compression:
Stored size: 1.06 KB
Contents
class Syncano module Packets # Class representing notification packets used in communication with the Sync Server class Notification < Syncano::Packets::Base attr_reader :id, :type, :channel, :source, :target, :data # Constructor for Syncano::Packets::Notification object # @param [Hash] attributes def initialize(attributes) super(attributes) self.id = attributes[:id] self.type = attributes[:type] self.channel = attributes[:channel] self.source = attributes[:source] self.target = attributes[:target] if type == 'change' self.data = { added: attributes[:add], updated: attributes[:replace], deleted: attributes[:delete] } else self.data = attributes[:data] end end # Returns true if is a notification packet # @return [TrueClass, FalseClass] def notification? true end private attr_writer :id, :type, :channel, :source, :target, :data end end end
Version data entries
9 entries across 9 versions & 1 rubygems