Sha256: 39614fd1b67bf3e091afd56769f9f233a9cec952f912427a2aae3740b4111661

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

# sbJson 1.0 writer

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

require 'jbuilder'
require_relative 'sbJson_id'
require_relative 'sbJson_citation'
require_relative 'sbJson_identifier'

module ADIWG
   module Mdtranslator
      module Writers
         module SbJson

            def self.build(intObj, responseObj)

               resourceInfo = intObj[:metadata][:resourceInfo]
               hCitation = resourceInfo[:citation]

               @Namespace = ADIWG::Mdtranslator::Writers::SbJson

               Jbuilder.new do |json|

                  # id
                  json.id Id.build(intObj)

                  # title / alternateTitles (incorporates subTitle)
                  unless hCitation.empty?
                     json.title hCitation[:title]
                     json.alternateTitles hCitation[:alternateTitles] unless hCitation[:alternateTitles].empty?
                  end

                  # body / summary
                  json.body resourceInfo[:abstract]
                  json.summary resourceInfo[:shortAbstract]

                  # citation / identifier
                  unless hCitation.empty?
                     json.citation Citation.build(hCitation)
                     json.identifiers @Namespace.json_map(hCitation[:identifiers], Identifier)
                  end

                  # purpose
                  json.purpose resourceInfo[:purpose]

                  # rights

               end

            end

         end
      end
   end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.0.0rc5 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb
adiwg-mdtranslator-2.0.0rc4 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb
adiwg-mdtranslator-2.0.0rc3 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb