Class: SwaggerClient::MediaAttachment
- Inherits:
-
Object
- Object
- SwaggerClient::MediaAttachment
- Defined in:
- lib/swagger_client/models/media_attachment.rb
Overview
Media attachment. The API will automatically resolve the details, oEmbed, and media available if possible and return them in this object
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#author_name ⇒ Object
The resolved author name of the attachment.
-
#author_url ⇒ Object
The resolved author url of the attachment.
-
#correct ⇒ Object
If the attachment is an exercise question, this state will describe if it is correct or not.For exercise assignments only.
-
#description ⇒ Object
The resolved description of the attachment.
-
#html ⇒ Object
If the attachment type is ‘rich` or `video`, the HTML code of the media to display.
-
#html_height ⇒ Object
If the ‘html` is available, the height of the widget.
-
#html_width ⇒ Object
If the ‘html` is available, the width of the widget.
-
#revision ⇒ Object
An unique revision identifier of a score.
-
#score ⇒ Object
An unique Flat score identifier.
-
#sharing_mode ⇒ Object
Returns the value of attribute sharing_mode.
-
#thumbnail_height ⇒ Object
If the ‘thumbnailUrl` is available, the width of the thumbnail.
-
#thumbnail_url ⇒ Object
If the attachment type is ‘rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment.
-
#thumbnail_width ⇒ Object
If the ‘thumbnailUrl` is available, the width of the thumbnail.
-
#title ⇒ Object
The resolved title of the attachment.
-
#type ⇒ Object
The type of the assignment resolved: * ‘rich`, `photo`, `video` are attachment types that are automatically resolved from a `link` attachment.
-
#url ⇒ Object
The url of the attachment.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ MediaAttachment
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 = {}) ⇒ MediaAttachment
Initializes the object
133 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 |
# File 'lib/swagger_client/models/media_attachment.rb', line 133 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'type') self.type = attributes[:'type'] end if attributes.has_key?(:'score') self.score = attributes[:'score'] end if attributes.has_key?(:'revision') self.revision = attributes[:'revision'] end if attributes.has_key?(:'correct') self.correct = attributes[:'correct'] end if attributes.has_key?(:'sharingMode') self.sharing_mode = attributes[:'sharingMode'] end if attributes.has_key?(:'title') self.title = attributes[:'title'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'html') self.html = attributes[:'html'] end if attributes.has_key?(:'htmlWidth') self.html_width = attributes[:'htmlWidth'] end if attributes.has_key?(:'htmlHeight') self.html_height = attributes[:'htmlHeight'] end if attributes.has_key?(:'url') self.url = attributes[:'url'] end if attributes.has_key?(:'thumbnailUrl') self.thumbnail_url = attributes[:'thumbnailUrl'] end if attributes.has_key?(:'thumbnailWidth') self.thumbnail_width = attributes[:'thumbnailWidth'] end if attributes.has_key?(:'thumbnailHeight') self.thumbnail_height = attributes[:'thumbnailHeight'] end if attributes.has_key?(:'authorName') self. = attributes[:'authorName'] end if attributes.has_key?(:'authorUrl') self. = attributes[:'authorUrl'] end end |
Instance Attribute Details
#author_name ⇒ Object
The resolved author name of the attachment
60 61 62 |
# File 'lib/swagger_client/models/media_attachment.rb', line 60 def @author_name end |
#author_url ⇒ Object
The resolved author url of the attachment
63 64 65 |
# File 'lib/swagger_client/models/media_attachment.rb', line 63 def @author_url end |
#correct ⇒ Object
If the attachment is an exercise question, this state will describe if it is correct or not.For exercise assignments only.
28 29 30 |
# File 'lib/swagger_client/models/media_attachment.rb', line 28 def correct @correct end |
#description ⇒ Object
The resolved description of the attachment
36 37 38 |
# File 'lib/swagger_client/models/media_attachment.rb', line 36 def description @description end |
#html ⇒ Object
If the attachment type is ‘rich` or `video`, the HTML code of the media to display
39 40 41 |
# File 'lib/swagger_client/models/media_attachment.rb', line 39 def html @html end |
#html_height ⇒ Object
If the ‘html` is available, the height of the widget
45 46 47 |
# File 'lib/swagger_client/models/media_attachment.rb', line 45 def html_height @html_height end |
#html_width ⇒ Object
If the ‘html` is available, the width of the widget
42 43 44 |
# File 'lib/swagger_client/models/media_attachment.rb', line 42 def html_width @html_width end |
#revision ⇒ Object
An unique revision identifier of a score
25 26 27 |
# File 'lib/swagger_client/models/media_attachment.rb', line 25 def revision @revision end |
#score ⇒ Object
An unique Flat score identifier
22 23 24 |
# File 'lib/swagger_client/models/media_attachment.rb', line 22 def score @score end |
#sharing_mode ⇒ Object
Returns the value of attribute sharing_mode.
30 31 32 |
# File 'lib/swagger_client/models/media_attachment.rb', line 30 def sharing_mode @sharing_mode end |
#thumbnail_height ⇒ Object
If the ‘thumbnailUrl` is available, the width of the thumbnail
57 58 59 |
# File 'lib/swagger_client/models/media_attachment.rb', line 57 def thumbnail_height @thumbnail_height end |
#thumbnail_url ⇒ Object
If the attachment type is ‘rich`, `video`, `photo` or `link`, a displayable thumbnail for this attachment
51 52 53 |
# File 'lib/swagger_client/models/media_attachment.rb', line 51 def thumbnail_url @thumbnail_url end |
#thumbnail_width ⇒ Object
If the ‘thumbnailUrl` is available, the width of the thumbnail
54 55 56 |
# File 'lib/swagger_client/models/media_attachment.rb', line 54 def thumbnail_width @thumbnail_width end |
#title ⇒ Object
The resolved title of the attachment
33 34 35 |
# File 'lib/swagger_client/models/media_attachment.rb', line 33 def title @title end |
#type ⇒ Object
The type of the assignment resolved: * ‘rich`, `photo`, `video` are attachment types that are automatically resolved from a `link` attachment. * A `flat` attachment is a score document where the unique identifier will be specified in the `score` property. Its sharing mode will be provided in the `sharingMode` property.
19 20 21 |
# File 'lib/swagger_client/models/media_attachment.rb', line 19 def type @type end |
#url ⇒ Object
The url of the attachment
48 49 50 |
# File 'lib/swagger_client/models/media_attachment.rb', line 48 def url @url end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/swagger_client/models/media_attachment.rb', line 88 def self.attribute_map { :'type' => :'type', :'score' => :'score', :'revision' => :'revision', :'correct' => :'correct', :'sharing_mode' => :'sharingMode', :'title' => :'title', :'description' => :'description', :'html' => :'html', :'html_width' => :'htmlWidth', :'html_height' => :'htmlHeight', :'url' => :'url', :'thumbnail_url' => :'thumbnailUrl', :'thumbnail_width' => :'thumbnailWidth', :'thumbnail_height' => :'thumbnailHeight', :'author_name' => :'authorName', :'author_url' => :'authorUrl' } end |
.swagger_types ⇒ Object
Attribute type mapping.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/swagger_client/models/media_attachment.rb', line 110 def self.swagger_types { :'type' => :'String', :'score' => :'String', :'revision' => :'String', :'correct' => :'BOOLEAN', :'sharing_mode' => :'MediaScoreSharingMode', :'title' => :'String', :'description' => :'String', :'html' => :'String', :'html_width' => :'String', :'html_height' => :'String', :'url' => :'String', :'thumbnail_url' => :'String', :'thumbnail_width' => :'String', :'thumbnail_height' => :'String', :'author_name' => :'String', :'author_url' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/swagger_client/models/media_attachment.rb', line 232 def ==(o) return true if self.equal?(o) self.class == o.class && type == o.type && score == o.score && revision == o.revision && correct == o.correct && sharing_mode == o.sharing_mode && title == o.title && description == o.description && html == o.html && html_width == o.html_width && html_height == o.html_height && url == o.url && thumbnail_url == o.thumbnail_url && thumbnail_width == o.thumbnail_width && thumbnail_height == o.thumbnail_height && == o. && == o. end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 |
# File 'lib/swagger_client/models/media_attachment.rb', line 289 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.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 temp_model = SwaggerClient.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/swagger_client/models/media_attachment.rb', line 355 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 |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/swagger_client/models/media_attachment.rb', line 268 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
255 256 257 |
# File 'lib/swagger_client/models/media_attachment.rb', line 255 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
261 262 263 |
# File 'lib/swagger_client/models/media_attachment.rb', line 261 def hash [type, score, revision, correct, sharing_mode, title, description, html, html_width, html_height, url, thumbnail_url, thumbnail_width, thumbnail_height, , ].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
207 208 209 210 |
# File 'lib/swagger_client/models/media_attachment.rb', line 207 def list_invalid_properties invalid_properties = Array.new return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
335 336 337 |
# File 'lib/swagger_client/models/media_attachment.rb', line 335 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
341 342 343 344 345 346 347 348 349 |
# File 'lib/swagger_client/models/media_attachment.rb', line 341 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
329 330 331 |
# File 'lib/swagger_client/models/media_attachment.rb', line 329 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
214 215 216 217 218 |
# File 'lib/swagger_client/models/media_attachment.rb', line 214 def valid? type_validator = EnumAttributeValidator.new('String', ["rich", "photo", "video", "link", "flat", "exercise"]) return false unless type_validator.valid?(@type) return true end |