Class: FlatApi::ScoreDetails
- Inherits:
-
Object
- Object
- FlatApi::ScoreDetails
- Defined in:
- lib/flat_api/models/score_details.rb
Overview
The score and all its details
Instance Attribute Summary collapse
-
#collaborators ⇒ Object
The list of the collaborators of the score.
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#composer ⇒ Object
Composer of the score.
-
#creation_date ⇒ Object
The date when the score was created.
-
#creation_type ⇒ Object
Returns the value of attribute creation_type.
-
#description ⇒ Object
Description of the creation.
-
#duration_time ⇒ Object
In seconds, an approximative duration of the score.
-
#google_drive_file_id ⇒ Object
If the user uses Google Drive and the score exists on Google Drive, this field will contain the unique identifier of the Flat score on Google Drive.
-
#html_url ⇒ Object
The url where the score can be viewed in a web browser.
-
#id ⇒ Object
The unique identifier of the score.
-
#instruments ⇒ Object
An array of the instrument identifiers used in the last version of the score.
-
#license ⇒ Object
Returns the value of attribute license.
-
#license_text ⇒ Object
Additional license text written on the exported/printed score.
-
#likes ⇒ Object
Returns the value of attribute likes.
-
#lyricist ⇒ Object
Lyricist of the score.
-
#main_tempo_qpm ⇒ Object
The main tempo of the score (in QPM).
-
#modification_date ⇒ Object
The date of the last revision of the score.
-
#number_measures ⇒ Object
The number of measures in the score.
-
#organization ⇒ Object
If the score has been created in an organization, the identifier of this organization.
-
#parent_score ⇒ Object
If the score has been forked, the unique identifier of the parent score.
-
#privacy ⇒ Object
Returns the value of attribute privacy.
-
#publication_date ⇒ Object
The date when the score was published on Flat.
-
#rights ⇒ Object
Returns the value of attribute rights.
-
#sharing_key ⇒ Object
The private sharing key of the score (available when the ‘privacy` mode is set to `privateLink`).
-
#subtitle ⇒ Object
Subtitle of the score.
-
#tags ⇒ Object
Tags describing the score.
-
#title ⇒ Object
The title of the score.
-
#user ⇒ Object
Returns the value of attribute user.
-
#views ⇒ Object
Returns the value of attribute views.
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 = {}) ⇒ ScoreDetails
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 = {}) ⇒ ScoreDetails
Initializes the object
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 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 |
# File 'lib/flat_api/models/score_details.rb', line 170 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?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'sharingKey') self.sharing_key = attributes[:'sharingKey'] end if attributes.has_key?(:'title') self.title = attributes[:'title'] end if attributes.has_key?(:'privacy') self.privacy = attributes[:'privacy'] end if attributes.has_key?(:'user') self.user = attributes[:'user'] end if attributes.has_key?(:'htmlUrl') self.html_url = attributes[:'htmlUrl'] end if attributes.has_key?(:'subtitle') self.subtitle = attributes[:'subtitle'] end if attributes.has_key?(:'lyricist') self.lyricist = attributes[:'lyricist'] end if attributes.has_key?(:'composer') self.composer = attributes[:'composer'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self. = value end end if attributes.has_key?(:'creationType') self.creation_type = attributes[:'creationType'] end if attributes.has_key?(:'license') self.license = attributes[:'license'] end if attributes.has_key?(:'licenseText') self.license_text = attributes[:'licenseText'] end if attributes.has_key?(:'durationTime') self.duration_time = attributes[:'durationTime'] end if attributes.has_key?(:'numberMeasures') self.number_measures = attributes[:'numberMeasures'] end if attributes.has_key?(:'mainTempoQpm') self.main_tempo_qpm = attributes[:'mainTempoQpm'] end if attributes.has_key?(:'rights') self.rights = attributes[:'rights'] end if attributes.has_key?(:'collaborators') if (value = attributes[:'collaborators']).is_a?(Array) self.collaborators = value end end if attributes.has_key?(:'creationDate') self.creation_date = attributes[:'creationDate'] end if attributes.has_key?(:'modificationDate') self.modification_date = attributes[:'modificationDate'] end if attributes.has_key?(:'publicationDate') self.publication_date = attributes[:'publicationDate'] end if attributes.has_key?(:'organization') self.organization = attributes[:'organization'] end if attributes.has_key?(:'parentScore') self.parent_score = attributes[:'parentScore'] end if attributes.has_key?(:'instruments') if (value = attributes[:'instruments']).is_a?(Array) self.instruments = value end end if attributes.has_key?(:'googleDriveFileId') self.google_drive_file_id = attributes[:'googleDriveFileId'] end if attributes.has_key?(:'likes') self.likes = attributes[:'likes'] end if attributes.has_key?(:'comments') self.comments = attributes[:'comments'] end if attributes.has_key?(:'views') self.views = attributes[:'views'] end end |
Instance Attribute Details
#collaborators ⇒ Object
The list of the collaborators of the score
68 69 70 |
# File 'lib/flat_api/models/score_details.rb', line 68 def collaborators @collaborators end |
#comments ⇒ Object
Returns the value of attribute comments.
93 94 95 |
# File 'lib/flat_api/models/score_details.rb', line 93 def comments @comments end |
#composer ⇒ Object
Composer of the score
41 42 43 |
# File 'lib/flat_api/models/score_details.rb', line 41 def composer @composer end |
#creation_date ⇒ Object
The date when the score was created
71 72 73 |
# File 'lib/flat_api/models/score_details.rb', line 71 def creation_date @creation_date end |
#creation_type ⇒ Object
Returns the value of attribute creation_type.
49 50 51 |
# File 'lib/flat_api/models/score_details.rb', line 49 def creation_type @creation_type end |
#description ⇒ Object
Description of the creation
44 45 46 |
# File 'lib/flat_api/models/score_details.rb', line 44 def description @description end |
#duration_time ⇒ Object
In seconds, an approximative duration of the score
57 58 59 |
# File 'lib/flat_api/models/score_details.rb', line 57 def duration_time @duration_time end |
#google_drive_file_id ⇒ Object
If the user uses Google Drive and the score exists on Google Drive, this field will contain the unique identifier of the Flat score on Google Drive. You can access the document using the url: ‘drive.google.com/open?id=googleDriveFileId`
89 90 91 |
# File 'lib/flat_api/models/score_details.rb', line 89 def google_drive_file_id @google_drive_file_id end |
#html_url ⇒ Object
The url where the score can be viewed in a web browser
32 33 34 |
# File 'lib/flat_api/models/score_details.rb', line 32 def html_url @html_url end |
#id ⇒ Object
The unique identifier of the score
19 20 21 |
# File 'lib/flat_api/models/score_details.rb', line 19 def id @id end |
#instruments ⇒ Object
An array of the instrument identifiers used in the last version of the score. This is mainly used to display a list of the instruments in the Flat’s UI or instruments icons. The format of the strings is ‘instrument-group.instrument-id`.
86 87 88 |
# File 'lib/flat_api/models/score_details.rb', line 86 def instruments @instruments end |
#license ⇒ Object
Returns the value of attribute license.
51 52 53 |
# File 'lib/flat_api/models/score_details.rb', line 51 def license @license end |
#license_text ⇒ Object
Additional license text written on the exported/printed score
54 55 56 |
# File 'lib/flat_api/models/score_details.rb', line 54 def license_text @license_text end |
#likes ⇒ Object
Returns the value of attribute likes.
91 92 93 |
# File 'lib/flat_api/models/score_details.rb', line 91 def likes @likes end |
#lyricist ⇒ Object
Lyricist of the score
38 39 40 |
# File 'lib/flat_api/models/score_details.rb', line 38 def lyricist @lyricist end |
#main_tempo_qpm ⇒ Object
The main tempo of the score (in QPM)
63 64 65 |
# File 'lib/flat_api/models/score_details.rb', line 63 def main_tempo_qpm @main_tempo_qpm end |
#modification_date ⇒ Object
The date of the last revision of the score
74 75 76 |
# File 'lib/flat_api/models/score_details.rb', line 74 def modification_date @modification_date end |
#number_measures ⇒ Object
The number of measures in the score
60 61 62 |
# File 'lib/flat_api/models/score_details.rb', line 60 def number_measures @number_measures end |
#organization ⇒ Object
If the score has been created in an organization, the identifier of this organization. This property is especially used with the score privacy ‘organizationPublic`.
80 81 82 |
# File 'lib/flat_api/models/score_details.rb', line 80 def organization @organization end |
#parent_score ⇒ Object
If the score has been forked, the unique identifier of the parent score.
83 84 85 |
# File 'lib/flat_api/models/score_details.rb', line 83 def parent_score @parent_score end |
#privacy ⇒ Object
Returns the value of attribute privacy.
27 28 29 |
# File 'lib/flat_api/models/score_details.rb', line 27 def privacy @privacy end |
#publication_date ⇒ Object
The date when the score was published on Flat
77 78 79 |
# File 'lib/flat_api/models/score_details.rb', line 77 def publication_date @publication_date end |
#rights ⇒ Object
Returns the value of attribute rights.
65 66 67 |
# File 'lib/flat_api/models/score_details.rb', line 65 def rights @rights end |
#sharing_key ⇒ Object
The private sharing key of the score (available when the ‘privacy` mode is set to `privateLink`)
22 23 24 |
# File 'lib/flat_api/models/score_details.rb', line 22 def sharing_key @sharing_key end |
#subtitle ⇒ Object
Subtitle of the score
35 36 37 |
# File 'lib/flat_api/models/score_details.rb', line 35 def subtitle @subtitle end |
#tags ⇒ Object
Tags describing the score
47 48 49 |
# File 'lib/flat_api/models/score_details.rb', line 47 def @tags end |
#title ⇒ Object
The title of the score
25 26 27 |
# File 'lib/flat_api/models/score_details.rb', line 25 def title @title end |
#user ⇒ Object
Returns the value of attribute user.
29 30 31 |
# File 'lib/flat_api/models/score_details.rb', line 29 def user @user end |
#views ⇒ Object
Returns the value of attribute views.
95 96 97 |
# File 'lib/flat_api/models/score_details.rb', line 95 def views @views end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/flat_api/models/score_details.rb', line 99 def self.attribute_map { :'id' => :'id', :'sharing_key' => :'sharingKey', :'title' => :'title', :'privacy' => :'privacy', :'user' => :'user', :'html_url' => :'htmlUrl', :'subtitle' => :'subtitle', :'lyricist' => :'lyricist', :'composer' => :'composer', :'description' => :'description', :'tags' => :'tags', :'creation_type' => :'creationType', :'license' => :'license', :'license_text' => :'licenseText', :'duration_time' => :'durationTime', :'number_measures' => :'numberMeasures', :'main_tempo_qpm' => :'mainTempoQpm', :'rights' => :'rights', :'collaborators' => :'collaborators', :'creation_date' => :'creationDate', :'modification_date' => :'modificationDate', :'publication_date' => :'publicationDate', :'organization' => :'organization', :'parent_score' => :'parentScore', :'instruments' => :'instruments', :'google_drive_file_id' => :'googleDriveFileId', :'likes' => :'likes', :'comments' => :'comments', :'views' => :'views' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/flat_api/models/score_details.rb', line 134 def self.swagger_types { :'id' => :'String', :'sharing_key' => :'String', :'title' => :'String', :'privacy' => :'ScorePrivacy', :'user' => :'UserPublicSummary', :'html_url' => :'String', :'subtitle' => :'String', :'lyricist' => :'String', :'composer' => :'String', :'description' => :'String', :'tags' => :'Array<String>', :'creation_type' => :'ScoreCreationType', :'license' => :'ScoreLicense', :'license_text' => :'String', :'duration_time' => :'Integer', :'number_measures' => :'Integer', :'main_tempo_qpm' => :'Integer', :'rights' => :'ScoreRights', :'collaborators' => :'Array<ScoreCollaborator>', :'creation_date' => :'DateTime', :'modification_date' => :'DateTime', :'publication_date' => :'DateTime', :'organization' => :'String', :'parent_score' => :'String', :'instruments' => :'Array<String>', :'google_drive_file_id' => :'String', :'likes' => :'ScoreLikesCounts', :'comments' => :'ScoreCommentsCounts', :'views' => :'ScoreViewsCounts' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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 |
# File 'lib/flat_api/models/score_details.rb', line 315 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && sharing_key == o.sharing_key && title == o.title && privacy == o.privacy && user == o.user && html_url == o.html_url && subtitle == o.subtitle && lyricist == o.lyricist && composer == o.composer && description == o.description && == o. && creation_type == o.creation_type && license == o.license && license_text == o.license_text && duration_time == o.duration_time && number_measures == o.number_measures && main_tempo_qpm == o.main_tempo_qpm && rights == o.rights && collaborators == o.collaborators && creation_date == o.creation_date && modification_date == o.modification_date && publication_date == o.publication_date && organization == o.organization && parent_score == o.parent_score && instruments == o.instruments && google_drive_file_id == o.google_drive_file_id && likes == o.likes && comments == o.comments && views == o.views end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 |
# File 'lib/flat_api/models/score_details.rb', line 385 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 = FlatApi.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
451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/flat_api/models/score_details.rb', line 451 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
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/flat_api/models/score_details.rb', line 364 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
351 352 353 |
# File 'lib/flat_api/models/score_details.rb', line 351 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
357 358 359 |
# File 'lib/flat_api/models/score_details.rb', line 357 def hash [id, sharing_key, title, privacy, user, html_url, subtitle, lyricist, composer, description, , creation_type, license, license_text, duration_time, number_measures, main_tempo_qpm, rights, collaborators, creation_date, modification_date, publication_date, organization, parent_score, instruments, google_drive_file_id, likes, comments, views].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
302 303 304 305 |
# File 'lib/flat_api/models/score_details.rb', line 302 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)
431 432 433 |
# File 'lib/flat_api/models/score_details.rb', line 431 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
437 438 439 440 441 442 443 444 445 |
# File 'lib/flat_api/models/score_details.rb', line 437 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
425 426 427 |
# File 'lib/flat_api/models/score_details.rb', line 425 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
309 310 311 |
# File 'lib/flat_api/models/score_details.rb', line 309 def valid? return true end |