Class: ChatSDK::Author

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, platform:, bot: false, raw: nil) ⇒ Author

Returns a new instance of Author.



7
8
9
10
11
12
13
# File 'lib/chat_sdk/author.rb', line 7

def initialize(id:, name:, platform:, bot: false, raw: nil)
  @id = id
  @name = name
  @platform = platform
  @bot = bot
  @raw = raw
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#platformObject (readonly)

Returns the value of attribute platform.



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

def platform
  @platform
end

#rawObject (readonly)

Returns the value of attribute raw.



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

def raw
  @raw
end

Instance Method Details

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



19
20
21
# File 'lib/chat_sdk/author.rb', line 19

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

#bot?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/chat_sdk/author.rb', line 15

def bot?
  @bot
end

#hashObject



24
25
26
# File 'lib/chat_sdk/author.rb', line 24

def hash
  [id, platform].hash
end