Class: FlatApi::ClassAssignment
- Inherits:
-
Object
- Object
- FlatApi::ClassAssignment
- Defined in:
- lib/flat_api/models/class_assignment.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#assigned_students ⇒ Object
Identifiers for the students that have access to the assignment.
-
#assignee_mode ⇒ Object
Possible modes of assigning assignments.
-
#attachments ⇒ Object
Returns the value of attribute attachments.
-
#canvas ⇒ Object
Returns the value of attribute canvas.
-
#capabilities ⇒ Object
Returns the value of attribute capabilities.
-
#classroom ⇒ Object
The unique identifier of the class where this assignment was posted.
-
#cover ⇒ Object
The URL of the cover to display.
-
#cover_file ⇒ Object
The id of the cover to display.
-
#creation_date ⇒ Object
The creation date of this assignment.
-
#creator ⇒ Object
The User unique identifier of the creator of this assignment.
-
#description ⇒ Object
Description and content of the assignment.
-
#due_date ⇒ Object
The due date of this assignment, late submissions will be marked as paste due.
-
#google_classroom ⇒ Object
Returns the value of attribute google_classroom.
-
#id ⇒ Object
Unique identifier of the assignment.
-
#issue ⇒ Object
Detected issue for this assignment.
-
#lti ⇒ Object
Returns the value of attribute lti.
-
#max_points ⇒ Object
If set, the grading will be enabled for the assignement.
-
#mfc ⇒ Object
Returns the value of attribute mfc.
-
#microsoft_graph ⇒ Object
Returns the value of attribute microsoft_graph.
-
#nb_playback_authorized ⇒ Object
The number of playback authorized on the scores of the assignment.
-
#release_grades ⇒ Object
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.
-
#scheduled_date ⇒ Object
The publication (scheduled) date of the assignment.
-
#shuffle_exercises ⇒ Object
Mixing worksheets exercises for each student.
-
#state ⇒ Object
State of the assignment.
-
#submissions ⇒ Object
Returns the value of attribute submissions.
-
#title ⇒ Object
Title of the assignment.
-
#toolset ⇒ Object
The id of the associated toolset.
-
#type ⇒ Object
Returns the value of attribute type.
-
#use_dedicated_attachments ⇒ Object
For all assignments created after 02/2023, all the underlying resources must be dedicated and stored in the assignment.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.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_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.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.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ClassAssignment
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 = {}) ⇒ ClassAssignment
Initializes the object
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 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 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/flat_api/models/class_assignment.rb', line 208 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `FlatApi::ClassAssignment` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `FlatApi::ClassAssignment`. Please check the name to make sure it's valid. List of attributes: " + self.class.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?(:'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. = value end else self. = nil end if attributes.key?(:'use_dedicated_attachments') self. = 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. = attributes[:'nb_playback_authorized'] end if attributes.key?(:'creator') self.creator = attributes[:'creator'] end if attributes.key?(:'state') self.state = attributes[:'state'] else self.state = nil end if attributes.key?(:'classroom') self.classroom = attributes[:'classroom'] end if attributes.key?(:'creation_date') self.creation_date = attributes[:'creation_date'] else self.creation_date = nil end if attributes.key?(:'scheduled_date') self.scheduled_date = attributes[:'scheduled_date'] end if attributes.key?(:'due_date') self.due_date = attributes[:'due_date'] end if attributes.key?(:'assignee_mode') self.assignee_mode = attributes[:'assignee_mode'] end if attributes.key?(:'assigned_students') if (value = attributes[:'assigned_students']).is_a?(Array) self.assigned_students = value end end if attributes.key?(:'submissions') if (value = attributes[:'submissions']).is_a?(Array) self.submissions = value end else self.submissions = 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?(:'mfc') self.mfc = attributes[:'mfc'] end if attributes.key?(:'canvas') self.canvas = attributes[:'canvas'] end if attributes.key?(:'lti') self.lti = attributes[:'lti'] end if attributes.key?(:'issue') self.issue = attributes[:'issue'] end end |
Instance Attribute Details
#assigned_students ⇒ Object
Identifiers for the students that have access to the assignment
79 80 81 |
# File 'lib/flat_api/models/class_assignment.rb', line 79 def assigned_students @assigned_students end |
#assignee_mode ⇒ Object
Possible modes of assigning assignments
76 77 78 |
# File 'lib/flat_api/models/class_assignment.rb', line 76 def assignee_mode @assignee_mode end |
#attachments ⇒ Object
Returns the value of attribute attachments.
37 38 39 |
# File 'lib/flat_api/models/class_assignment.rb', line 37 def @attachments end |
#canvas ⇒ Object
Returns the value of attribute canvas.
89 90 91 |
# File 'lib/flat_api/models/class_assignment.rb', line 89 def canvas @canvas end |
#capabilities ⇒ Object
Returns the value of attribute capabilities.
23 24 25 |
# File 'lib/flat_api/models/class_assignment.rb', line 23 def capabilities @capabilities end |
#classroom ⇒ Object
The unique identifier of the class where this assignment was posted
64 65 66 |
# File 'lib/flat_api/models/class_assignment.rb', line 64 def classroom @classroom end |
#cover ⇒ Object
The URL of the cover to display
32 33 34 |
# File 'lib/flat_api/models/class_assignment.rb', line 32 def cover @cover end |
#cover_file ⇒ Object
The id of the cover to display
35 36 37 |
# File 'lib/flat_api/models/class_assignment.rb', line 35 def cover_file @cover_file end |
#creation_date ⇒ Object
The creation date of this assignment
67 68 69 |
# File 'lib/flat_api/models/class_assignment.rb', line 67 def creation_date @creation_date end |
#creator ⇒ Object
The User unique identifier of the creator of this assignment
58 59 60 |
# File 'lib/flat_api/models/class_assignment.rb', line 58 def creator @creator end |
#description ⇒ Object
Description and content of the assignment
29 30 31 |
# File 'lib/flat_api/models/class_assignment.rb', line 29 def description @description end |
#due_date ⇒ Object
The due date of this assignment, late submissions will be marked as paste due.
73 74 75 |
# File 'lib/flat_api/models/class_assignment.rb', line 73 def due_date @due_date end |
#google_classroom ⇒ Object
Returns the value of attribute google_classroom.
83 84 85 |
# File 'lib/flat_api/models/class_assignment.rb', line 83 def google_classroom @google_classroom end |
#id ⇒ Object
Unique identifier of the assignment
19 20 21 |
# File 'lib/flat_api/models/class_assignment.rb', line 19 def id @id end |
#issue ⇒ Object
Detected issue for this assignment
94 95 96 |
# File 'lib/flat_api/models/class_assignment.rb', line 94 def issue @issue end |
#lti ⇒ Object
Returns the value of attribute lti.
91 92 93 |
# File 'lib/flat_api/models/class_assignment.rb', line 91 def lti @lti end |
#max_points ⇒ Object
If set, the grading will be enabled for the assignement
43 44 45 |
# File 'lib/flat_api/models/class_assignment.rb', line 43 def max_points @max_points end |
#mfc ⇒ Object
Returns the value of attribute mfc.
87 88 89 |
# File 'lib/flat_api/models/class_assignment.rb', line 87 def mfc @mfc end |
#microsoft_graph ⇒ Object
Returns the value of attribute microsoft_graph.
85 86 87 |
# File 'lib/flat_api/models/class_assignment.rb', line 85 def microsoft_graph @microsoft_graph end |
#nb_playback_authorized ⇒ Object
The number of playback authorized on the scores of the assignment.
55 56 57 |
# File 'lib/flat_api/models/class_assignment.rb', line 55 def @nb_playback_authorized end |
#release_grades ⇒ Object
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
46 47 48 |
# File 'lib/flat_api/models/class_assignment.rb', line 46 def release_grades @release_grades end |
#scheduled_date ⇒ Object
The publication (scheduled) date of the assignment. If this one is specified, the assignment will only be listed to the teachers of the class.
70 71 72 |
# File 'lib/flat_api/models/class_assignment.rb', line 70 def scheduled_date @scheduled_date end |
#shuffle_exercises ⇒ Object
Mixing worksheets exercises for each student
49 50 51 |
# File 'lib/flat_api/models/class_assignment.rb', line 49 def shuffle_exercises @shuffle_exercises end |
#state ⇒ Object
State of the assignment
61 62 63 |
# File 'lib/flat_api/models/class_assignment.rb', line 61 def state @state end |
#submissions ⇒ Object
Returns the value of attribute submissions.
81 82 83 |
# File 'lib/flat_api/models/class_assignment.rb', line 81 def submissions @submissions end |
#title ⇒ Object
Title of the assignment
26 27 28 |
# File 'lib/flat_api/models/class_assignment.rb', line 26 def title @title end |
#toolset ⇒ Object
The id of the associated toolset
52 53 54 |
# File 'lib/flat_api/models/class_assignment.rb', line 52 def toolset @toolset end |
#type ⇒ Object
Returns the value of attribute type.
21 22 23 |
# File 'lib/flat_api/models/class_assignment.rb', line 21 def type @type end |
#use_dedicated_attachments ⇒ Object
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.
40 41 42 |
# File 'lib/flat_api/models/class_assignment.rb', line 40 def @use_dedicated_attachments end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/flat_api/models/class_assignment.rb', line 526 def self._deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = FlatApi.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
154 155 156 |
# File 'lib/flat_api/models/class_assignment.rb', line 154 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/flat_api/models/class_assignment.rb', line 119 def self.attribute_map { :'id' => :'id', :'type' => :'type', :'capabilities' => :'capabilities', :'title' => :'title', :'description' => :'description', :'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', :'creator' => :'creator', :'state' => :'state', :'classroom' => :'classroom', :'creation_date' => :'creationDate', :'scheduled_date' => :'scheduledDate', :'due_date' => :'dueDate', :'assignee_mode' => :'assigneeMode', :'assigned_students' => :'assignedStudents', :'submissions' => :'submissions', :'google_classroom' => :'googleClassroom', :'microsoft_graph' => :'microsoftGraph', :'mfc' => :'mfc', :'canvas' => :'canvas', :'lti' => :'lti', :'issue' => :'issue' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/flat_api/models/class_assignment.rb', line 502 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_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
200 201 202 203 204 |
# File 'lib/flat_api/models/class_assignment.rb', line 200 def self.openapi_all_of [ :'Assignment' ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
194 195 196 197 |
# File 'lib/flat_api/models/class_assignment.rb', line 194 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/flat_api/models/class_assignment.rb', line 159 def self.openapi_types { :'id' => :'String', :'type' => :'AssignmentType', :'capabilities' => :'AssignmentCapabilities', :'title' => :'String', :'description' => :'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', :'creator' => :'String', :'state' => :'String', :'classroom' => :'String', :'creation_date' => :'Time', :'scheduled_date' => :'Time', :'due_date' => :'Time', :'assignee_mode' => :'String', :'assigned_students' => :'Array<String>', :'submissions' => :'Array<AssignmentSubmission>', :'google_classroom' => :'GoogleClassroomCoursework', :'microsoft_graph' => :'MicrosoftGraphAssignment', :'mfc' => :'ClassAssignmentAllOfMfc', :'canvas' => :'ClassAssignmentAllOfCanvas', :'lti' => :'ClassAssignmentAllOfLti', :'issue' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
453 454 455 456 457 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 484 485 |
# File 'lib/flat_api/models/class_assignment.rb', line 453 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 && cover == o.cover && cover_file == o.cover_file && == o. && == o. && max_points == o.max_points && release_grades == o.release_grades && shuffle_exercises == o.shuffle_exercises && toolset == o.toolset && == o. && creator == o.creator && state == o.state && classroom == o.classroom && creation_date == o.creation_date && scheduled_date == o.scheduled_date && due_date == o.due_date && assignee_mode == o.assignee_mode && assigned_students == o.assigned_students && submissions == o.submissions && google_classroom == o.google_classroom && microsoft_graph == o.microsoft_graph && mfc == o.mfc && canvas == o.canvas && lti == o.lti && issue == o.issue end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
597 598 599 600 601 602 603 604 605 606 607 608 609 |
# File 'lib/flat_api/models/class_assignment.rb', line 597 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 |
#eql?(o) ⇒ Boolean
489 490 491 |
# File 'lib/flat_api/models/class_assignment.rb', line 489 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
495 496 497 |
# File 'lib/flat_api/models/class_assignment.rb', line 495 def hash [id, type, capabilities, title, description, cover, cover_file, , , max_points, release_grades, shuffle_exercises, toolset, , creator, state, classroom, creation_date, scheduled_date, due_date, assignee_mode, assigned_students, submissions, google_classroom, microsoft_graph, mfc, canvas, lti, issue].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/flat_api/models/class_assignment.rb', line 362 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 if @state.nil? invalid_properties.push('invalid value for "state", state cannot be nil.') end if @creation_date.nil? invalid_properties.push('invalid value for "creation_date", creation_date cannot be nil.') end if @submissions.nil? invalid_properties.push('invalid value for "submissions", submissions cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
573 574 575 |
# File 'lib/flat_api/models/class_assignment.rb', line 573 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
579 580 581 582 583 584 585 586 587 588 589 590 591 |
# File 'lib/flat_api/models/class_assignment.rb', line 579 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 |
#to_s ⇒ String
Returns the string representation of the object
567 568 569 |
# File 'lib/flat_api/models/class_assignment.rb', line 567 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/flat_api/models/class_assignment.rb', line 402 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) return false if @state.nil? state_validator = EnumAttributeValidator.new('String', ["draft", "active", "archived"]) return false unless state_validator.valid?(@state) return false if @creation_date.nil? assignee_mode_validator = EnumAttributeValidator.new('String', ["everyone", "selected"]) return false unless assignee_mode_validator.valid?(@assignee_mode) return false if @submissions.nil? true end |