Class: Syncano::Packets::Message

Inherits:
Base
  • Object
show all
Defined in:
lib/syncano/packets/message.rb

Overview

Class representing message packets used in communication with the Sync Server

Instance Attribute Summary collapse

Attributes inherited from Base

#object, #timestamp

Instance Method Summary collapse

Methods inherited from Base

#auth?, #call_response?, instantize_packet, #ping?

Constructor Details

#initialize(attributes) ⇒ Message

Constructor for Syncano::Packets::Message object

Parameters:

  • attributes (Hash)


9
10
11
12
13
14
15
# File 'lib/syncano/packets/message.rb', line 9

def initialize(attributes)
  super(attributes)
  self.id = attributes[:id]
  self.source = attributes[:source]
  self.target = attributes[:target]
  self.data = attributes[:data]
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/syncano/packets/message.rb', line 5

def data
  @data
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/syncano/packets/message.rb', line 5

def id
  @id
end

#sourceObject

Returns the value of attribute source.



5
6
7
# File 'lib/syncano/packets/message.rb', line 5

def source
  @source
end

#targetObject

Returns the value of attribute target.



5
6
7
# File 'lib/syncano/packets/message.rb', line 5

def target
  @target
end

Instance Method Details

#message?TrueClass, FalseClass

Returns true if is a message packet

Returns:

  • (TrueClass, FalseClass)


25
26
27
# File 'lib/syncano/packets/message.rb', line 25

def message?
  true
end

#notification?TrueClass, FalseClass

Returns true if is a notification packet

Returns:

  • (TrueClass, FalseClass)


19
20
21
# File 'lib/syncano/packets/message.rb', line 19

def notification?
  true
end