class Qti::Importer

Attributes

assessment_id[R]
package_root[R]

Public Class Methods

assessment_identifiers_for(path) click to toggle source
# File lib/qti.rb, line 28
def self.assessment_identifiers_for(path)
  manifest(path)[2].assessment_identifiers
end
manifest(path) click to toggle source
# File lib/qti.rb, line 39
def self.manifest(path)
  mpath = manifest_path(path)
  package_root = File.dirname(mpath)
  manifest = Qti::Models::Manifest.from_path!(mpath, package_root = package_root)
  [mpath, package_root, manifest]
end
manifest_path(path) click to toggle source
# File lib/qti.rb, line 32
def self.manifest_path(path)
  Find.find(path) do |subdir|
    return subdir if subdir =~ /imsmanifest.xml\z/
  end
  raise 'Manifest not found'
end
new(path, assessment_id = nil) click to toggle source
# File lib/qti.rb, line 22
def initialize(path, assessment_id = nil)
  @path, @package_root, @manifest = Importer.manifest(path)
  @assessment_id = assessment_id || @manifest.assessment_identifiers.first
  @import = @manifest.assessment_test(@assessment_id)
end

Public Instance Methods

assessment_item_refs() click to toggle source
# File lib/qti.rb, line 50
def assessment_item_refs
  @import.assessment_items
end
create_assessment_item(assessment_item) click to toggle source
# File lib/qti.rb, line 54
def create_assessment_item(assessment_item)
  @import.create_assessment_item(assessment_item)
end
create_question_group(question_group_ref) click to toggle source
# File lib/qti.rb, line 66
def create_question_group(question_group_ref)
  @import.create_question_group(question_group_ref)
end
create_stimulus(stimulus_ref) click to toggle source
# File lib/qti.rb, line 62
def create_stimulus(stimulus_ref)
  @import.create_stimulus(stimulus_ref)
end
stimulus_ref(assessment_item_ref) click to toggle source
# File lib/qti.rb, line 58
def stimulus_ref(assessment_item_ref)
  @import.stimulus_ref(assessment_item_ref)
end
test_object() click to toggle source
# File lib/qti.rb, line 46
def test_object
  @import
end