Class: FlatApi::Assignment

Inherits:
ApiModelBase show all
Defined in:
lib/flat_api/models/assignment.rb

Overview

Assignment details

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Assignment

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/flat_api/models/assignment.rb', line 193

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `FlatApi::Assignment` 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::Assignment`. 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?(:'type')
    self.type = attributes[:'type']
  else
    self.type = nil
  end

  if attributes.key?(:'capabilities')
    self.capabilities = attributes[:'capabilities']
  else
    self.capabilities = nil
  end

  if attributes.key?(:'title')
    self.title = attributes[:'title']
  else
    self.title = nil
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'description_html')
    self.description_html = attributes[:'description_html']
  end

  if attributes.key?(:'teacher_instructions')
    self.teacher_instructions = attributes[:'teacher_instructions']
  end

  if attributes.key?(:'teacher_instructions_html')
    self.teacher_instructions_html = attributes[:'teacher_instructions_html']
  end

  if attributes.key?(:'cover')
    self.cover = attributes[:'cover']
  end

  if attributes.key?(:'cover_file')
    self.cover_file = attributes[:'cover_file']
  end

  if attributes.key?(:'attachments')
    if (value = attributes[:'attachments']).is_a?(Array)
      self.attachments = value
    end
  else
    self.attachments = nil
  end

  if attributes.key?(:'use_dedicated_attachments')
    self.use_dedicated_attachments = attributes[:'use_dedicated_attachments']
  end

  if attributes.key?(:'max_points')
    self.max_points = attributes[:'max_points']
  end

  if attributes.key?(:'release_grades')
    self.release_grades = attributes[:'release_grades']
  end

  if attributes.key?(:'shuffle_exercises')
    self.shuffle_exercises = attributes[:'shuffle_exercises']
  end

  if attributes.key?(:'toolset')
    self.toolset = attributes[:'toolset']
  end

  if attributes.key?(:'nb_playback_authorized')
    self.nb_playback_authorized = attributes[:'nb_playback_authorized']
  end

  if attributes.key?(:'restrict_play_note')
    self.restrict_play_note = attributes[:'restrict_play_note']
  end

  if attributes.key?(:'restrict_to_audio_tracks')
    self.restrict_to_audio_tracks = attributes[:'restrict_to_audio_tracks']
  end

  if attributes.key?(:'submission_students_mode')
    self.submission_students_mode = attributes[:'submission_students_mode']
  end

  if attributes.key?(:'recording_type')
    self.recording_type = attributes[:'recording_type']
  end

  if attributes.key?(:'allow_metronome')
    self.allow_metronome = attributes[:'allow_metronome']
  end

  if attributes.key?(:'allow_backing_track')
    self.allow_backing_track = attributes[:'allow_backing_track']
  end

  if attributes.key?(:'allow_speed_change')
    self.allow_speed_change = attributes[:'allow_speed_change']
  end

  if attributes.key?(:'free_record')
    self.free_record = attributes[:'free_record']
  end
end

Instance Attribute Details

#allow_backing_trackObject

For performance assignments: Enable students to listen to the accompaniment without their instrument part while they are playing. Only set when type is 'performance'.



83
84
85
# File 'lib/flat_api/models/assignment.rb', line 83

def allow_backing_track
  @allow_backing_track
end

#allow_metronomeObject

For performance assignments: Enable students to use the metronome while they are recording, helping them stay in time. Only set when type is 'performance'.



80
81
82
# File 'lib/flat_api/models/assignment.rb', line 80

def allow_metronome
  @allow_metronome
end

#allow_speed_changeObject

For performance assignments: whether students can adjust the playback speed of the score during recording. * true: Students can change the tempo/speed during practice and recording * false: Tempo is fixed to the original score tempo Only set when type is 'performance'.



86
87
88
# File 'lib/flat_api/models/assignment.rb', line 86

def allow_speed_change
  @allow_speed_change
end

#attachmentsObject

Reference material handed to the students with the assignment: scores, videos, links and Drive files. A score attached here is the one each student receives their own copy of.



48
49
50
# File 'lib/flat_api/models/assignment.rb', line 48

def attachments
  @attachments
end

#capabilitiesObject

Returns the value of attribute capabilities.



24
25
26
# File 'lib/flat_api/models/assignment.rb', line 24

def capabilities
  @capabilities
end

#coverObject

The URL of the cover to display



42
43
44
# File 'lib/flat_api/models/assignment.rb', line 42

def cover
  @cover
end

#cover_fileObject

The id of the cover to display



45
46
47
# File 'lib/flat_api/models/assignment.rb', line 45

def cover_file
  @cover_file
end

#descriptionObject

Student instructions and content of the assignment (plain text)



30
31
32
# File 'lib/flat_api/models/assignment.rb', line 30

def description
  @description
end

#description_htmlObject

HTML version of student instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs.



33
34
35
# File 'lib/flat_api/models/assignment.rb', line 33

def description_html
  @description_html
end

#free_recordObject

For performance assignments: "Free Record" mode. When true, no score is attached to the assignment. Students freely record a varied repertoire or an ensemble performance without being constrained by a single score's structure or duration, and all score-dependent options (playback, metronome, backtracking, speed control) are hidden. Only set when type is 'performance'.



89
90
91
# File 'lib/flat_api/models/assignment.rb', line 89

def free_record
  @free_record
end

#idObject

Unique identifier of the assignment



20
21
22
# File 'lib/flat_api/models/assignment.rb', line 20

def id
  @id
end

#max_pointsObject

If set, the grading will be enabled for the assignement



54
55
56
# File 'lib/flat_api/models/assignment.rb', line 54

def max_points
  @max_points
end

#nb_playback_authorizedObject

The number of playback authorized on the scores of the assignment.



66
67
68
# File 'lib/flat_api/models/assignment.rb', line 66

def nb_playback_authorized
  @nb_playback_authorized
end

#recording_typeObject

For performance assignments: recording type that will be either 'audio' or 'video'. * audio: Only audio will be required during the recording. * video: Camera will be required during the recording. Only set when type is 'performance'.



77
78
79
# File 'lib/flat_api/models/assignment.rb', line 77

def recording_type
  @recording_type
end

#release_gradesObject

For worksheets, how grading will work for the assignment: - If set to auto, the grades will be automatically released when the student submits the submissions - If set to manual, the grades will only be set as draftGrade and will be released when the teacher returns the submissions



57
58
59
# File 'lib/flat_api/models/assignment.rb', line 57

def release_grades
  @release_grades
end

#restrict_play_noteObject

Restrict the ability to get an audio feedback every time a student adds or selects a note.



69
70
71
# File 'lib/flat_api/models/assignment.rb', line 69

def restrict_play_note
  @restrict_play_note
end

#restrict_to_audio_tracksObject

Restrict the audio source to provided audio tracks on a score. Students won't be able to use the editor playback.



72
73
74
# File 'lib/flat_api/models/assignment.rb', line 72

def restrict_to_audio_tracks
  @restrict_to_audio_tracks
end

#shuffle_exercisesObject

Mixing worksheets exercises for each student



60
61
62
# File 'lib/flat_api/models/assignment.rb', line 60

def shuffle_exercises
  @shuffle_exercises
end

#submission_students_modeObject

Returns the value of attribute submission_students_mode.



74
75
76
# File 'lib/flat_api/models/assignment.rb', line 74

def submission_students_mode
  @submission_students_mode
end

#teacher_instructionsObject

Teacher-only instructions for this assignment. These instructions are only visible to teachers and are not returned when students view the assignment. If teacherInstructionsHtml is provided, this field will contain the plain text version for compatibility.



36
37
38
# File 'lib/flat_api/models/assignment.rb', line 36

def teacher_instructions
  @teacher_instructions
end

#teacher_instructions_htmlObject

HTML version of teacher-only instructions with rich text formatting. Supports the following HTML tags: p, br, strong, b, em, i, u, a, ul, ol, li, h1, h2, h3, img. Images are served as absolute http(s) URLs.



39
40
41
# File 'lib/flat_api/models/assignment.rb', line 39

def teacher_instructions_html
  @teacher_instructions_html
end

#titleObject

Title of the assignment



27
28
29
# File 'lib/flat_api/models/assignment.rb', line 27

def title
  @title
end

#toolsetObject

The id of the associated toolset



63
64
65
# File 'lib/flat_api/models/assignment.rb', line 63

def toolset
  @toolset
end

#typeObject

Returns the value of attribute type.



22
23
24
# File 'lib/flat_api/models/assignment.rb', line 22

def type
  @type
end

#use_dedicated_attachmentsObject

For all assignments created after 02/2023, all the underlying resources must be dedicated and stored in the assignment. This boolean indicates that this assignment only supports dedicated attachments.



51
52
53
# File 'lib/flat_api/models/assignment.rb', line 51

def use_dedicated_attachments
  @use_dedicated_attachments
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



145
146
147
# File 'lib/flat_api/models/assignment.rb', line 145

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



150
151
152
# File 'lib/flat_api/models/assignment.rb', line 150

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/flat_api/models/assignment.rb', line 114

def self.attribute_map
  {
    :'id' => :'id',
    :'type' => :'type',
    :'capabilities' => :'capabilities',
    :'title' => :'title',
    :'description' => :'description',
    :'description_html' => :'descriptionHtml',
    :'teacher_instructions' => :'teacherInstructions',
    :'teacher_instructions_html' => :'teacherInstructionsHtml',
    :'cover' => :'cover',
    :'cover_file' => :'coverFile',
    :'attachments' => :'attachments',
    :'use_dedicated_attachments' => :'useDedicatedAttachments',
    :'max_points' => :'maxPoints',
    :'release_grades' => :'releaseGrades',
    :'shuffle_exercises' => :'shuffleExercises',
    :'toolset' => :'toolset',
    :'nb_playback_authorized' => :'nbPlaybackAuthorized',
    :'restrict_play_note' => :'restrictPlayNote',
    :'restrict_to_audio_tracks' => :'restrictToAudioTracks',
    :'submission_students_mode' => :'submissionStudentsMode',
    :'recording_type' => :'recordingType',
    :'allow_metronome' => :'allowMetronome',
    :'allow_backing_track' => :'allowBackingTrack',
    :'allow_speed_change' => :'allowSpeedChange',
    :'free_record' => :'freeRecord'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/flat_api/models/assignment.rb', line 481

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_nullableObject

List of attributes with nullable: true



186
187
188
189
# File 'lib/flat_api/models/assignment.rb', line 186

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/flat_api/models/assignment.rb', line 155

def self.openapi_types
  {
    :'id' => :'String',
    :'type' => :'AssignmentType',
    :'capabilities' => :'AssignmentCapabilities',
    :'title' => :'String',
    :'description' => :'String',
    :'description_html' => :'String',
    :'teacher_instructions' => :'String',
    :'teacher_instructions_html' => :'String',
    :'cover' => :'String',
    :'cover_file' => :'String',
    :'attachments' => :'Array<MediaAttachment>',
    :'use_dedicated_attachments' => :'Boolean',
    :'max_points' => :'Float',
    :'release_grades' => :'String',
    :'shuffle_exercises' => :'Boolean',
    :'toolset' => :'String',
    :'nb_playback_authorized' => :'Float',
    :'restrict_play_note' => :'Boolean',
    :'restrict_to_audio_tracks' => :'Boolean',
    :'submission_students_mode' => :'AssignmentSubmissionStudentsMode',
    :'recording_type' => :'String',
    :'allow_metronome' => :'Boolean',
    :'allow_backing_track' => :'Boolean',
    :'allow_speed_change' => :'Boolean',
    :'free_record' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
463
464
# File 'lib/flat_api/models/assignment.rb', line 436

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      type == o.type &&
      capabilities == o.capabilities &&
      title == o.title &&
      description == o.description &&
      description_html == o.description_html &&
      teacher_instructions == o.teacher_instructions &&
      teacher_instructions_html == o.teacher_instructions_html &&
      cover == o.cover &&
      cover_file == o.cover_file &&
      attachments == o.attachments &&
      use_dedicated_attachments == o.use_dedicated_attachments &&
      max_points == o.max_points &&
      release_grades == o.release_grades &&
      shuffle_exercises == o.shuffle_exercises &&
      toolset == o.toolset &&
      nb_playback_authorized == o.nb_playback_authorized &&
      restrict_play_note == o.restrict_play_note &&
      restrict_to_audio_tracks == o.restrict_to_audio_tracks &&
      submission_students_mode == o.submission_students_mode &&
      recording_type == o.recording_type &&
      allow_metronome == o.allow_metronome &&
      allow_backing_track == o.allow_backing_track &&
      allow_speed_change == o.allow_speed_change &&
      free_record == o.free_record
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


468
469
470
# File 'lib/flat_api/models/assignment.rb', line 468

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



474
475
476
# File 'lib/flat_api/models/assignment.rb', line 474

def hash
  [id, type, capabilities, title, description, description_html, teacher_instructions, teacher_instructions_html, cover, cover_file, attachments, use_dedicated_attachments, max_points, release_grades, shuffle_exercises, toolset, nb_playback_authorized, restrict_play_note, restrict_to_audio_tracks, submission_students_mode, recording_type, allow_metronome, allow_backing_track, allow_speed_change, free_record].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/flat_api/models/assignment.rb', line 322

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 @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if @capabilities.nil?
    invalid_properties.push('invalid value for "capabilities", capabilities cannot be nil.')
  end

  if @title.nil?
    invalid_properties.push('invalid value for "title", title cannot be nil.')
  end

  if @attachments.nil?
    invalid_properties.push('invalid value for "attachments", attachments cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/flat_api/models/assignment.rb', line 503

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

Returns:

  • (Boolean)

    true if the model is valid



350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/flat_api/models/assignment.rb', line 350

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @type.nil?
  return false if @capabilities.nil?
  return false if @title.nil?
  return false if @attachments.nil?
  release_grades_validator = EnumAttributeValidator.new('String', ["auto", "manual"])
  return false unless release_grades_validator.valid?(@release_grades)
  recording_type_validator = EnumAttributeValidator.new('String', ["audio", "video"])
  return false unless recording_type_validator.valid?(@recording_type)
  true
end