Sha256: 618c438bcc33415f401ece47aa96727188ec59a3d476fd24ad86fcf1a2f2d24f

Contents?: true

Size: 1.82 KB

Versions: 35

Compression:

Stored size: 1.82 KB

Contents

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

# History:
#  Stan Smith 2018-06-26 refactored error and warning messaging
#  Stan Smith 2016-12-09 original script

require_relative 'module_citation'

module ADIWG
   module Mdtranslator
      module Readers
         module MdJson

            module TaxonomicSystem

               def self.unpack(hSystem, responseObj)

                  @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson

                  # return nil object if input is empty
                  if hSystem.empty?
                     @MessagePath.issueWarning(820, responseObj)
                     return nil
                  end

                  # instance classes needed in script
                  intMetadataClass = InternalMetadata.new
                  intSystem = intMetadataClass.newTaxonSystem

                  # taxonomy system - citation (required) {CI_Citation}
                  if hSystem.has_key?('citation')
                     hCitation = hSystem['citation']
                     unless hCitation.empty?
                        hReturn = Citation.unpack(hCitation, responseObj)
                        unless hReturn.nil?
                           intSystem[:citation] = hReturn
                        end
                     end
                  end
                  if intSystem[:citation].empty?
                     @MessagePath.issueError(821, responseObj)
                  end

                  # taxonomy system - modifications
                  if hSystem.has_key?('modifications')
                     unless hSystem['modifications'] == ''
                        intSystem[:modifications] = hSystem['modifications']
                     end
                  end

                  return intSystem

               end

            end

         end
      end
   end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.19.0.pre.beta.31 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.30 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.29 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.28 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.27 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.26 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.13 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.12 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.11 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.10 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.9 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.8 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.19.0.pre.beta.7 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.18.4 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.18.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.18.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.18.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.18.0rc9 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.18.0rc8 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb
adiwg-mdtranslator-2.18.0rc7 lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb