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.
132
133
134
135
136
137
138
|
# File 'lib/api/types.rb', line 132
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
152
153
154
|
# File 'lib/api/types.rb', line 152
def channel?
type == 'channel'
end
|
#group? ⇒ Boolean
144
145
146
|
# File 'lib/api/types.rb', line 144
def group?
type == 'group'
end
|
#private? ⇒ Boolean
140
141
142
|
# File 'lib/api/types.rb', line 140
def private?
type == 'private'
end
|
#supergroup? ⇒ Boolean
148
149
150
|
# File 'lib/api/types.rb', line 148
def supergroup?
type == 'supergroup'
end
|
#to_s ⇒ Object
156
157
158
|
# File 'lib/api/types.rb', line 156
def to_s
title || username || "Chat ##{id}"
end
|