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.
130
131
132
133
134
135
136
|
# File 'lib/api/types.rb', line 130
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
150
151
152
|
# File 'lib/api/types.rb', line 150
def channel?
type == 'channel'
end
|
#group? ⇒ Boolean
142
143
144
|
# File 'lib/api/types.rb', line 142
def group?
type == 'group'
end
|
#private? ⇒ Boolean
138
139
140
|
# File 'lib/api/types.rb', line 138
def private?
type == 'private'
end
|
#supergroup? ⇒ Boolean
146
147
148
|
# File 'lib/api/types.rb', line 146
def supergroup?
type == 'supergroup'
end
|
#to_s ⇒ Object
154
155
156
|
# File 'lib/api/types.rb', line 154
def to_s
title || username || "Chat ##{id}"
end
|