Sha256: 61d3a5ff5116c3d9b61fe71a9e5e9fa330a756dcafa532b5869bdbe994addfc4

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

# ISO <<Class>> MD_Vouchers
# writer output in XML

# History:
# 	Stan Smith 2013-11-19 original script
#   Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
#   Stan Smith 2014-12-12 refactored to handle namespacing readers and writers

require 'class_responsibleParty'

module ADIWG
    module Mdtranslator
        module Writers
            module Iso

                class MD_Vouchers

                    def initialize(xml)
                        @xml = xml
                    end

                    def writeXML(hVoucher)

                        # classes used in MD_Vouchers
                        rPartyClass = $WriterNS::CI_ResponsibleParty.new(@xml)

                        @xml.tag!('gmd:MD_Vouchers') do

                            # voucher - specimen - required
                            s = hVoucher[:specimen]
                            if s.nil?
                                @xml.tag!('gmd:specimen', {'gco:nilReason' => 'missing'})
                            else
                                @xml.tag!('gmd:specimen') do
                                    @xml.tag!('gco:CharacterString', s)
                                end
                            end

                            # voucher - repository - required - MD_ResponsibleParty
                            hContacts = hVoucher[:repository]
                            if hContacts.empty?
                                @xml.tag!('gmd:reposit', {'gco:nilReason' => 'missing'})
                            else
                                @xml.tag!('gmd:reposit') do
                                    rPartyClass.writeXML(hContacts)
                                end

                            end

                        end

                    end

                end

            end
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.12.1 lib/adiwg/mdtranslator/writers/iso/classes/class_vouchers.rb
adiwg-mdtranslator-0.12.0 lib/adiwg/mdtranslator/writers/iso/classes/class_vouchers.rb