Sha256: 550ec3f4b8feb4363e30b27ae8dd0497ea3c4f0d21d4e8dd21de22b6ab8696c6

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

# unpack online resources
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2013-09-25 original script
#   Stan Smith 2014-04-23 modified for json 0.3.0
#   Stan Smith 2014-08-18 removed doi section for json 0.6.0
#   Stan Smith 2014-08-21 changed url to uri for json 0.6.0

module Adiwg_OnlineResource

	def self.unpack(hOlResource)

		# instance classes needed in script
		intMetadataClass = InternalMetadata.new
		intOLRes = intMetadataClass.newOnlineResource

		# unpack the online resource
		# resource - web link
		if hOlResource.has_key?('uri')
			s = hOlResource['uri']
			if s != ''
				intOLRes[:olResURI] = s
			end
		end

		# resource - web link protocol
		if hOlResource.has_key?('protocol')
			s = hOlResource['protocol']
			if s != ''
				intOLRes[:olResProtocol] = s
			end
		end

		# resource - web link name
		if hOlResource.has_key?('name')
			s = hOlResource['name']
			if s != ''
				intOLRes[:olResName] = s
			end
		end

		# resource - web link description
		if hOlResource.has_key?('description')
			s = hOlResource['description']
			if s != ''
				intOLRes[:olResDesc] = s
			end
		end

		# resource - web link function
		if hOlResource.has_key?('function')
			s = hOlResource['function']
			if s != ''
				intOLRes[:olResFunction] = s
			end
		end

		return intOLRes
	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_onlineResource.rb
adiwg-mdtranslator-0.8.6 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_onlineResource.rb
adiwg-mdtranslator-0.8.5 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_onlineResource.rb
adiwg-mdtranslator-0.8.2 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_onlineResource.rb
adiwg-mdtranslator-0.8.1 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_onlineResource.rb
adiwg-mdtranslator-0.8.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_onlineResource.rb