Class: TelegramBot::ChatMemberRestricted
- Inherits:
-
Object
- Object
- TelegramBot::ChatMemberRestricted
- Defined in:
- lib/telegram-bot/models/chat_member_restricted.rb
Overview
Represents a chat member that is under certain restrictions in the chat. Supergroups only.
Instance Attribute Summary collapse
-
#can_add_web_page_previews ⇒ Object
True, if the user is allowed to add web page previews to their messages.
-
#can_change_info ⇒ Object
True, if the user is allowed to change the chat title, photo and other settings.
-
#can_invite_users ⇒ Object
True, if the user is allowed to invite new users to the chat.
-
#can_manage_topics ⇒ Object
True, if the user is allowed to create forum topics.
-
#can_pin_messages ⇒ Object
True, if the user is allowed to pin messages.
-
#can_send_audios ⇒ Object
True, if the user is allowed to send audios.
-
#can_send_documents ⇒ Object
True, if the user is allowed to send documents.
-
#can_send_messages ⇒ Object
True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues.
-
#can_send_other_messages ⇒ Object
True, if the user is allowed to send animations, games, stickers and use inline bots.
-
#can_send_photos ⇒ Object
True, if the user is allowed to send photos.
-
#can_send_polls ⇒ Object
True, if the user is allowed to send polls.
-
#can_send_video_notes ⇒ Object
True, if the user is allowed to send video notes.
-
#can_send_videos ⇒ Object
True, if the user is allowed to send videos.
-
#can_send_voice_notes ⇒ Object
True, if the user is allowed to send voice notes.
-
#is_member ⇒ Object
True, if the user is a member of the chat at the moment of the request.
-
#status ⇒ Object
The member’s status in the chat, always "restricted".
-
#until_date ⇒ Object
Date when restrictions will be lifted for this user; Unix time.
-
#user ⇒ Object
Information about the user.
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 = {}) ⇒ ChatMemberRestricted
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 = {}) ⇒ ChatMemberRestricted
Initializes the object
134 135 136 137 138 139 140 141 142 143 144 145 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 192 193 194 195 196 197 198 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 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 134 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `TelegramBot::ChatMemberRestricted` 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::ChatMemberRestricted`. 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?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'user') self.user = attributes[:'user'] else self.user = nil end if attributes.key?(:'is_member') self.is_member = attributes[:'is_member'] else self.is_member = nil end if attributes.key?(:'can_send_messages') self. = attributes[:'can_send_messages'] else self. = nil end if attributes.key?(:'can_send_audios') self.can_send_audios = attributes[:'can_send_audios'] else self.can_send_audios = nil end if attributes.key?(:'can_send_documents') self.can_send_documents = attributes[:'can_send_documents'] else self.can_send_documents = nil end if attributes.key?(:'can_send_photos') self.can_send_photos = attributes[:'can_send_photos'] else self.can_send_photos = nil end if attributes.key?(:'can_send_videos') self.can_send_videos = attributes[:'can_send_videos'] else self.can_send_videos = nil end if attributes.key?(:'can_send_video_notes') self.can_send_video_notes = attributes[:'can_send_video_notes'] else self.can_send_video_notes = nil end if attributes.key?(:'can_send_voice_notes') self.can_send_voice_notes = attributes[:'can_send_voice_notes'] else self.can_send_voice_notes = nil end if attributes.key?(:'can_send_polls') self.can_send_polls = attributes[:'can_send_polls'] else self.can_send_polls = nil end if attributes.key?(:'can_send_other_messages') self. = attributes[:'can_send_other_messages'] else self. = nil end if attributes.key?(:'can_add_web_page_previews') self.can_add_web_page_previews = attributes[:'can_add_web_page_previews'] else self.can_add_web_page_previews = nil end if attributes.key?(:'can_change_info') self.can_change_info = attributes[:'can_change_info'] else self.can_change_info = nil end if attributes.key?(:'can_invite_users') self.can_invite_users = attributes[:'can_invite_users'] else self.can_invite_users = nil end if attributes.key?(:'can_pin_messages') self. = attributes[:'can_pin_messages'] else self. = nil end if attributes.key?(:'can_manage_topics') self.can_manage_topics = attributes[:'can_manage_topics'] else self.can_manage_topics = nil end if attributes.key?(:'until_date') self.until_date = attributes[:'until_date'] else self.until_date = nil end end |
Instance Attribute Details
#can_add_web_page_previews ⇒ Object
True, if the user is allowed to add web page previews to their messages
56 57 58 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 56 def can_add_web_page_previews @can_add_web_page_previews end |
#can_change_info ⇒ Object
True, if the user is allowed to change the chat title, photo and other settings
59 60 61 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 59 def can_change_info @can_change_info end |
#can_invite_users ⇒ Object
True, if the user is allowed to invite new users to the chat
62 63 64 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 62 def can_invite_users @can_invite_users end |
#can_manage_topics ⇒ Object
True, if the user is allowed to create forum topics
68 69 70 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 68 def can_manage_topics @can_manage_topics end |
#can_pin_messages ⇒ Object
True, if the user is allowed to pin messages
65 66 67 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 65 def @can_pin_messages end |
#can_send_audios ⇒ Object
True, if the user is allowed to send audios
32 33 34 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 32 def can_send_audios @can_send_audios end |
#can_send_documents ⇒ Object
True, if the user is allowed to send documents
35 36 37 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 35 def can_send_documents @can_send_documents end |
#can_send_messages ⇒ Object
True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues
29 30 31 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 29 def @can_send_messages end |
#can_send_other_messages ⇒ Object
True, if the user is allowed to send animations, games, stickers and use inline bots
53 54 55 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 53 def @can_send_other_messages end |
#can_send_photos ⇒ Object
True, if the user is allowed to send photos
38 39 40 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 38 def can_send_photos @can_send_photos end |
#can_send_polls ⇒ Object
True, if the user is allowed to send polls
50 51 52 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 50 def can_send_polls @can_send_polls end |
#can_send_video_notes ⇒ Object
True, if the user is allowed to send video notes
44 45 46 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 44 def can_send_video_notes @can_send_video_notes end |
#can_send_videos ⇒ Object
True, if the user is allowed to send videos
41 42 43 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 41 def can_send_videos @can_send_videos end |
#can_send_voice_notes ⇒ Object
True, if the user is allowed to send voice notes
47 48 49 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 47 def can_send_voice_notes @can_send_voice_notes end |
#is_member ⇒ Object
True, if the user is a member of the chat at the moment of the request
26 27 28 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 26 def is_member @is_member end |
#status ⇒ Object
The member’s status in the chat, always "restricted"
20 21 22 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 20 def status @status end |
#until_date ⇒ Object
Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever
71 72 73 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 71 def until_date @until_date end |
#user ⇒ Object
Information about the user
23 24 25 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 23 def user @user end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 425 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
98 99 100 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 98 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 74 def self.attribute_map { :'status' => :'status', :'user' => :'user', :'is_member' => :'is_member', :'can_send_messages' => :'can_send_messages', :'can_send_audios' => :'can_send_audios', :'can_send_documents' => :'can_send_documents', :'can_send_photos' => :'can_send_photos', :'can_send_videos' => :'can_send_videos', :'can_send_video_notes' => :'can_send_video_notes', :'can_send_voice_notes' => :'can_send_voice_notes', :'can_send_polls' => :'can_send_polls', :'can_send_other_messages' => :'can_send_other_messages', :'can_add_web_page_previews' => :'can_add_web_page_previews', :'can_change_info' => :'can_change_info', :'can_invite_users' => :'can_invite_users', :'can_pin_messages' => :'can_pin_messages', :'can_manage_topics' => :'can_manage_topics', :'until_date' => :'until_date' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 401 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
127 128 129 130 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 127 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 103 def self.openapi_types { :'status' => :'String', :'user' => :'User', :'is_member' => :'Boolean', :'can_send_messages' => :'Boolean', :'can_send_audios' => :'Boolean', :'can_send_documents' => :'Boolean', :'can_send_photos' => :'Boolean', :'can_send_videos' => :'Boolean', :'can_send_video_notes' => :'Boolean', :'can_send_voice_notes' => :'Boolean', :'can_send_polls' => :'Boolean', :'can_send_other_messages' => :'Boolean', :'can_add_web_page_previews' => :'Boolean', :'can_change_info' => :'Boolean', :'can_invite_users' => :'Boolean', :'can_pin_messages' => :'Boolean', :'can_manage_topics' => :'Boolean', :'until_date' => :'Integer' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 363 def ==(o) return true if self.equal?(o) self.class == o.class && status == o.status && user == o.user && is_member == o.is_member && == o. && can_send_audios == o.can_send_audios && can_send_documents == o.can_send_documents && can_send_photos == o.can_send_photos && can_send_videos == o.can_send_videos && can_send_video_notes == o.can_send_video_notes && can_send_voice_notes == o.can_send_voice_notes && can_send_polls == o.can_send_polls && == o. && can_add_web_page_previews == o.can_add_web_page_previews && can_change_info == o.can_change_info && can_invite_users == o.can_invite_users && == o. && can_manage_topics == o.can_manage_topics && until_date == o.until_date end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
496 497 498 499 500 501 502 503 504 505 506 507 508 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 496 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
388 389 390 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 388 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
394 395 396 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 394 def hash [status, user, is_member, , can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, can_send_voice_notes, can_send_polls, , can_add_web_page_previews, can_change_info, can_invite_users, , can_manage_topics, until_date].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 258 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @user.nil? invalid_properties.push('invalid value for "user", user cannot be nil.') end if @is_member.nil? invalid_properties.push('invalid value for "is_member", is_member cannot be nil.') end if @can_send_messages.nil? invalid_properties.push('invalid value for "can_send_messages", can_send_messages cannot be nil.') end if @can_send_audios.nil? invalid_properties.push('invalid value for "can_send_audios", can_send_audios cannot be nil.') end if @can_send_documents.nil? invalid_properties.push('invalid value for "can_send_documents", can_send_documents cannot be nil.') end if @can_send_photos.nil? invalid_properties.push('invalid value for "can_send_photos", can_send_photos cannot be nil.') end if @can_send_videos.nil? invalid_properties.push('invalid value for "can_send_videos", can_send_videos cannot be nil.') end if @can_send_video_notes.nil? invalid_properties.push('invalid value for "can_send_video_notes", can_send_video_notes cannot be nil.') end if @can_send_voice_notes.nil? invalid_properties.push('invalid value for "can_send_voice_notes", can_send_voice_notes cannot be nil.') end if @can_send_polls.nil? invalid_properties.push('invalid value for "can_send_polls", can_send_polls cannot be nil.') end if @can_send_other_messages.nil? invalid_properties.push('invalid value for "can_send_other_messages", can_send_other_messages cannot be nil.') end if @can_add_web_page_previews.nil? invalid_properties.push('invalid value for "can_add_web_page_previews", can_add_web_page_previews cannot be nil.') end if @can_change_info.nil? invalid_properties.push('invalid value for "can_change_info", can_change_info cannot be nil.') end if @can_invite_users.nil? invalid_properties.push('invalid value for "can_invite_users", can_invite_users cannot be nil.') end if @can_pin_messages.nil? invalid_properties.push('invalid value for "can_pin_messages", can_pin_messages cannot be nil.') end if @can_manage_topics.nil? invalid_properties.push('invalid value for "can_manage_topics", can_manage_topics cannot be nil.') end if @until_date.nil? invalid_properties.push('invalid value for "until_date", until_date cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
472 473 474 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 472 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
478 479 480 481 482 483 484 485 486 487 488 489 490 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 478 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
466 467 468 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 466 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/telegram-bot/models/chat_member_restricted.rb', line 338 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @status.nil? return false if @user.nil? return false if @is_member.nil? return false if @can_send_messages.nil? return false if @can_send_audios.nil? return false if @can_send_documents.nil? return false if @can_send_photos.nil? return false if @can_send_videos.nil? return false if @can_send_video_notes.nil? return false if @can_send_voice_notes.nil? return false if @can_send_polls.nil? return false if @can_send_other_messages.nil? return false if @can_add_web_page_previews.nil? return false if @can_change_info.nil? return false if @can_invite_users.nil? return false if @can_pin_messages.nil? return false if @can_manage_topics.nil? return false if @until_date.nil? true end |