Module: Puree::XMLExtractor::Shared

Defined in:
lib/puree/xml_extractor/shared.rb

Overview

Shared XML extractor.

Class Method Summary collapse

Class Method Details

.organisation_header(nokogiri_xml_element) ⇒ Puree::Model::OrganisationHeader



10
11
12
13
14
15
16
# File 'lib/puree/xml_extractor/shared.rb', line 10

def self.organisation_header(nokogiri_xml_element)
  h = Puree::Model::OrganisationHeader.new
  h.uuid = nokogiri_xml_element.xpath('@uuid').text.strip
  h.name = nokogiri_xml_element.xpath('name/localizedString').text.strip
  h.type = nokogiri_xml_element.xpath('typeClassification/term/localizedString').text.strip
  h
end

.organisation_multi_header(nokogiri_xml_nodeset) ⇒ Array<Puree::Model::OrganisationHeader>



19
20
21
22
23
24
25
# File 'lib/puree/xml_extractor/shared.rb', line 19

def self.organisation_multi_header(nokogiri_xml_nodeset)
  data = []
  nokogiri_xml_nodeset.each do |i|
    data << organisation_header(i)
  end
  data.uniq { |d| d.uuid }
end