Class: CanvasCc::Canvas::QuestionGroup

Inherits:
Object
  • Object
show all
Includes:
CanvasCc::CC::CCHelper
Defined in:
lib/canvas_cc/canvas/question_group.rb

Constant Summary

Constants included from CanvasCc::CC::CCHelper

CanvasCc::CC::CCHelper::ASSESSMENT_CC_QTI, CanvasCc::CC::CCHelper::ASSESSMENT_META, CanvasCc::CC::CCHelper::ASSESSMENT_NON_CC_FOLDER, CanvasCc::CC::CCHelper::ASSESSMENT_TYPE, CanvasCc::CC::CCHelper::ASSIGNMENT_GROUPS, CanvasCc::CC::CCHelper::ASSIGNMENT_SETTINGS, CanvasCc::CC::CCHelper::BASIC_LTI, CanvasCc::CC::CCHelper::BLTI_NAMESPACE, CanvasCc::CC::CCHelper::CANVAS_NAMESPACE, CanvasCc::CC::CCHelper::CANVAS_PLATFORM, CanvasCc::CC::CCHelper::CC_ASSIGNMENT_FOLDER, CanvasCc::CC::CCHelper::CC_EXTENSION, CanvasCc::CC::CCHelper::CC_WIKI_FOLDER, CanvasCc::CC::CCHelper::COURSE_SETTINGS, CanvasCc::CC::CCHelper::COURSE_SETTINGS_DIR, CanvasCc::CC::CCHelper::COURSE_TOKEN, CanvasCc::CC::CCHelper::DISCUSSION_TOPIC, CanvasCc::CC::CCHelper::EVENTS, CanvasCc::CC::CCHelper::EXTERNAL_FEEDS, CanvasCc::CC::CCHelper::EXTERNAL_TOOLS, CanvasCc::CC::CCHelper::FILES_META, CanvasCc::CC::CCHelper::GRADING_STANDARDS, CanvasCc::CC::CCHelper::IMS_DATE, CanvasCc::CC::CCHelper::IMS_DATETIME, CanvasCc::CC::CCHelper::LEARNING_OUTCOMES, CanvasCc::CC::CCHelper::LOR, CanvasCc::CC::CCHelper::MANIFEST, CanvasCc::CC::CCHelper::MEDIA_OBJECTS_FOLDER, CanvasCc::CC::CCHelper::MODULE_META, CanvasCc::CC::CCHelper::MOODLE_FILEBASE_TOKEN, CanvasCc::CC::CCHelper::MOODLE_SLASH_TOKEN, CanvasCc::CC::CCHelper::OBJECT_TOKEN, CanvasCc::CC::CCHelper::QTI_ASSESSMENT_TYPE, CanvasCc::CC::CCHelper::QTI_EXTENSION, CanvasCc::CC::CCHelper::QUESTION_BANK, CanvasCc::CC::CCHelper::RUBRICS, CanvasCc::CC::CCHelper::SYLLABUS, CanvasCc::CC::CCHelper::WEBCONTENT, CanvasCc::CC::CCHelper::WEB_CONTENT_TOKEN, CanvasCc::CC::CCHelper::WEB_LINK, CanvasCc::CC::CCHelper::WEB_RESOURCES_FOLDER, CanvasCc::CC::CCHelper::WIKI_FOLDER, CanvasCc::CC::CCHelper::WIKI_TOKEN, CanvasCc::CC::CCHelper::XSD_URI

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CanvasCc::CC::CCHelper

#convert_file_path_tokens, convert_file_path_tokens, #create_key, create_key, create_mod_key, #create_mod_key, #create_resource_key, create_resource_key, file_query_string, #file_slug, file_slug, #get_html_title_and_body, #get_html_title_and_body_and_id, #get_html_title_and_body_and_meta_fields, ims_date, #ims_date, ims_datetime, #ims_datetime, media_object_info

Constructor Details

#initialize(params = {}) ⇒ QuestionGroup

Returns a new instance of QuestionGroup.



7
8
9
10
11
12
13
14
15
# File 'lib/canvas_cc/canvas/question_group.rb', line 7

def initialize(params={})
  @id = params[:id] || 1
  @title = "Group #{@id}"
  @selection_number = 1
  @points_per_item = params[:points_per_item] || 1
  @question_bank = params[:question_bank]
  @sourcebank_ref = @question_bank.identifier if @question_bank
  @identifier = create_key @id, 'question_group_'
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/canvas_cc/canvas/question_group.rb', line 4

def id
  @id
end

#identifierObject

Returns the value of attribute identifier.



4
5
6
# File 'lib/canvas_cc/canvas/question_group.rb', line 4

def identifier
  @identifier
end

#points_per_itemObject

Returns the value of attribute points_per_item.



4
5
6
# File 'lib/canvas_cc/canvas/question_group.rb', line 4

def points_per_item
  @points_per_item
end

#question_bankObject

Returns the value of attribute question_bank.



4
5
6
# File 'lib/canvas_cc/canvas/question_group.rb', line 4

def question_bank
  @question_bank
end

#selection_numberObject

Returns the value of attribute selection_number.



4
5
6
# File 'lib/canvas_cc/canvas/question_group.rb', line 4

def selection_number
  @selection_number
end

#sourcebank_refObject

Returns the value of attribute sourcebank_ref.



4
5
6
# File 'lib/canvas_cc/canvas/question_group.rb', line 4

def sourcebank_ref
  @sourcebank_ref
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/canvas_cc/canvas/question_group.rb', line 4

def title
  @title
end

Instance Method Details

#create_item_xml(root_node) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/canvas_cc/canvas/question_group.rb', line 21

def create_item_xml(root_node)
  root_node.section(:title => @title, :ident => @identifier) do |section_node|
    section_node.selection_ordering do |ordering_node|
      ordering_node.selection do |selection_node|
        selection_node.sourcebank_ref @sourcebank_ref
        selection_node.selection_number @selection_number
        selection_node.selection_extension do |extension_node|
          extension_node.points_per_item @points_per_item
        end
      end
    end
  end
end

#increment_selection_numberObject



17
18
19
# File 'lib/canvas_cc/canvas/question_group.rb', line 17

def increment_selection_number
  @selection_number += 1
end