Class: Senkyoshi::Assignment

Inherits:
Content show all
Defined in:
lib/senkyoshi/models/assignment.rb

Constant Summary

Constants inherited from Content

Content::CONTENT_TYPES, Content::MODULE_TYPES

Instance Attribute Summary

Attributes inherited from Content

#body, #extendeddata, #files, #title, #url

Attributes inherited from FileResource

#id

Instance Method Summary collapse

Methods inherited from Content

#create_module, from, #iterate_xml, #set_module

Methods inherited from FileResource

#create_module, from, #initialize, #iterate_xml

Methods inherited from Resource

#_find_directories, #_fix_path, #_matches_directory_xid?, #_search_and_replace, #cleanup, #fix_html, get_pre_data, #matches_xid?, #strip_xid

Constructor Details

This class inherits a constructor from Senkyoshi::FileResource

Instance Method Details

#canvas_conversion(course, resources) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/senkyoshi/models/assignment.rb', line 20

def canvas_conversion(course, resources)
  unless @title == "--TOP--"
    assignment = CanvasCc::CanvasCC::Models::Assignment.new
    assignment.identifier = @id
    assignment.title = @title
    assignment.body = fix_html(@body, resources)
    assignment.points_possible = @points
    assignment.assignment_group_identifier_ref = @group_id
    assignment.position = 1
    assignment.workflow_state = "published"
    assignment.submission_types << "online_text_entry"
    assignment.submission_types << "online_upload"
    assignment.grading_type = "points"

    @files.each do |file|
      assignment.body << file.canvas_conversion(resources)
    end
    course = create_module(course)
    course.assignments << assignment
  end
  course
end