Class: ChatSDK::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/chat_sdk/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, text:, author:, thread_id:, channel_id:, platform:, attachments: [], raw: nil, timestamp: nil) ⇒ Message

Returns a new instance of Message.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/chat_sdk/message.rb', line 8

def initialize(id:, text:, author:, thread_id:, channel_id:, platform:,
  attachments: [], raw: nil, timestamp: nil)
  @id = id
  @text = text
  @author = author
  @thread_id = thread_id
  @channel_id = channel_id
  @platform = platform
  @attachments = attachments
  @raw = raw
  @timestamp = timestamp
end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments.



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

def attachments
  @attachments
end

#authorObject (readonly)

Returns the value of attribute author.



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

def author
  @author
end

#channel_idObject (readonly)

Returns the value of attribute channel_id.



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

def channel_id
  @channel_id
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#platformObject (readonly)

Returns the value of attribute platform.



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

def platform
  @platform
end

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

#textObject (readonly)

Returns the value of attribute text.



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

def text
  @text
end

#thread_idObject (readonly)

Returns the value of attribute thread_id.



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

def thread_id
  @thread_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



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

def timestamp
  @timestamp
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



21
22
23
# File 'lib/chat_sdk/message.rb', line 21

def ==(other)
  other.is_a?(Message) && id == other.id && platform == other.platform
end

#hashObject



26
27
28
# File 'lib/chat_sdk/message.rb', line 26

def hash
  [id, platform].hash
end