Sha256: 533aad60c862b0a1823ce7a64ea9d63b79d05521661047607feef645b436b82f

Contents?: true

Size: 1.88 KB

Versions: 28

Compression:

Stored size: 1.88 KB

Contents

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

# History:
#   Stan Smith 2016-10-21 original script

require_relative 'module_distributor'

module ADIWG
    module Mdtranslator
        module Readers
            module MdJson

                module Distribution

                    def self.unpack(hDistribution, responseObj)

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

                        # instance classes needed in script
                        intMetadataClass = InternalMetadata.new
                        intDistribution = intMetadataClass.newDistribution

                        # distribution - description
                        if hDistribution.has_key?('description')
                            if hDistribution['description'] != ''
                                intDistribution[:description] = hDistribution['description']
                            end
                        end

                        # distribution - distributor [distributor]
                        if hDistribution.has_key?('distributor')
                            aItems = hDistribution['distributor']
                            aItems.each do |item|
                                hReturn = Distributor.unpack(item, responseObj)
                                unless hReturn.nil?
                                    intDistribution[:distributor] << hReturn
                                end
                            end
                        end

                        return intDistribution

                    end

                end

            end
        end
    end
end

Version data entries

28 entries across 28 versions & 1 rubygems

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