Class: TelegramBot::Chat
- Inherits:
-
Object
- Object
- TelegramBot::Chat
- Defined in:
- lib/telegram-bot/models/chat.rb
Overview
This object represents a chat.
Instance Attribute Summary collapse
-
#accent_color_id ⇒ Object
Optional.
-
#active_usernames ⇒ Object
Optional.
-
#available_reactions ⇒ Object
Optional.
-
#background_custom_emoji_id ⇒ Object
Optional.
-
#bio ⇒ Object
Optional.
-
#birthdate ⇒ Object
Optional.
-
#business_intro ⇒ Object
Optional.
-
#business_location ⇒ Object
Optional.
-
#business_opening_hours ⇒ Object
Optional.
-
#can_set_sticker_set ⇒ Object
Optional.
-
#custom_emoji_sticker_set_name ⇒ Object
Optional.
-
#description ⇒ Object
Optional.
-
#emoji_status_custom_emoji_id ⇒ Object
Optional.
-
#emoji_status_expiration_date ⇒ Object
Optional.
-
#first_name ⇒ Object
Optional.
-
#has_aggressive_anti_spam_enabled ⇒ Object
Optional.
-
#has_hidden_members ⇒ Object
Optional.
-
#has_private_forwards ⇒ Object
Optional.
-
#has_protected_content ⇒ Object
Optional.
-
#has_restricted_voice_and_video_messages ⇒ Object
Optional.
-
#has_visible_history ⇒ Object
Optional.
-
#id ⇒ Object
Unique identifier for this chat.
-
#invite_link ⇒ Object
Optional.
-
#is_forum ⇒ Object
Optional.
-
#join_by_request ⇒ Object
Optional.
-
#join_to_send_messages ⇒ Object
Optional.
-
#last_name ⇒ Object
Optional.
-
#linked_chat_id ⇒ Object
Optional.
-
#location ⇒ Object
Optional.
-
#message_auto_delete_time ⇒ Object
Optional.
-
#permissions ⇒ Object
Optional.
-
#personal_chat ⇒ Object
Optional.
-
#photo ⇒ Object
Optional.
-
#pinned_message ⇒ Object
Optional.
-
#profile_accent_color_id ⇒ Object
Optional.
-
#profile_background_custom_emoji_id ⇒ Object
Optional.
-
#slow_mode_delay ⇒ Object
Optional.
-
#sticker_set_name ⇒ Object
Optional.
-
#title ⇒ Object
Optional.
-
#type ⇒ Object
Type of chat, can be either "private", "group", "supergroup" or "channel".
-
#unrestrict_boost_count ⇒ Object
Optional.
-
#username ⇒ Object
Optional.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Chat
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Chat
Initializes the object
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
# File 'lib/telegram-bot/models/chat.rb', line 254 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `TelegramBot::Chat` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `TelegramBot::Chat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = nil end if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'username') self.username = attributes[:'username'] end if attributes.key?(:'first_name') self.first_name = attributes[:'first_name'] end if attributes.key?(:'last_name') self.last_name = attributes[:'last_name'] end if attributes.key?(:'is_forum') self.is_forum = attributes[:'is_forum'] end if attributes.key?(:'photo') self.photo = attributes[:'photo'] end if attributes.key?(:'active_usernames') if (value = attributes[:'active_usernames']).is_a?(Array) self.active_usernames = value end end if attributes.key?(:'birthdate') self.birthdate = attributes[:'birthdate'] end if attributes.key?(:'business_intro') self.business_intro = attributes[:'business_intro'] end if attributes.key?(:'business_location') self.business_location = attributes[:'business_location'] end if attributes.key?(:'business_opening_hours') self.business_opening_hours = attributes[:'business_opening_hours'] end if attributes.key?(:'personal_chat') self.personal_chat = attributes[:'personal_chat'] end if attributes.key?(:'available_reactions') if (value = attributes[:'available_reactions']).is_a?(Array) self.available_reactions = value end end if attributes.key?(:'accent_color_id') self.accent_color_id = attributes[:'accent_color_id'] end if attributes.key?(:'background_custom_emoji_id') self.background_custom_emoji_id = attributes[:'background_custom_emoji_id'] end if attributes.key?(:'profile_accent_color_id') self.profile_accent_color_id = attributes[:'profile_accent_color_id'] end if attributes.key?(:'profile_background_custom_emoji_id') self.profile_background_custom_emoji_id = attributes[:'profile_background_custom_emoji_id'] end if attributes.key?(:'emoji_status_custom_emoji_id') self.emoji_status_custom_emoji_id = attributes[:'emoji_status_custom_emoji_id'] end if attributes.key?(:'emoji_status_expiration_date') self.emoji_status_expiration_date = attributes[:'emoji_status_expiration_date'] end if attributes.key?(:'bio') self.bio = attributes[:'bio'] end if attributes.key?(:'has_private_forwards') self.has_private_forwards = attributes[:'has_private_forwards'] end if attributes.key?(:'has_restricted_voice_and_video_messages') self. = attributes[:'has_restricted_voice_and_video_messages'] end if attributes.key?(:'join_to_send_messages') self. = attributes[:'join_to_send_messages'] end if attributes.key?(:'join_by_request') self.join_by_request = attributes[:'join_by_request'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'invite_link') self.invite_link = attributes[:'invite_link'] end if attributes.key?(:'pinned_message') self. = attributes[:'pinned_message'] end if attributes.key?(:'permissions') self. = attributes[:'permissions'] end if attributes.key?(:'slow_mode_delay') self.slow_mode_delay = attributes[:'slow_mode_delay'] end if attributes.key?(:'unrestrict_boost_count') self.unrestrict_boost_count = attributes[:'unrestrict_boost_count'] end if attributes.key?(:'message_auto_delete_time') self. = attributes[:'message_auto_delete_time'] end if attributes.key?(:'has_aggressive_anti_spam_enabled') self.has_aggressive_anti_spam_enabled = attributes[:'has_aggressive_anti_spam_enabled'] end if attributes.key?(:'has_hidden_members') self.has_hidden_members = attributes[:'has_hidden_members'] end if attributes.key?(:'has_protected_content') self.has_protected_content = attributes[:'has_protected_content'] end if attributes.key?(:'has_visible_history') self.has_visible_history = attributes[:'has_visible_history'] end if attributes.key?(:'sticker_set_name') self.sticker_set_name = attributes[:'sticker_set_name'] end if attributes.key?(:'can_set_sticker_set') self.can_set_sticker_set = attributes[:'can_set_sticker_set'] end if attributes.key?(:'custom_emoji_sticker_set_name') self.custom_emoji_sticker_set_name = attributes[:'custom_emoji_sticker_set_name'] end if attributes.key?(:'linked_chat_id') self.linked_chat_id = attributes[:'linked_chat_id'] end if attributes.key?(:'location') self.location = attributes[:'location'] end end |
Instance Attribute Details
#accent_color_id ⇒ Object
Optional. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview. See accent colors for more details. Returned only in getChat. Always returned in getChat.
65 66 67 |
# File 'lib/telegram-bot/models/chat.rb', line 65 def accent_color_id @accent_color_id end |
#active_usernames ⇒ Object
Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat.
44 45 46 |
# File 'lib/telegram-bot/models/chat.rb', line 44 def active_usernames @active_usernames end |
#available_reactions ⇒ Object
Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed. Returned only in getChat.
62 63 64 |
# File 'lib/telegram-bot/models/chat.rb', line 62 def available_reactions @available_reactions end |
#background_custom_emoji_id ⇒ Object
Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background. Returned only in getChat.
68 69 70 |
# File 'lib/telegram-bot/models/chat.rb', line 68 def background_custom_emoji_id @background_custom_emoji_id end |
#bio ⇒ Object
Optional. Bio of the other party in a private chat. Returned only in getChat.
83 84 85 |
# File 'lib/telegram-bot/models/chat.rb', line 83 def bio @bio end |
#birthdate ⇒ Object
Optional. For private chats, the date of birth of the user. Returned only in getChat.
47 48 49 |
# File 'lib/telegram-bot/models/chat.rb', line 47 def birthdate @birthdate end |
#business_intro ⇒ Object
Optional. For private chats with business accounts, the intro of the business. Returned only in getChat.
50 51 52 |
# File 'lib/telegram-bot/models/chat.rb', line 50 def business_intro @business_intro end |
#business_location ⇒ Object
Optional. For private chats with business accounts, the location of the business. Returned only in getChat.
53 54 55 |
# File 'lib/telegram-bot/models/chat.rb', line 53 def business_location @business_location end |
#business_opening_hours ⇒ Object
Optional. For private chats with business accounts, the opening hours of the business. Returned only in getChat.
56 57 58 |
# File 'lib/telegram-bot/models/chat.rb', line 56 def business_opening_hours @business_opening_hours end |
#can_set_sticker_set ⇒ Object
Optional. True, if the bot can change the group sticker set. Returned only in getChat.
134 135 136 |
# File 'lib/telegram-bot/models/chat.rb', line 134 def can_set_sticker_set @can_set_sticker_set end |
#custom_emoji_sticker_set_name ⇒ Object
Optional. For supergroups, the name of the group’s custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group. Returned only in getChat.
137 138 139 |
# File 'lib/telegram-bot/models/chat.rb', line 137 def custom_emoji_sticker_set_name @custom_emoji_sticker_set_name end |
#description ⇒ Object
Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
98 99 100 |
# File 'lib/telegram-bot/models/chat.rb', line 98 def description @description end |
#emoji_status_custom_emoji_id ⇒ Object
Optional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat. Returned only in getChat.
77 78 79 |
# File 'lib/telegram-bot/models/chat.rb', line 77 def emoji_status_custom_emoji_id @emoji_status_custom_emoji_id end |
#emoji_status_expiration_date ⇒ Object
Optional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any. Returned only in getChat.
80 81 82 |
# File 'lib/telegram-bot/models/chat.rb', line 80 def emoji_status_expiration_date @emoji_status_expiration_date end |
#first_name ⇒ Object
Optional. First name of the other party in a private chat
32 33 34 |
# File 'lib/telegram-bot/models/chat.rb', line 32 def first_name @first_name end |
#has_aggressive_anti_spam_enabled ⇒ Object
Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in getChat.
119 120 121 |
# File 'lib/telegram-bot/models/chat.rb', line 119 def has_aggressive_anti_spam_enabled @has_aggressive_anti_spam_enabled end |
#has_hidden_members ⇒ Object
Optional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat.
122 123 124 |
# File 'lib/telegram-bot/models/chat.rb', line 122 def has_hidden_members @has_hidden_members end |
#has_private_forwards ⇒ Object
Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.
86 87 88 |
# File 'lib/telegram-bot/models/chat.rb', line 86 def has_private_forwards @has_private_forwards end |
#has_protected_content ⇒ Object
Optional. True, if messages from the chat can’t be forwarded to other chats. Returned only in getChat.
125 126 127 |
# File 'lib/telegram-bot/models/chat.rb', line 125 def has_protected_content @has_protected_content end |
#has_restricted_voice_and_video_messages ⇒ Object
Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.
89 90 91 |
# File 'lib/telegram-bot/models/chat.rb', line 89 def @has_restricted_voice_and_video_messages end |
#has_visible_history ⇒ Object
Optional. True, if new chat members will have access to old messages; available only to chat administrators. Returned only in getChat.
128 129 130 |
# File 'lib/telegram-bot/models/chat.rb', line 128 def has_visible_history @has_visible_history end |
#id ⇒ Object
Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
20 21 22 |
# File 'lib/telegram-bot/models/chat.rb', line 20 def id @id end |
#invite_link ⇒ Object
Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
101 102 103 |
# File 'lib/telegram-bot/models/chat.rb', line 101 def invite_link @invite_link end |
#is_forum ⇒ Object
Optional. True, if the supergroup chat is a forum (has topics enabled)
38 39 40 |
# File 'lib/telegram-bot/models/chat.rb', line 38 def is_forum @is_forum end |
#join_by_request ⇒ Object
Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
95 96 97 |
# File 'lib/telegram-bot/models/chat.rb', line 95 def join_by_request @join_by_request end |
#join_to_send_messages ⇒ Object
Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
92 93 94 |
# File 'lib/telegram-bot/models/chat.rb', line 92 def @join_to_send_messages end |
#last_name ⇒ Object
Optional. Last name of the other party in a private chat
35 36 37 |
# File 'lib/telegram-bot/models/chat.rb', line 35 def last_name @last_name end |
#linked_chat_id ⇒ Object
Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
140 141 142 |
# File 'lib/telegram-bot/models/chat.rb', line 140 def linked_chat_id @linked_chat_id end |
#location ⇒ Object
Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
143 144 145 |
# File 'lib/telegram-bot/models/chat.rb', line 143 def location @location end |
#message_auto_delete_time ⇒ Object
Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
116 117 118 |
# File 'lib/telegram-bot/models/chat.rb', line 116 def @message_auto_delete_time end |
#permissions ⇒ Object
Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
107 108 109 |
# File 'lib/telegram-bot/models/chat.rb', line 107 def @permissions end |
#personal_chat ⇒ Object
Optional. For private chats, the personal channel of the user. Returned only in getChat.
59 60 61 |
# File 'lib/telegram-bot/models/chat.rb', line 59 def personal_chat @personal_chat end |
#photo ⇒ Object
Optional. Chat photo. Returned only in getChat.
41 42 43 |
# File 'lib/telegram-bot/models/chat.rb', line 41 def photo @photo end |
#pinned_message ⇒ Object
Optional. The most recent pinned message (by sending date). Returned only in getChat.
104 105 106 |
# File 'lib/telegram-bot/models/chat.rb', line 104 def @pinned_message end |
#profile_accent_color_id ⇒ Object
Optional. Identifier of the accent color for the chat’s profile background. See profile accent colors for more details. Returned only in getChat.
71 72 73 |
# File 'lib/telegram-bot/models/chat.rb', line 71 def profile_accent_color_id @profile_accent_color_id end |
#profile_background_custom_emoji_id ⇒ Object
Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background. Returned only in getChat.
74 75 76 |
# File 'lib/telegram-bot/models/chat.rb', line 74 def profile_background_custom_emoji_id @profile_background_custom_emoji_id end |
#slow_mode_delay ⇒ Object
Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds. Returned only in getChat.
110 111 112 |
# File 'lib/telegram-bot/models/chat.rb', line 110 def slow_mode_delay @slow_mode_delay end |
#sticker_set_name ⇒ Object
Optional. For supergroups, name of group sticker set. Returned only in getChat.
131 132 133 |
# File 'lib/telegram-bot/models/chat.rb', line 131 def sticker_set_name @sticker_set_name end |
#title ⇒ Object
Optional. Title, for supergroups, channels and group chats
26 27 28 |
# File 'lib/telegram-bot/models/chat.rb', line 26 def title @title end |
#type ⇒ Object
Type of chat, can be either "private", "group", "supergroup" or "channel"
23 24 25 |
# File 'lib/telegram-bot/models/chat.rb', line 23 def type @type end |
#unrestrict_boost_count ⇒ Object
Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. Returned only in getChat.
113 114 115 |
# File 'lib/telegram-bot/models/chat.rb', line 113 def unrestrict_boost_count @unrestrict_boost_count end |
#username ⇒ Object
Optional. Username, for private chats, supergroups and channels if available
29 30 31 |
# File 'lib/telegram-bot/models/chat.rb', line 29 def username @username end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
# File 'lib/telegram-bot/models/chat.rb', line 557 def self._deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = TelegramBot.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
194 195 196 |
# File 'lib/telegram-bot/models/chat.rb', line 194 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/telegram-bot/models/chat.rb', line 146 def self.attribute_map { :'id' => :'id', :'type' => :'type', :'title' => :'title', :'username' => :'username', :'first_name' => :'first_name', :'last_name' => :'last_name', :'is_forum' => :'is_forum', :'photo' => :'photo', :'active_usernames' => :'active_usernames', :'birthdate' => :'birthdate', :'business_intro' => :'business_intro', :'business_location' => :'business_location', :'business_opening_hours' => :'business_opening_hours', :'personal_chat' => :'personal_chat', :'available_reactions' => :'available_reactions', :'accent_color_id' => :'accent_color_id', :'background_custom_emoji_id' => :'background_custom_emoji_id', :'profile_accent_color_id' => :'profile_accent_color_id', :'profile_background_custom_emoji_id' => :'profile_background_custom_emoji_id', :'emoji_status_custom_emoji_id' => :'emoji_status_custom_emoji_id', :'emoji_status_expiration_date' => :'emoji_status_expiration_date', :'bio' => :'bio', :'has_private_forwards' => :'has_private_forwards', :'has_restricted_voice_and_video_messages' => :'has_restricted_voice_and_video_messages', :'join_to_send_messages' => :'join_to_send_messages', :'join_by_request' => :'join_by_request', :'description' => :'description', :'invite_link' => :'invite_link', :'pinned_message' => :'pinned_message', :'permissions' => :'permissions', :'slow_mode_delay' => :'slow_mode_delay', :'unrestrict_boost_count' => :'unrestrict_boost_count', :'message_auto_delete_time' => :'message_auto_delete_time', :'has_aggressive_anti_spam_enabled' => :'has_aggressive_anti_spam_enabled', :'has_hidden_members' => :'has_hidden_members', :'has_protected_content' => :'has_protected_content', :'has_visible_history' => :'has_visible_history', :'sticker_set_name' => :'sticker_set_name', :'can_set_sticker_set' => :'can_set_sticker_set', :'custom_emoji_sticker_set_name' => :'custom_emoji_sticker_set_name', :'linked_chat_id' => :'linked_chat_id', :'location' => :'location' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
# File 'lib/telegram-bot/models/chat.rb', line 533 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
247 248 249 250 |
# File 'lib/telegram-bot/models/chat.rb', line 247 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/telegram-bot/models/chat.rb', line 199 def self.openapi_types { :'id' => :'Integer', :'type' => :'String', :'title' => :'String', :'username' => :'String', :'first_name' => :'String', :'last_name' => :'String', :'is_forum' => :'Boolean', :'photo' => :'ChatPhoto', :'active_usernames' => :'Array<String>', :'birthdate' => :'Birthdate', :'business_intro' => :'BusinessIntro', :'business_location' => :'BusinessLocation', :'business_opening_hours' => :'BusinessOpeningHours', :'personal_chat' => :'Chat', :'available_reactions' => :'Array<Object>', :'accent_color_id' => :'Integer', :'background_custom_emoji_id' => :'String', :'profile_accent_color_id' => :'Integer', :'profile_background_custom_emoji_id' => :'String', :'emoji_status_custom_emoji_id' => :'String', :'emoji_status_expiration_date' => :'Integer', :'bio' => :'String', :'has_private_forwards' => :'Boolean', :'has_restricted_voice_and_video_messages' => :'Boolean', :'join_to_send_messages' => :'Boolean', :'join_by_request' => :'Boolean', :'description' => :'String', :'invite_link' => :'String', :'pinned_message' => :'Message', :'permissions' => :'ChatPermissions', :'slow_mode_delay' => :'Integer', :'unrestrict_boost_count' => :'Integer', :'message_auto_delete_time' => :'Integer', :'has_aggressive_anti_spam_enabled' => :'Boolean', :'has_hidden_members' => :'Boolean', :'has_protected_content' => :'Boolean', :'has_visible_history' => :'Boolean', :'sticker_set_name' => :'String', :'can_set_sticker_set' => :'Boolean', :'custom_emoji_sticker_set_name' => :'String', :'linked_chat_id' => :'Integer', :'location' => :'ChatLocation' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/telegram-bot/models/chat.rb', line 471 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && type == o.type && title == o.title && username == o.username && first_name == o.first_name && last_name == o.last_name && is_forum == o.is_forum && photo == o.photo && active_usernames == o.active_usernames && birthdate == o.birthdate && business_intro == o.business_intro && business_location == o.business_location && business_opening_hours == o.business_opening_hours && personal_chat == o.personal_chat && available_reactions == o.available_reactions && accent_color_id == o.accent_color_id && background_custom_emoji_id == o.background_custom_emoji_id && profile_accent_color_id == o.profile_accent_color_id && profile_background_custom_emoji_id == o.profile_background_custom_emoji_id && emoji_status_custom_emoji_id == o.emoji_status_custom_emoji_id && emoji_status_expiration_date == o.emoji_status_expiration_date && bio == o.bio && has_private_forwards == o.has_private_forwards && == o. && == o. && join_by_request == o.join_by_request && description == o.description && invite_link == o.invite_link && == o. && == o. && slow_mode_delay == o.slow_mode_delay && unrestrict_boost_count == o.unrestrict_boost_count && == o. && has_aggressive_anti_spam_enabled == o.has_aggressive_anti_spam_enabled && has_hidden_members == o.has_hidden_members && has_protected_content == o.has_protected_content && has_visible_history == o.has_visible_history && sticker_set_name == o.sticker_set_name && can_set_sticker_set == o.can_set_sticker_set && custom_emoji_sticker_set_name == o.custom_emoji_sticker_set_name && linked_chat_id == o.linked_chat_id && location == o.location end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
628 629 630 631 632 633 634 635 636 637 638 639 640 |
# File 'lib/telegram-bot/models/chat.rb', line 628 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#eql?(o) ⇒ Boolean
520 521 522 |
# File 'lib/telegram-bot/models/chat.rb', line 520 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
526 527 528 |
# File 'lib/telegram-bot/models/chat.rb', line 526 def hash [id, type, title, username, first_name, last_name, is_forum, photo, active_usernames, birthdate, business_intro, business_location, business_opening_hours, personal_chat, available_reactions, accent_color_id, background_custom_emoji_id, profile_accent_color_id, profile_background_custom_emoji_id, emoji_status_custom_emoji_id, emoji_status_expiration_date, bio, has_private_forwards, , , join_by_request, description, invite_link, , , slow_mode_delay, unrestrict_boost_count, , has_aggressive_anti_spam_enabled, has_hidden_members, has_protected_content, has_visible_history, sticker_set_name, can_set_sticker_set, custom_emoji_sticker_set_name, linked_chat_id, location].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/telegram-bot/models/chat.rb', line 446 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
604 605 606 |
# File 'lib/telegram-bot/models/chat.rb', line 604 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
610 611 612 613 614 615 616 617 618 619 620 621 622 |
# File 'lib/telegram-bot/models/chat.rb', line 610 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
598 599 600 |
# File 'lib/telegram-bot/models/chat.rb', line 598 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
462 463 464 465 466 467 |
# File 'lib/telegram-bot/models/chat.rb', line 462 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @type.nil? true end |