Class: Moodle2CC::CanvasCC::ImsManifestGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/moodle2cc/canvas_cc/ims_manifest_generator.rb

Constant Summary collapse

MANIFEST_FILE_NAME =
'imsmanifest.xml'
SCHEMA =
'IMS Common Cartridge'
SCHEMA_VERSION =
'1.1.0'
LOMIMSCC =
'lomimscc'
SETTINGS_POSTFIX =
'_settings'
TYPE_LAR =
'associatedcontent/imscc_xmlv1p1/learning-application-resource'
CANVAS_EXPORT_PATH =
'course_settings/canvas_export.txt'
ALL_MODULES_IDENTIFIER =
'LearningModules'

Instance Method Summary collapse

Constructor Details

#initialize(work_dir, course) ⇒ ImsManifestGenerator

Returns a new instance of ImsManifestGenerator.



13
14
15
16
# File 'lib/moodle2cc/canvas_cc/ims_manifest_generator.rb', line 13

def initialize(work_dir, course)
  @work_dir = work_dir
  @course = course
end

Instance Method Details

#writeObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/moodle2cc/canvas_cc/ims_manifest_generator.rb', line 18

def write
  xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
    manifest(xml) do |xml|
      (xml)
      organizations(xml)
      resources(xml, @course.all_resources)
    end
  end.to_xml
  File.open(File.join(@work_dir, MANIFEST_FILE_NAME), 'w') { |f| f.write(xml) }
end