class Puree::XMLExtractor::Project
Project
XML extractor.
Public Class Methods
new(xml)
click to toggle source
Calls superclass method
Puree::XMLExtractor::Resource::new
# File lib/puree/xml_extractor/project.rb, line 15 def initialize(xml) super setup_model :project end
Public Instance Methods
acronym()
click to toggle source
@return [String, nil]
# File lib/puree/xml_extractor/project.rb, line 21 def acronym xpath_query_for_single_value '/acronym' end
description()
click to toggle source
@return [String, nil]
# File lib/puree/xml_extractor/project.rb, line 26 def description xpath_query_for_single_value '/descriptions/description' end
owner()
click to toggle source
@return [Puree::Model::OrganisationalUnitHeader, nil]
# File lib/puree/xml_extractor/project.rb, line 31 def owner xpath_result = xpath_query '/owner' Puree::XMLExtractor::Shared.organisation_header xpath_result end
persons_external()
click to toggle source
@return [Array<Puree::Model::EndeavourPerson>]
# File lib/puree/xml_extractor/project.rb, line 42 def persons_external persons 'external', '/participants/participant' end
persons_internal()
click to toggle source
@return [Array<Puree::Model::EndeavourPerson>]
# File lib/puree/xml_extractor/project.rb, line 37 def persons_internal persons 'internal', '/participants/participant' end
persons_other()
click to toggle source
@return [Array<Puree::Model::EndeavourPerson>]
# File lib/puree/xml_extractor/project.rb, line 47 def persons_other persons 'other', '/participants/participant' end
status()
click to toggle source
@return [String, nil]
# File lib/puree/xml_extractor/project.rb, line 52 def status xpath_query_for_single_value '/status/value/text' end
temporal()
click to toggle source
@return [Puree::Model::TemporalRange, nil]
# File lib/puree/xml_extractor/project.rb, line 57 def temporal temporal_range '/period/startDate', '/period/endDate' end
url()
click to toggle source
@return [String, nil]
# File lib/puree/xml_extractor/project.rb, line 62 def url xpath_query_for_single_value '/links/link/url' end
Private Instance Methods
combine_metadata()
click to toggle source
Calls superclass method
Puree::XMLExtractor::Resource#combine_metadata
# File lib/puree/xml_extractor/project.rb, line 72 def combine_metadata super @model.acronym = acronym @model.description = description @model.external_organisations = external_organisations @model.identifiers = identifiers @model.organisational_units = organisational_units @model.owner = owner @model.persons_internal = persons_internal @model.persons_external = persons_external @model.persons_other = persons_other @model.status = status @model.temporal = temporal @model.title = title @model.type = type @model.url = url @model end
temporal_range(start_path, end_path)
click to toggle source
@return [Puree::Model::TemporalRange, nil]
# File lib/puree/xml_extractor/project.rb, line 92 def temporal_range(start_path, end_path) range_start = xpath_query_for_single_value start_path range_end = xpath_query_for_single_value end_path if range_start || range_end range = Puree::Model::TemporalRange.new range.start = Time.new range_start if range_start range.end = Time.new range_end if range_end return range end nil end
xpath_root()
click to toggle source
# File lib/puree/xml_extractor/project.rb, line 68 def xpath_root '/project' end