Sha256: 5c2e87d2d1659e12024fd3b2011060344837049597c5ce4be5e37194b1714385

Contents?: true

Size: 1.87 KB

Versions: 8

Compression:

Stored size: 1.87 KB

Contents

# unpack metadata distribution
# Reader - ADIwg JSON to internal data structure

# History:
# 	Stan Smith 2017-02-09 original script

module ADIWG
    module Mdtranslator
        module Readers
            module MdJson

                module MetadataRepository

                    def self.unpack(hMdDist, responseObj)

                        # return nil object if input is empty
                        if hMdDist.empty?
                            responseObj[:readerExecutionMessages] << 'Metadata Repository object is empty'
                            responseObj[:readerExecutionPass] = false
                            return nil
                        end

                        # instance classes needed in script
                        intMetadataClass = InternalMetadata.new
                        intMdDist = intMetadataClass.newMetadataRepository

                        # metadata distribution - repository (required)
                        if hMdDist.has_key?('repository')
                            intMdDist[:repository] = hMdDist['repository']
                        end
                        if intMdDist[:repository].nil? || intMdDist[:repository] == ''
                            responseObj[:readerExecutionMessages] << 'Metadata Repository repository is missing'
                            responseObj[:readerExecutionPass] = false
                            return nil
                        end

                        # metadata distribution - metadata format
                        if hMdDist.has_key?('metadataStandard')
                            if hMdDist['metadataStandard'] != ''
                                intMdDist[:metadataStandard] = hMdDist['metadataStandard']
                            end
                        end

                        return intMdDist

                    end

                end

            end
        end
    end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.0.0rc9 lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb
adiwg-mdtranslator-2.0.0rc8 lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb
adiwg-mdtranslator-2.0.0rc7 lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb
adiwg-mdtranslator-2.0.0rc6 lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb
adiwg-mdtranslator-2.0.0rc5 lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb
adiwg-mdtranslator-2.0.0rc4 lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb
adiwg-mdtranslator-2.0.0rc3 lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb
adiwg-mdtranslator-2.0.0rc2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb