Class: Chat
- Inherits:
-
Object
- Object
- Chat
- Defined in:
- lib/objects/chat.rb
Overview
This object represents a chat.
Direct Known Subclasses
Instance Method Summary collapse
-
#channel? ⇒ Boolean
Returns true if chat type is channel else false is returned.
-
#has_title? ⇒ Boolean
Returns true if chat has title else false is returned.
-
#id ⇒ Object
Unique identifier for this chat.
-
#initialize(chat) ⇒ Chat
constructor
:nodoc:.
-
#private? ⇒ Boolean
Returns true if chat type is private else false is returned.
-
#supergroup? ⇒ Boolean
Returns true if chat type is supergroup else false is returned.
-
#title ⇒ Object
Optional
. -
#type ⇒ Object
Type of chat, can be either
private
,group
,supergroup
orchannel
. -
#username ⇒ Object
Optional
.
Constructor Details
#initialize(chat) ⇒ Chat
:nodoc:
12 13 14 |
# File 'lib/objects/chat.rb', line 12 def initialize(chat) # :nodoc: @chat = chat end |
Instance Method Details
#channel? ⇒ Boolean
Returns true if chat type is channel else false is returned.
49 50 51 |
# File 'lib/objects/chat.rb', line 49 def channel? type.eql? 'channel' end |
#has_title? ⇒ Boolean
Returns true if chat has title else false is returned.
54 55 56 |
# File 'lib/objects/chat.rb', line 54 def has_title? title.nil? end |
#id ⇒ Object
Unique identifier for this chat.
17 18 19 |
# File 'lib/objects/chat.rb', line 17 def id @chat.id end |
#private? ⇒ Boolean
Returns true if chat type is private else false is returned.
39 40 41 |
# File 'lib/objects/chat.rb', line 39 def private? type.eql? 'private' end |
#supergroup? ⇒ Boolean
Returns true if chat type is supergroup else false is returned.
44 45 46 |
# File 'lib/objects/chat.rb', line 44 def supergroup? type.eql? 'supergroup' end |
#title ⇒ Object
Optional
. Title, for supergroups
, channels
and group
chats.
28 29 30 |
# File 'lib/objects/chat.rb', line 28 def title @chat.title end |
#type ⇒ Object
Type of chat, can be either private
, group
, supergroup
or channel
.
23 24 25 |
# File 'lib/objects/chat.rb', line 23 def type @chat.type end |
#username ⇒ Object
Optional
. Username, for private
chats, supergroups
and channels
if available else nil is returned.
34 35 36 |
# File 'lib/objects/chat.rb', line 34 def username @chat.username end |