Class: ScormEngine::Models::CourseImport
- Defined in:
- lib/scorm_engine/models/course_import.rb
Instance Attribute Summary collapse
- #course ⇒ ScormEngine::Models::Course
-
#id ⇒ String
The ID of this course import (not the course id).
- #parser_warnings ⇒ Array<String>
-
#status ⇒ String
(RUNNING, COMPLETE, ERROR).
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Instance Attribute Details
#course ⇒ ScormEngine::Models::Course
23 24 25 |
# File 'lib/scorm_engine/models/course_import.rb', line 23 def course @course end |
#id ⇒ String
The ID of this course import (not the course id)
8 9 10 |
# File 'lib/scorm_engine/models/course_import.rb', line 8 def id @id end |
#parser_warnings ⇒ Array<String>
18 19 20 |
# File 'lib/scorm_engine/models/course_import.rb', line 18 def parser_warnings @parser_warnings end |
#status ⇒ String
Returns (RUNNING, COMPLETE, ERROR).
13 14 15 |
# File 'lib/scorm_engine/models/course_import.rb', line 13 def status @status end |
Class Method Details
.new_from_api(options = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/scorm_engine/models/course_import.rb', line 25 def self.new_from_api( = {}) this = new this. = .dup if .key?("importResult") this.id = ["result"] this.status = .fetch("importResult", {})["status"]&.upcase this.parser_warnings = .fetch("importResult", {})["parserWarnings"] else this.id = ["jobId"] this.status = ["status"]&.upcase this.course = Course.new_from_api(["course"]) if .key?("course") # unavailable in error states end this end |
Instance Method Details
#complete? ⇒ Boolean
50 51 52 |
# File 'lib/scorm_engine/models/course_import.rb', line 50 def complete? status == "COMPLETE" end |
#error? ⇒ Boolean
46 47 48 |
# File 'lib/scorm_engine/models/course_import.rb', line 46 def error? status == "ERROR" end |
#running? ⇒ Boolean
42 43 44 |
# File 'lib/scorm_engine/models/course_import.rb', line 42 def running? status == "RUNNING" end |