class ScormEngine::Models::CourseImport
Attributes
course[RW]
@attr
@return [ScormEngine::Models::Course]
id[RW]
@attr The ID of this course import (not the course id) @return [String]
parser_warnings[RW]
@attr
@return [Array<String>]
status[RW]
@attr
@return [String] (RUNNING, COMPLETE, ERROR)
Public Class Methods
new_from_api(options = {})
click to toggle source
# File lib/scorm_engine/models/course_import.rb, line 25 def self.new_from_api(options = {}) this = new this.options = options.dup if options.key?("importResult") this.id = options["result"] this.status = options.fetch("importResult", {})["status"]&.upcase this.parser_warnings = options.fetch("importResult", {})["parserWarnings"] else this.id = options["jobId"] this.status = options["status"]&.upcase this.course = Course.new_from_api(options["course"]) if options.key?("course") # unavailable in error states end this end
Public Instance Methods
complete?()
click to toggle source
# File lib/scorm_engine/models/course_import.rb, line 50 def complete? status == "COMPLETE" end
error?()
click to toggle source
# File lib/scorm_engine/models/course_import.rb, line 46 def error? status == "ERROR" end
running?()
click to toggle source
# File lib/scorm_engine/models/course_import.rb, line 42 def running? status == "RUNNING" end