Class: FlatApi::AssignmentUpdate

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

Overview

Assignment Resource Editing

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 = {}) ⇒ AssignmentUpdate

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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

  if attributes.key?(:'title')
    self.title = attributes[:'title']
  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?(:'attachments')
    if (value = attributes[:'attachments']).is_a?(Array)
      self.attachments = value
    end
  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?(:'toolset')
    self.toolset = attributes[:'toolset']
  end

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

  if attributes.key?(:'cover')
    self.cover = attributes[:'cover']
  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?(:'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'.



75
76
77
# File 'lib/flat_api/models/assignment_update.rb', line 75

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'.



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

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'.



78
79
80
# File 'lib/flat_api/models/assignment_update.rb', line 78

def allow_speed_change
  @allow_speed_change
end

#attachmentsObject

The complete attachment list. Omitting this property on an update leaves the existing attachments alone; sending it replaces them. Dropping a dedicated score from the list deletes the students' copies of it, so send the full set you want to keep rather than only the additions. Duplicates, judged by url, score, worksheet or googleDriveFileId, are discarded silently, and exceeding the per-assignment limit fails with ASSIGNMENT_ATTACHMENTS_LIMIT.



37
38
39
# File 'lib/flat_api/models/assignment_update.rb', line 37

def attachments
  @attachments
end

#coverObject

The URL of the cover to display



55
56
57
# File 'lib/flat_api/models/assignment_update.rb', line 55

def cover
  @cover
end

#cover_fileObject

The id of the cover to display



52
53
54
# File 'lib/flat_api/models/assignment_update.rb', line 52

def cover_file
  @cover_file
end

#descriptionObject

Student instructions and content of the assignment (plain text)



25
26
27
# File 'lib/flat_api/models/assignment_update.rb', line 25

def description
  @description
end

#description_htmlObject

HTML version of student instructions. Pasted images may be sent as inline base64 data: URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility.



28
29
30
# File 'lib/flat_api/models/assignment_update.rb', line 28

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'.



81
82
83
# File 'lib/flat_api/models/assignment_update.rb', line 81

def free_record
  @free_record
end

#max_pointsObject

If set, the grading will be enabled for the assignement with this value as the maximum of points



58
59
60
# File 'lib/flat_api/models/assignment_update.rb', line 58

def max_points
  @max_points
end

#nb_playback_authorizedObject

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



40
41
42
# File 'lib/flat_api/models/assignment_update.rb', line 40

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'.



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

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



61
62
63
# File 'lib/flat_api/models/assignment_update.rb', line 61

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.



43
44
45
# File 'lib/flat_api/models/assignment_update.rb', line 43

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.



46
47
48
# File 'lib/flat_api/models/assignment_update.rb', line 46

def restrict_to_audio_tracks
  @restrict_to_audio_tracks
end

#shuffle_exercisesObject

Mixing worksheets exercises for each student



64
65
66
# File 'lib/flat_api/models/assignment_update.rb', line 64

def shuffle_exercises
  @shuffle_exercises
end

#submission_students_modeObject

Returns the value of attribute submission_students_mode.



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

def submission_students_mode
  @submission_students_mode
end

#teacher_instructionsObject

Teacher-only instructions (plain text)



31
32
33
# File 'lib/flat_api/models/assignment_update.rb', line 31

def teacher_instructions
  @teacher_instructions
end

#teacher_instructions_htmlObject

HTML version of teacher-only instructions. Pasted images may be sent as inline base64 data: URIs; they are uploaded to storage and rewritten to hosted URLs on save. The final HTML is limited to 100000 characters. When provided, the plain text version will be automatically extracted for compatibility.



34
35
36
# File 'lib/flat_api/models/assignment_update.rb', line 34

def teacher_instructions_html
  @teacher_instructions_html
end

#titleObject

Title of the assignment



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

def title
  @title
end

#toolsetObject

The id of the toolset to apply to this assignment. The toolset will be copied to the assignment as a dedicated object to prevent unexpected changes when making modifications to the template toolset. This property can be set to null to delete the linked toolset and switch back to all the tools available for this assignment.



49
50
51
# File 'lib/flat_api/models/assignment_update.rb', line 49

def toolset
  @toolset
end

#typeObject

Returns the value of attribute type.



19
20
21
# File 'lib/flat_api/models/assignment_update.rb', line 19

def type
  @type
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



134
135
136
# File 'lib/flat_api/models/assignment_update.rb', line 134

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



139
140
141
# File 'lib/flat_api/models/assignment_update.rb', line 139

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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/assignment_update.rb', line 106

def self.attribute_map
  {
    :'type' => :'type',
    :'title' => :'title',
    :'description' => :'description',
    :'description_html' => :'descriptionHtml',
    :'teacher_instructions' => :'teacherInstructions',
    :'teacher_instructions_html' => :'teacherInstructionsHtml',
    :'attachments' => :'attachments',
    :'nb_playback_authorized' => :'nbPlaybackAuthorized',
    :'restrict_play_note' => :'restrictPlayNote',
    :'restrict_to_audio_tracks' => :'restrictToAudioTracks',
    :'toolset' => :'toolset',
    :'cover_file' => :'coverFile',
    :'cover' => :'cover',
    :'max_points' => :'maxPoints',
    :'release_grades' => :'releaseGrades',
    :'shuffle_exercises' => :'shuffleExercises',
    :'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



500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/flat_api/models/assignment_update.rb', line 500

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



172
173
174
175
176
177
178
179
180
# File 'lib/flat_api/models/assignment_update.rb', line 172

def self.openapi_nullable
  Set.new([
    :'nb_playback_authorized',
    :'toolset',
    :'cover_file',
    :'cover',
    :'max_points',
  ])
end

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'type' => :'AssignmentType',
    :'title' => :'String',
    :'description' => :'String',
    :'description_html' => :'String',
    :'teacher_instructions' => :'String',
    :'teacher_instructions_html' => :'String',
    :'attachments' => :'Array<ClassAttachmentCreation>',
    :'nb_playback_authorized' => :'Float',
    :'restrict_play_note' => :'Boolean',
    :'restrict_to_audio_tracks' => :'Boolean',
    :'toolset' => :'String',
    :'cover_file' => :'String',
    :'cover' => :'String',
    :'max_points' => :'Float',
    :'release_grades' => :'String',
    :'shuffle_exercises' => :'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



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/flat_api/models/assignment_update.rb', line 458

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      type == o.type &&
      title == o.title &&
      description == o.description &&
      description_html == o.description_html &&
      teacher_instructions == o.teacher_instructions &&
      teacher_instructions_html == o.teacher_instructions_html &&
      attachments == o.attachments &&
      nb_playback_authorized == o.nb_playback_authorized &&
      restrict_play_note == o.restrict_play_note &&
      restrict_to_audio_tracks == o.restrict_to_audio_tracks &&
      toolset == o.toolset &&
      cover_file == o.cover_file &&
      cover == o.cover &&
      max_points == o.max_points &&
      release_grades == o.release_grades &&
      shuffle_exercises == o.shuffle_exercises &&
      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


487
488
489
# File 'lib/flat_api/models/assignment_update.rb', line 487

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



493
494
495
# File 'lib/flat_api/models/assignment_update.rb', line 493

def hash
  [type, title, description, description_html, teacher_instructions, teacher_instructions_html, attachments, nb_playback_authorized, restrict_play_note, restrict_to_audio_tracks, toolset, cover_file, cover, max_points, release_grades, shuffle_exercises, 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



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
326
327
# File 'lib/flat_api/models/assignment_update.rb', line 291

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@title.nil? && @title.to_s.length > 1000
    invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 1000.')
  end

  if !@title.nil? && @title.to_s.length < 1
    invalid_properties.push('invalid value for "title", the character length must be greater than or equal to 1.')
  end

  if !@description.nil? && @description.to_s.length > 100000
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 100000.')
  end

  if !@description_html.nil? && @description_html.to_s.length > 20000000
    invalid_properties.push('invalid value for "description_html", the character length must be smaller than or equal to 20000000.')
  end

  if !@teacher_instructions.nil? && @teacher_instructions.to_s.length > 100000
    invalid_properties.push('invalid value for "teacher_instructions", the character length must be smaller than or equal to 100000.')
  end

  if !@teacher_instructions_html.nil? && @teacher_instructions_html.to_s.length > 20000000
    invalid_properties.push('invalid value for "teacher_instructions_html", the character length must be smaller than or equal to 20000000.')
  end

  if !@max_points.nil? && @max_points > 10000
    invalid_properties.push('invalid value for "max_points", must be smaller than or equal to 10000.')
  end

  if !@max_points.nil? && @max_points < 0
    invalid_properties.push('invalid value for "max_points", must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'lib/flat_api/models/assignment_update.rb', line 522

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



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/flat_api/models/assignment_update.rb', line 331

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@title.nil? && @title.to_s.length > 1000
  return false if !@title.nil? && @title.to_s.length < 1
  return false if !@description.nil? && @description.to_s.length > 100000
  return false if !@description_html.nil? && @description_html.to_s.length > 20000000
  return false if !@teacher_instructions.nil? && @teacher_instructions.to_s.length > 100000
  return false if !@teacher_instructions_html.nil? && @teacher_instructions_html.to_s.length > 20000000
  return false if !@max_points.nil? && @max_points > 10000
  return false if !@max_points.nil? && @max_points < 0
  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