Class: Telegem::Types::Chat
Constant Summary
collapse
- COMMON_FIELDS =
%w[id type username title first_name last_name
photo bio has_private_forwards
has_restricted_voice_and_video_messages
description invite_link pinned_message
permissions slow_mode_delay message_auto_delete_time
has_protected_content sticker_set_name
can_set_sticker_set linked_chat_id location].freeze
Instance Attribute Summary
Attributes inherited from BaseType
#_raw_data
Instance Method Summary
collapse
Methods inherited from BaseType
#inspect, #method_missing, #respond_to_missing?, #to_h
Constructor Details
#initialize(data) ⇒ Chat
Returns a new instance of Chat.
133
134
135
136
137
138
139
|
# File 'lib/api/types.rb', line 133
def initialize(data)
super(data)
COMMON_FIELDS.each do |field|
define_accessor(field.to_sym)
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Telegem::Types::BaseType
Instance Method Details
#channel? ⇒ Boolean
153
154
155
|
# File 'lib/api/types.rb', line 153
def channel?
type == 'channel'
end
|
#group? ⇒ Boolean
145
146
147
|
# File 'lib/api/types.rb', line 145
def group?
type == 'group'
end
|
#private? ⇒ Boolean
141
142
143
|
# File 'lib/api/types.rb', line 141
def private?
type == 'private'
end
|
#supergroup? ⇒ Boolean
149
150
151
|
# File 'lib/api/types.rb', line 149
def supergroup?
type == 'supergroup'
end
|
#to_s ⇒ Object
157
158
159
|
# File 'lib/api/types.rb', line 157
def to_s
title || username || "Chat ##{id}"
end
|