lib/otrs/sopm.rb
# Creates an OPM string out of the SOPM file.
#
# @return [String] OPM XML content with Base64 encoded files.
Creates an OPM string out of the SOPM file.
Creates an OPM string out of the SOPM file .
def opm
      opm = @sopm
      folder = File.dirname(@sopm_file)
      files_nodes = opm.xpath('/otrs_package/Filelist/File')
      files_nodes.each { |files_node|
        file_location = files_node['Location']
        file          = File.open("#{folder}/#{file_location}", 'r')
        file_content  = file.read
        file.close
        files_node['Encode'] = 'Base64'
        files_node.content   = Base64.strict_encode64( file_content )
      }
      opm.to_xml
    end
def opm opm = @sopm folder = File . dirname ( @sopm_file ) files_nodes = opm . xpath ( '/otrs_package/Filelist/File' ) files_nodes . each { | files_node | file_location = files_node [ 'Location' ] file = File . open ( "#{folder}/#{file_location}" , 'r' ) file_content = file . read file . close files_node [ 'Encode' ] = 'Base64' files_node . content = Base64 . strict_encode64 ( file_content ) } opm . to_xml end
Creates an OPM string out of the SOPM file.
Creates an OPM string out of the SOPM file .
OPM XML content with Base64 encoded files.
OPM XML content with Base64 encoded files .
String