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, locale: nil, raw: nil) ⇒ Author

Returns a new instance of Author.



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

def initialize(id:, name:, platform:, bot: false, locale: nil, raw: nil)
  @id = id
  @name = name
  @platform = platform
  @bot = bot
  @locale = locale
  @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

#localeObject (readonly)

Returns the value of attribute locale.



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

def locale
  @locale
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?



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

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

#bot?Boolean

Returns:

  • (Boolean)


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

def bot?
  @bot
end

#hashObject



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

def hash
  [id, platform].hash
end