Class: Qti::V1::Models::ObjectBank

Inherits:
Assessment show all
Defined in:
lib/qti/v1/models/object_bank.rb

Constant Summary

Constants inherited from Assessment

Assessment::GROUP_ID

Instance Attribute Summary

Attributes inherited from Models::Base

#doc, #manifest, #package_root, #path, #resource

Instance Method Summary collapse

Methods inherited from Assessment

#assessment_items, #create_assessment_item, #create_bank_entry_item, #create_question_group, #create_stimulus, #external_assignment_id, #stimulus_ref

Methods included from Models::AssessmentMetaBase

#canvas_meta_data

Methods inherited from Base

#qti_version, #return_inner_content!, #sanitize_attributes, #sanitize_attributes_by_node

Methods inherited from Models::Base

#css_with_single_check, from_path!, #initialize, #parse_html, #parse_xml, #preprocess_xml_doc, #raise_unsupported, #remap_href_path, #sanitize_content!, #xpath_with_single_check

Constructor Details

This class inherits a constructor from Qti::Models::Base

Instance Method Details

#bank_context_uuidObject



27
28
29
30
31
# File 'lib/qti/v1/models/object_bank.rb', line 27

def bank_context_uuid
  @bank_context_uuid ||= xpath_with_single_check(
    './/xmlns:qtimetadatafield/xmlns:fieldlabel[text()="bank_context_uuid"]/../xmlns:fieldentry'
  )&.content
end

#bank_typeObject

tells us whether the bank was an account or course bank



21
22
23
24
25
# File 'lib/qti/v1/models/object_bank.rb', line 21

def bank_type
  @bank_type ||= xpath_with_single_check(
    './/xmlns:qtimetadatafield/xmlns:fieldlabel[text()="bank_type"]/../xmlns:fieldentry'
  )&.content
end

#canvas_item_bankObject



16
17
18
# File 'lib/qti/v1/models/object_bank.rb', line 16

def canvas_item_bank
  @canvas_item_bank ||= xpath_with_single_check('.//xmlns:objectbank/@canvas_item_bank')&.content
end

#identifierObject



12
13
14
# File 'lib/qti/v1/models/object_bank.rb', line 12

def identifier
  @identifier ||= xpath_with_single_check('.//xmlns:objectbank/@ident')&.content
end

#titleObject

use assessment_items / create_assessment_item from Assessment for bank items



6
7
8
9
10
# File 'lib/qti/v1/models/object_bank.rb', line 6

def title
  @title ||= xpath_with_single_check(
    './/xmlns:qtimetadatafield/xmlns:fieldlabel[text()="bank_title"]/../xmlns:fieldentry'
  )&.content || File.basename(@path, '.xml')
end