Class: Zernio::DiscordScheduledEvent
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::DiscordScheduledEvent
- Defined in:
- lib/zernio-sdk/models/discord_scheduled_event.rb
Overview
Discord guild scheduled event. Returned by /v1/discord/guilds/guildId/events endpoints. Fields below are the subset Zernio consumes — Discord may return more (e.g. creator, image hash) which we pass through verbatim.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#channel_id ⇒ Object
Voice/stage channel ID; null for external events.
-
#creator_id ⇒ Object
Returns the value of attribute creator_id.
-
#description ⇒ Object
Returns the value of attribute description.
-
#entity_id ⇒ Object
Returns the value of attribute entity_id.
-
#entity_metadata ⇒ Object
Returns the value of attribute entity_metadata.
-
#entity_type ⇒ Object
1=STAGE_INSTANCE, 2=VOICE, 3=EXTERNAL.
-
#guild_id ⇒ Object
Returns the value of attribute guild_id.
-
#id ⇒ Object
Event snowflake ID.
-
#image ⇒ Object
Cover image hash; build URL via cdn.discordapp.com.
-
#name ⇒ Object
Returns the value of attribute name.
-
#privacy_level ⇒ Object
Always 2 (GUILD_ONLY) — Discord deprecated PUBLIC events.
-
#scheduled_end_time ⇒ Object
Required for external events; optional for voice/stage.
-
#scheduled_start_time ⇒ Object
Returns the value of attribute scheduled_start_time.
-
#status ⇒ Object
1=SCHEDULED, 2=ACTIVE, 3=COMPLETED, 4=CANCELED.
-
#user_count ⇒ Object
Number of members who RSVP'd.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.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.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ DiscordScheduledEvent
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ DiscordScheduledEvent
Initializes the object
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 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 145 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::DiscordScheduledEvent` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::DiscordScheduledEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'guild_id') self.guild_id = attributes[:'guild_id'] end if attributes.key?(:'channel_id') self.channel_id = attributes[:'channel_id'] end if attributes.key?(:'creator_id') self.creator_id = attributes[:'creator_id'] end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'scheduled_start_time') self.scheduled_start_time = attributes[:'scheduled_start_time'] end if attributes.key?(:'scheduled_end_time') self.scheduled_end_time = attributes[:'scheduled_end_time'] end if attributes.key?(:'privacy_level') self.privacy_level = attributes[:'privacy_level'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'entity_type') self.entity_type = attributes[:'entity_type'] end if attributes.key?(:'entity_id') self.entity_id = attributes[:'entity_id'] end if attributes.key?(:'entity_metadata') self. = attributes[:'entity_metadata'] end if attributes.key?(:'user_count') self.user_count = attributes[:'user_count'] end if attributes.key?(:'image') self.image = attributes[:'image'] end end |
Instance Attribute Details
#channel_id ⇒ Object
Voice/stage channel ID; null for external events.
25 26 27 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 25 def channel_id @channel_id end |
#creator_id ⇒ Object
Returns the value of attribute creator_id.
27 28 29 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 27 def creator_id @creator_id end |
#description ⇒ Object
Returns the value of attribute description.
31 32 33 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 31 def description @description end |
#entity_id ⇒ Object
Returns the value of attribute entity_id.
47 48 49 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 47 def entity_id @entity_id end |
#entity_metadata ⇒ Object
Returns the value of attribute entity_metadata.
49 50 51 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 49 def @entity_metadata end |
#entity_type ⇒ Object
1=STAGE_INSTANCE, 2=VOICE, 3=EXTERNAL
45 46 47 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 45 def entity_type @entity_type end |
#guild_id ⇒ Object
Returns the value of attribute guild_id.
22 23 24 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 22 def guild_id @guild_id end |
#id ⇒ Object
Event snowflake ID
20 21 22 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 20 def id @id end |
#image ⇒ Object
Cover image hash; build URL via cdn.discordapp.com.
55 56 57 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 55 def image @image end |
#name ⇒ Object
Returns the value of attribute name.
29 30 31 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 29 def name @name end |
#privacy_level ⇒ Object
Always 2 (GUILD_ONLY) — Discord deprecated PUBLIC events.
39 40 41 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 39 def privacy_level @privacy_level end |
#scheduled_end_time ⇒ Object
Required for external events; optional for voice/stage.
36 37 38 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 36 def scheduled_end_time @scheduled_end_time end |
#scheduled_start_time ⇒ Object
Returns the value of attribute scheduled_start_time.
33 34 35 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 33 def scheduled_start_time @scheduled_start_time end |
#status ⇒ Object
1=SCHEDULED, 2=ACTIVE, 3=COMPLETED, 4=CANCELED
42 43 44 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 42 def status @status end |
#user_count ⇒ Object
Number of members who RSVP'd. Only present when withUserCount=true on list.
52 53 54 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 52 def user_count @user_count end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
101 102 103 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 101 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
106 107 108 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 106 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 80 def self.attribute_map { :'id' => :'id', :'guild_id' => :'guild_id', :'channel_id' => :'channel_id', :'creator_id' => :'creator_id', :'name' => :'name', :'description' => :'description', :'scheduled_start_time' => :'scheduled_start_time', :'scheduled_end_time' => :'scheduled_end_time', :'privacy_level' => :'privacy_level', :'status' => :'status', :'entity_type' => :'entity_type', :'entity_id' => :'entity_id', :'entity_metadata' => :'entity_metadata', :'user_count' => :'user_count', :'image' => :'image' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 308 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
132 133 134 135 136 137 138 139 140 141 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 132 def self.openapi_nullable Set.new([ :'channel_id', :'creator_id', :'description', :'scheduled_end_time', :'entity_id', :'image' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 111 def self.openapi_types { :'id' => :'String', :'guild_id' => :'String', :'channel_id' => :'String', :'creator_id' => :'String', :'name' => :'String', :'description' => :'String', :'scheduled_start_time' => :'Time', :'scheduled_end_time' => :'Time', :'privacy_level' => :'Integer', :'status' => :'Integer', :'entity_type' => :'Integer', :'entity_id' => :'String', :'entity_metadata' => :'DiscordScheduledEventEntityMetadata', :'user_count' => :'Integer', :'image' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 273 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && guild_id == o.guild_id && channel_id == o.channel_id && creator_id == o.creator_id && name == o.name && description == o.description && scheduled_start_time == o.scheduled_start_time && scheduled_end_time == o.scheduled_end_time && privacy_level == o.privacy_level && status == o.status && entity_type == o.entity_type && entity_id == o.entity_id && == o. && user_count == o.user_count && image == o.image end |
#eql?(o) ⇒ Boolean
295 296 297 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 295 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
301 302 303 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 301 def hash [id, guild_id, channel_id, creator_id, name, description, scheduled_start_time, scheduled_end_time, privacy_level, status, entity_type, entity_id, , user_count, image].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
222 223 224 225 226 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 222 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 330 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 |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
230 231 232 233 234 235 236 237 238 239 |
# File 'lib/zernio-sdk/models/discord_scheduled_event.rb', line 230 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' privacy_level_validator = EnumAttributeValidator.new('Integer', [2]) return false unless privacy_level_validator.valid?(@privacy_level) status_validator = EnumAttributeValidator.new('Integer', [1, 2, 3, 4]) return false unless status_validator.valid?(@status) entity_type_validator = EnumAttributeValidator.new('Integer', [1, 2, 3]) return false unless entity_type_validator.valid?(@entity_type) true end |