def to_xml(opts = {})
      builder = Builder::XmlMarkup.new(:indent => opts[:indent] || 0)
      builder.instruct!
      builder.cartridge_basiclti_link("xmlns" => "http://www.imsglobal.org/xsd/imslticc_v1p0",
                                      "xmlns:blti" => 'http://www.imsglobal.org/xsd/imsbasiclti_v1p0',
                                      "xmlns:lticm" => 'http://www.imsglobal.org/xsd/imslticm_v1p0',
                                      "xmlns:lticp" => 'http://www.imsglobal.org/xsd/imslticp_v1p0',
                                      "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
                                      "xsi:schemaLocation" => "http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0p1.xsd http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd"
      ) do |blti_node|

        %w{title description launch_url secure_launch_url icon secure_icon}.each do |key|
          blti_node.blti key.to_sym, self.send(key) if self.send(key)
        end

        vendor_keys = %w{name code description url}
        if vendor_keys.any? { |k| self.send("vendor_#{k}") } || vendor_contact_email
          blti_node.blti :vendor do |v_node|
            vendor_keys.each do |key|
              v_node.lticp key.to_sym, self.send("vendor_#{key}") if self.send("vendor_#{key}")
            end
            if vendor_contact_email
              v_node.lticp :contact do |c_node|
                c_node.lticp :name, vendor_contact_name
                c_node.lticp :email, vendor_contact_email
              end
            end
          end
        end

        if !@custom_params.empty?
          blti_node.tag!("blti:custom") do |custom_node|
            @custom_params.keys.sort.each do |key|
              val = @custom_params[key]
              custom_node.lticm :property, val, 'name' => key
            end
          end
        end

        if !@extensions.empty?
          @extensions.keys.sort.each do |ext_platform|
            ext_params = @extensions[ext_platform]
            blti_node.blti(:extensions, :platform => ext_platform) do |ext_node|
              ext_params.keys.sort.each do |key|
                val = ext_params[key]
                if val.is_a?(Hash)
                  ext_node.lticm(:options, :name => key) do |type_node|
                    val.keys.sort.each do |p_key|
                      p_val = val[p_key]
                      type_node.lticm :property, p_val, 'name' => p_key
                    end
                  end
                else
                  ext_node.lticm :property, val, 'name' => key
                end
              end
            end
          end
        end

        blti_node.cartridge_bundle(:identifierref => @cartridge_bundle) if @cartridge_bundle
        blti_node.cartridge_icon(:identifierref => @cartridge_icon) if @cartridge_icon

      end
    end
def to_xml(opts = {})
      builder = Builder::XmlMarkup.new(:indent => opts[:indent] || 0)
      builder.instruct!
      builder.cartridge_basiclti_link("xmlns" => "http://www.imsglobal.org/xsd/imslticc_v1p0",
                                      "xmlns:blti" => 'http://www.imsglobal.org/xsd/imsbasiclti_v1p0',
                                      "xmlns:lticm" => 'http://www.imsglobal.org/xsd/imslticm_v1p0',
                                      "xmlns:lticp" => 'http://www.imsglobal.org/xsd/imslticp_v1p0',
                                      "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
                                      "xsi:schemaLocation" => "http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0p1.xsd http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd"
      ) do |blti_node|

        %w{title description launch_url secure_launch_url icon secure_icon}.each do |key|
          blti_node.blti key.to_sym, self.send(key) if self.send(key)
        end

        vendor_keys = %w{name code description url}
        if vendor_keys.any? { |k| self.send("vendor_
          blti_node.blti :vendor do |v_node|
            vendor_keys.each do |key|
              v_node.lticp key.to_sym, self.send("vendor_
            end
            if vendor_contact_email
              v_node.lticp :contact do |c_node|
                c_node.lticp :name, vendor_contact_name
                c_node.lticp :email, vendor_contact_email
              end
            end
          end
        end

        if !@custom_params.empty?
          blti_node.tag!("blti:custom") do |custom_node|
            @custom_params.keys.sort.each do |key|
              val = @custom_params[key]
              custom_node.lticm :property, val, 'name' => key
            end
          end
        end

        if !@extensions.empty?
          @extensions.keys.sort.each do |ext_platform|
            ext_params = @extensions[ext_platform]
            blti_node.blti(:extensions, :platform => ext_platform) do |ext_node|
              ext_params.keys.sort.each do |key|
                val = ext_params[key]
                if val.is_a?(Hash)
                  ext_node.lticm(:options, :name => key) do |type_node|
                    val.keys.sort.each do |p_key|
                      p_val = val[p_key]
                      type_node.lticm :property, p_val, 'name' => p_key
                    end
                  end
                else
                  ext_node.lticm :property, val, 'name' => key
                end
              end
            end
          end
        end

        blti_node.cartridge_bundle(:identifierref => @cartridge_bundle) if @cartridge_bundle
        blti_node.cartridge_icon(:identifierref => @cartridge_icon) if @cartridge_icon

      end
    end
def to_xml ( opts = { } ) builder = Builder :: XmlMarkup . new ( :indent => opts [ :indent ] || 0 ) builder . instruct! builder . cartridge_basiclti_link ( "xmlns" => "http://www.imsglobal.org/xsd/imslticc_v1p0" , "xmlns:blti" => 'http://www.imsglobal.org/xsd/imsbasiclti_v1p0' , "xmlns:lticm" => 'http://www.imsglobal.org/xsd/imslticm_v1p0' , "xmlns:lticp" => 'http://www.imsglobal.org/xsd/imslticp_v1p0' , "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance" , "xsi:schemaLocation" => "http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0p1.xsd http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd" ) do | blti_node | %w{ title description launch_url secure_launch_url icon secure_icon } . each do | key | blti_node . blti key . to_sym , self . send ( key ) if self . send ( key ) end vendor_keys = %w{ name code description url } if vendor_keys . any? { | k | self . send ( "vendor_#{k}" ) } || vendor_contact_email blti_node . blti :vendor do | v_node | vendor_keys . each do | key | v_node . lticp key . to_sym , self . send ( "vendor_#{key}" ) if self . send ( "vendor_#{key}" ) end if vendor_contact_email v_node . lticp :contact do | c_node | c_node . lticp :name , vendor_contact_name c_node . lticp :email , vendor_contact_email end end end end if ! @custom_params . empty? blti_node . tag! ( "blti:custom" ) do | custom_node | @custom_params . keys . sort . each do | key | val = @custom_params [ key ] custom_node . lticm :property , val , 'name' => key end end end if ! @extensions . empty? @extensions . keys . sort . each do | ext_platform | ext_params = @extensions [ ext_platform ] blti_node . blti ( :extensions , :platform => ext_platform ) do | ext_node | ext_params . keys . sort . each do | key | val = ext_params [ key ] if val . is_a? ( Hash ) ext_node . lticm ( :options , :name => key ) do | type_node | val . keys . sort . each do | p_key | p_val = val [ p_key ] type_node . lticm :property , p_val , 'name' => p_key end end else ext_node . lticm :property , val , 'name' => key end end end end end blti_node . cartridge_bundle ( :identifierref => @cartridge_bundle ) if @cartridge_bundle blti_node . cartridge_icon ( :identifierref => @cartridge_icon ) if @cartridge_icon end end
Generate XML from the current settings
Generate XML from the current settings