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.8.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.6.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.5.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.4.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.3.5 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.3.4 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.3.3 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.3.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.3.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.3.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.2.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.1.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.1.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.1.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.0.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.0.0rc13 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.0.0rc11 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb
adiwg-mdtranslator-2.0.0rc10 lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb