lib/ims/lti/services/tool_config.rb
# Parse tool configuration data out of the Common Cartridge LTI link XML
Parse tool configuration data out of the Common Cartridge LTI link XML
Parse tool configuration data out of the Common Cartridge LTI link XML
def process_xml(xml)
      doc = REXML::Document.new xml
      if root = REXML::XPath.first(doc, 'xmlns:cartridge_basiclti_link')
        @title = get_node_text(root, 'blti:title')
        @description = get_node_text(root, 'blti:description')
        @launch_url = get_node_text(root, 'blti:launch_url')
        @secure_launch_url = get_node_text(root, 'blti:secure_launch_url')
        @icon = get_node_text(root, 'blti:icon')
        @secure_icon = get_node_text(root, 'blti:secure_icon')
        @cartridge_bundle = get_node_att(root, 'xmlns:cartridge_bundle', 'identifierref')
        @cartridge_icon = get_node_att(root, 'xmlns:cartridge_icon', 'identifierref')
        if vendor = REXML::XPath.first(root, 'blti:vendor')
          @vendor_code = get_node_text(vendor, 'lticp:code')
          @vendor_description = get_node_text(vendor, 'lticp:description')
          @vendor_name = get_node_text(vendor, 'lticp:name')
          @vendor_url = get_node_text(vendor, 'lticp:url')
          @vendor_contact_email = get_node_text(vendor, '//lticp:contact/lticp:email')
          @vendor_contact_name = get_node_text(vendor, '//lticp:contact/lticp:name')
        end
        if custom = REXML::XPath.first(root, 'blti:custom', LTI_NAMESPACES)
          set_properties(@custom_params, custom)
        end
        REXML::XPath.each(root, 'blti:extensions', LTI_NAMESPACES) do |vendor_ext_node|
          platform = vendor_ext_node.attributes['platform']
          properties = {}
          set_properties(properties, vendor_ext_node)
          REXML::XPath.each(vendor_ext_node, 'lticm:options', LTI_NAMESPACES) do |options_node|
            opt_name = options_node.attributes['name']
            options = {}
            set_properties(options, options_node)
            properties[opt_name] = options
          end
          self.set_ext_params(platform, properties)
        end
      end
    end
def process_xml ( xml ) doc = REXML :: Document . new xml if root = REXML :: XPath . first ( doc , 'xmlns:cartridge_basiclti_link' ) @title = get_node_text ( root , 'blti:title' ) @description = get_node_text ( root , 'blti:description' ) @launch_url = get_node_text ( root , 'blti:launch_url' ) @secure_launch_url = get_node_text ( root , 'blti:secure_launch_url' ) @icon = get_node_text ( root , 'blti:icon' ) @secure_icon = get_node_text ( root , 'blti:secure_icon' ) @cartridge_bundle = get_node_att ( root , 'xmlns:cartridge_bundle' , 'identifierref' ) @cartridge_icon = get_node_att ( root , 'xmlns:cartridge_icon' , 'identifierref' ) if vendor = REXML :: XPath . first ( root , 'blti:vendor' ) @vendor_code = get_node_text ( vendor , 'lticp:code' ) @vendor_description = get_node_text ( vendor , 'lticp:description' ) @vendor_name = get_node_text ( vendor , 'lticp:name' ) @vendor_url = get_node_text ( vendor , 'lticp:url' ) @vendor_contact_email = get_node_text ( vendor , '//lticp:contact/lticp:email' ) @vendor_contact_name = get_node_text ( vendor , '//lticp:contact/lticp:name' ) end if custom = REXML :: XPath . first ( root , 'blti:custom' , LTI_NAMESPACES ) set_properties ( @custom_params , custom ) end REXML :: XPath . each ( root , 'blti:extensions' , LTI_NAMESPACES ) do | vendor_ext_node | platform = vendor_ext_node . attributes [ 'platform' ] properties = { } set_properties ( properties , vendor_ext_node ) REXML :: XPath . each ( vendor_ext_node , 'lticm:options' , LTI_NAMESPACES ) do | options_node | opt_name = options_node . attributes [ 'name' ] options = { } set_properties ( options , options_node ) properties [ opt_name ] = options end self . set_ext_params ( platform , properties ) end end end
Parse tool configuration data out of the Common Cartridge LTI link XML
Parse tool configuration data out of the Common Cartridge LTI link XML
xml
<not_specific>