Sha256: 209668e9d4033c2988d77eb7f7750aad42b5bc0913feb4625c089682503e3770

Contents?: true

Size: 1.62 KB

Versions: 10

Compression:

Stored size: 1.62 KB

Contents

# mdJson 2.0 writer - mdJson

# History:
#   Stan Smith 2017-03-10 refactored for mdJson/mdTranslator 2.0
#   Josh Bradley original script

require 'jbuilder'
require 'rubygems'
require_relative 'mdJson_contact'
require_relative 'mdJson_metadata'
require_relative 'mdJson_dictionary'
require_relative 'mdJson_repository'

module ADIWG
   module Mdtranslator
      module Writers
         module MdJson

            module MdJson

               def self.build(intObj, hResponseObj)

                  Jbuilder.new do |json|

                     # mdJson - schema (required)
                     json.schema do
                        json.name 'mdJson'
                        json.version hResponseObj[:writerVersion]
                     end

                     # mdJson - contacts [] (required)
                     json.contact intObj[:contacts].map { |obj| Contact.build(obj).attributes! }

                     # mdJson - metadata (required)
                     json.metadata Metadata.build(intObj[:metadata])

                     # mdJson - dataDictionaries []
                     unless intObj[:dataDictionaries].empty?
                        json.dataDictionary intObj[:dataDictionaries].map { |obj| Dictionary.build(obj).attributes! }
                     end

                     # mdJson - metadataRepositories []
                     unless intObj[:metadataRepositories].empty?
                        json.metadataRepository intObj[:metadataRepositories].map { |obj| Repository.build(obj).attributes! }
                     end

                  end

               end # build
            end # MdJson

         end
      end
   end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.13.0 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.12.0 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.12.0.pre lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.10.0 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb