Class: FlatApi::AssignmentSubmission

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

Overview

Assignment Submission

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/flat_api/models/assignment_submission.rb', line 161

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#assignmentObject

Unique identifier of the assignment



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

def assignment
  @assignment
end

#attachmentsObject

Returns the value of attribute attachments.



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

def attachments
  @attachments
end

#classroomObject

Unique identifier of the classroom where the assignment was posted



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

def classroom
  @classroom
end

#commentsObject

Returns the value of attribute comments.



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

def comments
  @comments
end

#creation_dateObject

The date when the submission was created



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

def creation_date
  @creation_date
end

#creatorObject

The User identifier of the student who created the submission



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

def creator
  @creator
end

#draft_gradeObject

Optional grade. If unset, no grade was set. This value is only visible by the teacher, and we will be set to grade once the teacher returns the submission



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

def draft_grade
  @draft_grade
end

#exercises_idsObject

The ids of exercises when they need to be in a specific order



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

def exercises_ids
  @exercises_ids
end

#google_classroomObject

Returns the value of attribute google_classroom.



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

def google_classroom
  @google_classroom
end

#gradeObject

Optional grade. If unset, no grade was set.



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

def grade
  @grade
end

#idObject

Unique identifier of the submission



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

def id
  @id
end

#ltiObject

Returns the value of attribute lti.



67
68
69
# File 'lib/flat_api/models/assignment_submission.rb', line 67

def lti
  @lti
end

#max_pointsObject

Optional max points for the grade. If set, a corresponding draftGrade or grade will be set.



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

def max_points
  @max_points
end

#microsoft_graphObject

Returns the value of attribute microsoft_graph.



65
66
67
# File 'lib/flat_api/models/assignment_submission.rb', line 65

def microsoft_graph
  @microsoft_graph
end

#playbackObject

Returns the value of attribute playback.



59
60
61
# File 'lib/flat_api/models/assignment_submission.rb', line 59

def playback
  @playback
end

#return_creatorObject

The User unique identifier of the teacher who returned the submission



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

def return_creator
  @return_creator
end

#return_dateObject

The date when the teacher returned the work



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

def return_date
  @return_date
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#submission_dateObject

The date when the student submitted their work



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

def submission_date
  @submission_date
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



117
118
119
# File 'lib/flat_api/models/assignment_submission.rb', line 117

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



122
123
124
# File 'lib/flat_api/models/assignment_submission.rb', line 122

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/flat_api/models/assignment_submission.rb', line 92

def self.attribute_map
  {
    :'id' => :'id',
    :'state' => :'state',
    :'classroom' => :'classroom',
    :'assignment' => :'assignment',
    :'creator' => :'creator',
    :'creation_date' => :'creationDate',
    :'attachments' => :'attachments',
    :'submission_date' => :'submissionDate',
    :'return_date' => :'returnDate',
    :'return_creator' => :'returnCreator',
    :'grade' => :'grade',
    :'draft_grade' => :'draftGrade',
    :'max_points' => :'maxPoints',
    :'exercises_ids' => :'exercisesIds',
    :'playback' => :'playback',
    :'comments' => :'comments',
    :'google_classroom' => :'googleClassroom',
    :'microsoft_graph' => :'microsoftGraph',
    :'lti' => :'lti'
  }
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



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# File 'lib/flat_api/models/assignment_submission.rb', line 467

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



152
153
154
155
156
157
# File 'lib/flat_api/models/assignment_submission.rb', line 152

def self.openapi_nullable
  Set.new([
    :'grade',
    :'draft_grade',
  ])
end

.openapi_typesObject

Attribute type mapping.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/flat_api/models/assignment_submission.rb', line 127

def self.openapi_types
  {
    :'id' => :'String',
    :'state' => :'AssignmentSubmissionState',
    :'classroom' => :'String',
    :'assignment' => :'String',
    :'creator' => :'String',
    :'creation_date' => :'String',
    :'attachments' => :'Array<MediaAttachment>',
    :'submission_date' => :'String',
    :'return_date' => :'String',
    :'return_creator' => :'String',
    :'grade' => :'Float',
    :'draft_grade' => :'Float',
    :'max_points' => :'Float',
    :'exercises_ids' => :'Array<String>',
    :'playback' => :'Array<AssignmentSubmissionPlayback>',
    :'comments' => :'AssignmentSubmissionComments',
    :'google_classroom' => :'GoogleClassroomSubmission',
    :'microsoft_graph' => :'MicrosoftGraphSubmission',
    :'lti' => :'AssignmentSubmissionLti'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/flat_api/models/assignment_submission.rb', line 428

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      state == o.state &&
      classroom == o.classroom &&
      assignment == o.assignment &&
      creator == o.creator &&
      creation_date == o.creation_date &&
      attachments == o.attachments &&
      submission_date == o.submission_date &&
      return_date == o.return_date &&
      return_creator == o.return_creator &&
      grade == o.grade &&
      draft_grade == o.draft_grade &&
      max_points == o.max_points &&
      exercises_ids == o.exercises_ids &&
      playback == o.playback &&
      comments == o.comments &&
      google_classroom == o.google_classroom &&
      microsoft_graph == o.microsoft_graph &&
      lti == o.lti
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


454
455
456
# File 'lib/flat_api/models/assignment_submission.rb', line 454

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



460
461
462
# File 'lib/flat_api/models/assignment_submission.rb', line 460

def hash
  [id, state, classroom, assignment, creator, creation_date, attachments, submission_date, return_date, return_creator, grade, draft_grade, max_points, exercises_ids, playback, comments, google_classroom, microsoft_graph, lti].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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_submission.rb', line 278

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

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

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

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

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

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

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

  if @comments.nil?
    invalid_properties.push('invalid value for "comments", comments 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



489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/flat_api/models/assignment_submission.rb', line 489

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



322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/flat_api/models/assignment_submission.rb', line 322

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @state.nil?
  return false if @classroom.nil?
  return false if @assignment.nil?
  return false if @creator.nil?
  return false if @creation_date.nil?
  return false if @attachments.nil?
  return false if @playback.nil?
  return false if @comments.nil?
  true
end