Class: FlatApi::Collection
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- FlatApi::Collection
- Defined in:
- lib/flat_api/models/collection.rb
Overview
Collection of scores
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#capabilities ⇒ Object
Returns the value of attribute capabilities.
-
#collaborators ⇒ Object
The list of the collaborators of the collection.
-
#collections ⇒ Object
The List of parent collections, which includes all the collections this score is included.
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#creation_date ⇒ Object
The date when the collection was created.
-
#html_url ⇒ Object
The url where the collection can be viewed in a web browser.
-
#id ⇒ Object
Unique identifier of the collection.
-
#is_pinned ⇒ Object
Whether the collection is pinned by the owner.
-
#label_key ⇒ Object
Product-specific translation key for the collection type.
-
#modification_date ⇒ Object
The date when the collection was last modified.
-
#organization ⇒ Object
If the score has been created in an organization, the identifier of this organization.
-
#privacy ⇒ Object
Returns the value of attribute privacy.
-
#rights ⇒ Object
Returns the value of attribute rights.
-
#sharing_key ⇒ Object
The private sharing key of the collection (available when the
privacymode is set toprivateLink). -
#title ⇒ Object
The title of the collection.
-
#type ⇒ Object
Returns the value of attribute type.
-
#user ⇒ Object
Returns the value of attribute user.
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 = {}) ⇒ Collection
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 = {}) ⇒ Collection
Initializes the object
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 255 256 257 258 259 |
# File 'lib/flat_api/models/collection.rb', line 154 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `FlatApi::Collection` 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 `FlatApi::Collection`. 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'] else self.id = nil end if attributes.key?(:'title') self.title = attributes[:'title'] else self.title = nil end if attributes.key?(:'html_url') self.html_url = attributes[:'html_url'] else self.html_url = nil end if attributes.key?(:'type') self.type = attributes[:'type'] else self.type = nil end if attributes.key?(:'label_key') self.label_key = attributes[:'label_key'] end if attributes.key?(:'privacy') self.privacy = attributes[:'privacy'] else self.privacy = 'private' end if attributes.key?(:'sharing_key') self.sharing_key = attributes[:'sharing_key'] end if attributes.key?(:'app') self.app = attributes[:'app'] end if attributes.key?(:'creation_date') self.creation_date = attributes[:'creation_date'] else self.creation_date = nil end if attributes.key?(:'modification_date') self.modification_date = attributes[:'modification_date'] end if attributes.key?(:'user') self.user = attributes[:'user'] end if attributes.key?(:'organization') self.organization = attributes[:'organization'] end if attributes.key?(:'rights') self.rights = attributes[:'rights'] end if attributes.key?(:'collaborators') if (value = attributes[:'collaborators']).is_a?(Array) self.collaborators = value end end if attributes.key?(:'is_pinned') self.is_pinned = attributes[:'is_pinned'] end if attributes.key?(:'contents') self.contents = attributes[:'contents'] else self.contents = nil end if attributes.key?(:'capabilities') self.capabilities = attributes[:'capabilities'] else self.capabilities = nil end if attributes.key?(:'collections') if (value = attributes[:'collections']).is_a?(Array) self.collections = value end end end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
38 39 40 |
# File 'lib/flat_api/models/collection.rb', line 38 def app @app end |
#capabilities ⇒ Object
Returns the value of attribute capabilities.
61 62 63 |
# File 'lib/flat_api/models/collection.rb', line 61 def capabilities @capabilities end |
#collaborators ⇒ Object
The list of the collaborators of the collection
54 55 56 |
# File 'lib/flat_api/models/collection.rb', line 54 def collaborators @collaborators end |
#collections ⇒ Object
The List of parent collections, which includes all the collections this score is included. Please note that you might not have access to all of them.
64 65 66 |
# File 'lib/flat_api/models/collection.rb', line 64 def collections @collections end |
#contents ⇒ Object
Returns the value of attribute contents.
59 60 61 |
# File 'lib/flat_api/models/collection.rb', line 59 def contents @contents end |
#creation_date ⇒ Object
The date when the collection was created
41 42 43 |
# File 'lib/flat_api/models/collection.rb', line 41 def creation_date @creation_date end |
#html_url ⇒ Object
The url where the collection can be viewed in a web browser
26 27 28 |
# File 'lib/flat_api/models/collection.rb', line 26 def html_url @html_url end |
#id ⇒ Object
Unique identifier of the collection
20 21 22 |
# File 'lib/flat_api/models/collection.rb', line 20 def id @id end |
#is_pinned ⇒ Object
Whether the collection is pinned by the owner
57 58 59 |
# File 'lib/flat_api/models/collection.rb', line 57 def is_pinned @is_pinned end |
#label_key ⇒ Object
Product-specific translation key for the collection type. Only set for specific collection types: * For regular type: playlist (Flat) or collection (Flat for Education) * For collaborations type: collaboration (Flat) or shared-scores (Flat for Education) Not set for other collection types.
31 32 33 |
# File 'lib/flat_api/models/collection.rb', line 31 def label_key @label_key end |
#modification_date ⇒ Object
The date when the collection was last modified
44 45 46 |
# File 'lib/flat_api/models/collection.rb', line 44 def modification_date @modification_date end |
#organization ⇒ Object
If the score has been created in an organization, the identifier of this organization.
49 50 51 |
# File 'lib/flat_api/models/collection.rb', line 49 def organization @organization end |
#privacy ⇒ Object
Returns the value of attribute privacy.
33 34 35 |
# File 'lib/flat_api/models/collection.rb', line 33 def privacy @privacy end |
#rights ⇒ Object
Returns the value of attribute rights.
51 52 53 |
# File 'lib/flat_api/models/collection.rb', line 51 def rights @rights end |
#sharing_key ⇒ Object
The private sharing key of the collection (available when the privacy mode is set to privateLink)
36 37 38 |
# File 'lib/flat_api/models/collection.rb', line 36 def sharing_key @sharing_key end |
#title ⇒ Object
The title of the collection
23 24 25 |
# File 'lib/flat_api/models/collection.rb', line 23 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
28 29 30 |
# File 'lib/flat_api/models/collection.rb', line 28 def type @type end |
#user ⇒ Object
Returns the value of attribute user.
46 47 48 |
# File 'lib/flat_api/models/collection.rb', line 46 def user @user end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
113 114 115 |
# File 'lib/flat_api/models/collection.rb', line 113 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
118 119 120 |
# File 'lib/flat_api/models/collection.rb', line 118 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/flat_api/models/collection.rb', line 89 def self.attribute_map { :'id' => :'id', :'title' => :'title', :'html_url' => :'htmlUrl', :'type' => :'type', :'label_key' => :'labelKey', :'privacy' => :'privacy', :'sharing_key' => :'sharingKey', :'app' => :'app', :'creation_date' => :'creationDate', :'modification_date' => :'modificationDate', :'user' => :'user', :'organization' => :'organization', :'rights' => :'rights', :'collaborators' => :'collaborators', :'is_pinned' => :'isPinned', :'contents' => :'contents', :'capabilities' => :'capabilities', :'collections' => :'collections' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/flat_api/models/collection.rb', line 436 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
147 148 149 150 |
# File 'lib/flat_api/models/collection.rb', line 147 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/flat_api/models/collection.rb', line 123 def self.openapi_types { :'id' => :'String', :'title' => :'String', :'html_url' => :'String', :'type' => :'CollectionType', :'label_key' => :'String', :'privacy' => :'CollectionPrivacy', :'sharing_key' => :'String', :'app' => :'CollectionApp', :'creation_date' => :'Time', :'modification_date' => :'Time', :'user' => :'UserPublicSummary', :'organization' => :'String', :'rights' => :'ResourceRights', :'collaborators' => :'Array<ResourceCollaborator>', :'is_pinned' => :'Boolean', :'contents' => :'CollectionContents', :'capabilities' => :'CollectionCapabilities', :'collections' => :'Array<String>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/flat_api/models/collection.rb', line 398 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && title == o.title && html_url == o.html_url && type == o.type && label_key == o.label_key && privacy == o.privacy && sharing_key == o.sharing_key && app == o.app && creation_date == o.creation_date && modification_date == o.modification_date && user == o.user && organization == o.organization && rights == o.rights && collaborators == o.collaborators && is_pinned == o.is_pinned && contents == o.contents && capabilities == o.capabilities && collections == o.collections end |
#eql?(o) ⇒ Boolean
423 424 425 |
# File 'lib/flat_api/models/collection.rb', line 423 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
429 430 431 |
# File 'lib/flat_api/models/collection.rb', line 429 def hash [id, title, html_url, type, label_key, privacy, sharing_key, app, creation_date, modification_date, user, organization, rights, collaborators, is_pinned, contents, capabilities, collections].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/flat_api/models/collection.rb', line 263 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 @title.nil? invalid_properties.push('invalid value for "title", title cannot be nil.') end if @html_url.nil? invalid_properties.push('invalid value for "html_url", html_url cannot be nil.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end if @privacy.nil? invalid_properties.push('invalid value for "privacy", privacy cannot be nil.') end if @creation_date.nil? invalid_properties.push('invalid value for "creation_date", creation_date cannot be nil.') end if @contents.nil? invalid_properties.push('invalid value for "contents", contents cannot be nil.') end if @capabilities.nil? invalid_properties.push('invalid value for "capabilities", capabilities cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/flat_api/models/collection.rb', line 458 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
303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/flat_api/models/collection.rb', line 303 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @title.nil? return false if @html_url.nil? return false if @type.nil? return false if @privacy.nil? return false if @creation_date.nil? return false if @contents.nil? return false if @capabilities.nil? true end |