Module: Adiwg_OnlineResource

Defined in:
lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_onlineResource.rb

Overview

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

Class Method Summary collapse

Class Method Details

.unpack(hOlResource) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_onlineResource.rb', line 12

def self.unpack(hOlResource)

  # instance classes needed in script
  intMetadataClass = .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