Class: ScormEngine::Models::CourseImport
- Inherits:
-
Object
- Object
- 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.
-
#options ⇒ Object
writeonly
Sets the attribute options.
-
#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
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.
10 11 12 |
# File 'lib/scorm_engine/models/course_import.rb', line 10 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.
10 11 12 |
# File 'lib/scorm_engine/models/course_import.rb', line 10 def id @id end |
#options=(value) ⇒ Object
Sets the attribute options
4 5 6 |
# File 'lib/scorm_engine/models/course_import.rb', line 4 def (value) @options = value 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.
10 11 12 |
# File 'lib/scorm_engine/models/course_import.rb', line 10 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.
10 11 12 |
# File 'lib/scorm_engine/models/course_import.rb', line 10 def status @status end |
Class Method Details
.new_from_api(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/scorm_engine/models/course_import.rb', line 12 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
37 38 39 |
# File 'lib/scorm_engine/models/course_import.rb', line 37 def complete? status == "COMPLETE" end |
#error? ⇒ Boolean
33 34 35 |
# File 'lib/scorm_engine/models/course_import.rb', line 33 def error? status == "ERROR" end |
#running? ⇒ Boolean
29 30 31 |
# File 'lib/scorm_engine/models/course_import.rb', line 29 def running? status == "RUNNING" end |