Class: ADIWG::Mdtranslator::Writers::Fgdc::Publisher

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj) ⇒ Publisher

Returns a new instance of Publisher.



17
18
19
20
21
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb', line 17

def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
end

Instance Method Details

#writeXML(hContact) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb', line 23

def writeXML(hContact)

   # publication 8.8.1 (pubplace) - publication place
   # <- hContact[:addresses][:description] (required)
   place = ''
   unless hContact[:addresses].empty?
      hAddress = hContact[:addresses][0]
      unless hAddress.empty?
         description = hAddress[:description]
         city = hAddress[:city]
         state = hAddress[:adminArea]
         country = hAddress[:country]
         place = ''
         place += city unless city.nil?
         place += ', ' + state unless state.nil?
         place += ', ' + country unless country.nil?
         if place.empty?
            unless description.nil?
               place = description
            end
         end
      end
      unless place.empty?
         @xml.tag!('pubplace', place)
      end
   end
   if place == ''
      @NameSpace.issueWarning(330, 'pubplace', 'identification information citation')
   end

   # publication 8.8.2 (publish) - publisher name
   # <- hContact[:name] (required)
   name = hContact[:name]
   unless name.nil?
      @xml.tag!('publish', name)
   end
   if name.nil?
      @NameSpace.issueWarning(331, 'publish', 'identification information citation')
   end

end