Sha256: 1974a31b3dc68e2be05f7dc743a9a944ff56a8a923e91a87b383036b66ae956a

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

# unpack resource maintenance
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2013-10-31 original script
# 	Stan Smith 2013-12-18 made note an array
# 	Stan Smith 2013-12-18 added contact
#   Stan Smith 2014-04-24 modified for json schema 0.3.0
#   Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module

require ADIWG::Mdtranslator.reader_module('module_responsibleParty', $response[:readerVersionUsed])

module Adiwg_ResourceMaintenance

	def self.unpack(hResource)

		# instance classes needed in script
		intMetadataClass = InternalMetadata.new
		intResMaint = intMetadataClass.newResourceMaint

		# resource maintenance - frequency code
		if hResource.has_key?('maintenanceFrequency')
			s = hResource['maintenanceFrequency']
			if s != ''
				intResMaint[:maintFreq] = s
			end
		end

		# resource maintenance - maintenance note
		if hResource.has_key?('maintenanceNote')
			aNotes = hResource['maintenanceNote']
			unless aNotes.empty?
				intResMaint[:maintNotes] = aNotes
			end
		end

		# resource maintenance - contact
		if hResource.has_key?('maintenanceContact')
			aContact = hResource['maintenanceContact']
			unless aContact.empty?
				aContact.each do |hContact|
					intResMaint[:maintContacts] << Adiwg_ResponsibleParty.unpack(hContact)
				end
			end
		end

		return intResMaint
	end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.9.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_resourceMaintenance.rb
adiwg-mdtranslator-0.8.6 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_resourceMaintenance.rb
adiwg-mdtranslator-0.8.5 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_resourceMaintenance.rb
adiwg-mdtranslator-0.8.2 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_resourceMaintenance.rb
adiwg-mdtranslator-0.8.1 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_resourceMaintenance.rb
adiwg-mdtranslator-0.8.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_resourceMaintenance.rb