Sha256: fddd6104d73df98fac2e6535e7ed8dae1bed097b98514f7d20ffe66f07974d61

Contents?: true

Size: 1.79 KB

Versions: 31

Compression:

Stored size: 1.79 KB

Contents

# unpack resourceType
# Reader - ADIwg JSON to internal data structure

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

module ADIWG
    module Mdtranslator
        module Readers
            module MdJson

                module ResourceType

                    def self.unpack(hType, responseObj)

                        # return nil object if input is empty
                        if hType.empty?
                            responseObj[:readerExecutionMessages] << 'Resource Type object is empty'
                            responseObj[:readerExecutionPass] = false
                            return nil
                        end

                        # instance classes needed in script
                        intMetadataClass = InternalMetadata.new
                        intType = intMetadataClass.newResourceType

                        # resource type - type (required) {MD_ScopeCode}
                        if hType.has_key?('type')
                            if hType['type'] != ''
                                intType[:type] = hType['type']
                            end
                        end
                        if intType[:type].nil?
                            responseObj[:readerExecutionMessages] << 'Resource Type object is missing type'
                            responseObj[:readerExecutionPass] = false
                            return nil
                        end

                        # resource type - name
                        if hType.has_key?('name')
                            if hType['name'] != ''
                                intType[:name] = hType['name']
                            end
                        end

                        return intType

                    end

                end

            end
        end
    end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.6.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.5.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.4.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.3.5 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.3.4 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.3.3 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.3.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.3.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.3.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.2.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.1.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.1.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.1.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb
adiwg-mdtranslator-2.0.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb