Class: ScormEngine::Models::CourseImport
- Defined in:
- lib/scorm_engine/models/course_import.rb
Instance Attribute Summary collapse
-
#course ⇒ Object
TODO: Not sure we want this to be settable.
-
#id ⇒ Object
TODO: Not sure we want this to be settable.
-
#parser_warnings ⇒ Object
TODO: Not sure we want this to be settable.
-
#status ⇒ Object
TODO: Not sure we want this to be settable.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Instance Attribute Details
#course ⇒ Object
TODO: Not sure we want this to be settable. Will depend on how we go about creating/updating records. For now it makes it easier to create instances from API options hash.
7 8 9 |
# File 'lib/scorm_engine/models/course_import.rb', line 7 def course @course end |
#id ⇒ Object
TODO: Not sure we want this to be settable. Will depend on how we go about creating/updating records. For now it makes it easier to create instances from API options hash.
7 8 9 |
# File 'lib/scorm_engine/models/course_import.rb', line 7 def id @id end |
#parser_warnings ⇒ Object
TODO: Not sure we want this to be settable. Will depend on how we go about creating/updating records. For now it makes it easier to create instances from API options hash.
7 8 9 |
# File 'lib/scorm_engine/models/course_import.rb', line 7 def parser_warnings @parser_warnings end |
#status ⇒ Object
TODO: Not sure we want this to be settable. Will depend on how we go about creating/updating records. For now it makes it easier to create instances from API options hash.
7 8 9 |
# File 'lib/scorm_engine/models/course_import.rb', line 7 def status @status end |
Class Method Details
.new_from_api(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/scorm_engine/models/course_import.rb', line 9 def self.new_from_api( = {}) this = new this. = .dup if .key?("importResult") this.id = ["result"] this.status = .fetch("importResult", {})["status"] this.parser_warnings = .fetch("importResult", {})["parserWarnings"] else this.id = ["jobId"] this.status = ["status"] this.course = Course.new_from_api(["course"]) if .key?("course") # unavailable in error states end this end |
Instance Method Details
#complete? ⇒ Boolean
34 35 36 |
# File 'lib/scorm_engine/models/course_import.rb', line 34 def complete? status == "COMPLETE" end |
#error? ⇒ Boolean
30 31 32 |
# File 'lib/scorm_engine/models/course_import.rb', line 30 def error? status == "ERROR" end |
#running? ⇒ Boolean
26 27 28 |
# File 'lib/scorm_engine/models/course_import.rb', line 26 def running? status == "RUNNING" end |