Module: Adiwg_Contact

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

Class Method Summary collapse

Class Method Details

.setDefaultContactsObject



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_contacts.rb', line 93

def self.setDefaultContacts()

  # add default contacts
  intMetadataClass = .new
  aDefContacts = Array.new

  # contact to support biological extensions
  intCont = intMetadataClass.newContact
  intCont[:contactID] = 'ADIwgBio'
  intCont[:orgName] = 'National Biological Information Infrastructure (NBII)'
  aDefContacts << intCont

  # contact to support doi (digital object identifier)
  intCont = intMetadataClass.newContact
  intCont[:contactID] = 'ADIwgDOI'
  intCont[:orgName] = 'International DOI Foundation (IDF)'

  intOlRes = intMetadataClass.newOnlineResource
  intOlRes[:olResURI] = 'http://www.doi.org'
  intCont[:onlineRes] << intOlRes

  aDefContacts << intCont

  return aDefContacts

end

.unpack(hContact) ⇒ Object



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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_contacts.rb', line 19

def self.unpack(hContact)

  # instance classes needed in script
  intMetadataClass = .new
  intCont = intMetadataClass.newContact

  # contact ID
  if hContact.has_key?('contactId')
    s = hContact['contactId']
    if s != ''
      intCont[:contactID] = s
    end
  end

  # individual name
  if hContact.has_key?('individualName')
    s = hContact['individualName']
    if s != ''
      intCont[:indName] = s
    end
  end

  # organization name
  if hContact.has_key?('organizationName')
    s = hContact['organizationName']
    if s != ''
      intCont[:orgName] = s
    end
  end

  # position name
  if hContact.has_key?('positionName')
    s = hContact['positionName']
    if s != ''
      intCont[:position] = s
    end
  end

  # online resources
  if hContact.has_key?('onlineResource')
    aOlRes = hContact['onlineResource']
    aOlRes.each do |hOlRes|
      unless hOlRes.empty?
        intCont[:onlineRes] << Adiwg_OnlineResource.unpack(hOlRes)
      end
    end
  end

  # contact instructions
  if hContact.has_key?('contactInstructions')
    s = hContact['contactInstructions']
    if s != ''
      intCont[:contactInstructions] = s
    end
  end

  # phones - all service types
  if hContact.has_key?('phoneBook')
    aPhones = hContact['phoneBook']
    aPhones.each do |hPhone|
      intCont[:phones].concat(Adiwg_Phone.unpack(hPhone))
    end
  end

  # address
  if hContact.has_key?('address')
    conAddress = hContact['address']
    intCont[:address] = Adiwg_Address.unpack(conAddress)
  end

  return intCont

end