Class: Puree::XMLExtractor::Project

Inherits:
Resource show all
Includes:
ExternalOrganisationsMixin
Defined in:
lib/puree/xml_extractor/project.rb

Overview

Project XML extractor.

Instance Method Summary collapse

Methods included from ExternalOrganisationsMixin

#external_organisations

Methods inherited from Resource

#created, #get_data?, #locale, #modified, #uuid, #xpath_query

Methods inherited from Base

#xpath_query_for_multi_value, #xpath_query_for_single_value

Constructor Details

#initialize(xml:) ⇒ Project

Returns a new instance of Project.



11
12
13
14
# File 'lib/puree/xml_extractor/project.rb', line 11

def initialize(xml:)
  super
  @resource_type = :project
end

Instance Method Details

#acronymString?

Returns:

  • (String, nil)


17
18
19
# File 'lib/puree/xml_extractor/project.rb', line 17

def acronym
  xpath_query_for_single_value '/acronym'
end

#descriptionString?

Returns:

  • (String, nil)


22
23
24
# File 'lib/puree/xml_extractor/project.rb', line 22

def description
  xpath_query_for_single_value '/description/localizedString'
end

#funded?Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/puree/xml_extractor/project.rb', line 27

def funded?
  xpath_result = xpath_query_for_single_value '/type'
  return false if xpath_result.downcase.include? 'nonfunded'
  true
end

#organisationsArray<Puree::Model::OrganisationHeader>



34
35
36
37
# File 'lib/puree/xml_extractor/project.rb', line 34

def organisations
  xpath_result = xpath_query '/organisations/association/organisation'
  Puree::XMLExtractor::Shared.organisation_multi_header xpath_result
end

#ownerPuree::Model::OrganisationHeader?



40
41
42
43
# File 'lib/puree/xml_extractor/project.rb', line 40

def owner
  xpath_result = xpath_query '/owner'
  Puree::XMLExtractor::Shared.organisation_header xpath_result
end

#persons_externalArray<Puree::Model::EndeavourPerson>

Returns:



51
52
53
# File 'lib/puree/xml_extractor/project.rb', line 51

def persons_external
  persons 'external'
end

#persons_internalArray<Puree::Model::EndeavourPerson>

Returns:



46
47
48
# File 'lib/puree/xml_extractor/project.rb', line 46

def persons_internal
  persons 'internal'
end

#persons_otherArray<Puree::Model::EndeavourPerson>

Returns:



56
57
58
# File 'lib/puree/xml_extractor/project.rb', line 56

def persons_other
  persons 'other'
end

#statusString?

Returns:

  • (String, nil)


61
62
63
# File 'lib/puree/xml_extractor/project.rb', line 61

def status
  xpath_query_for_single_value '/status/term/localizedString'
end

#temporal_actualPuree::Model::TemporalRange?

Returns:



71
72
73
# File 'lib/puree/xml_extractor/project.rb', line 71

def temporal_actual
  temporal_range '/startFinishDate/startDate', '/startFinishDate/endDate'
end

#temporal_expectedPuree::Model::TemporalRange?

Returns:



66
67
68
# File 'lib/puree/xml_extractor/project.rb', line 66

def temporal_expected
  temporal_range '/expectedStartDate', '/expectedEndDate'
end

#titleString?

Returns:

  • (String, nil)


76
77
78
# File 'lib/puree/xml_extractor/project.rb', line 76

def title
  xpath_query_for_single_value '/title/localizedString'
end

#typeString?

Returns:

  • (String, nil)


81
82
83
# File 'lib/puree/xml_extractor/project.rb', line 81

def type
  xpath_query_for_single_value '/typeClassification/term/localizedString'
end

#urlString?

Returns:

  • (String, nil)


86
87
88
# File 'lib/puree/xml_extractor/project.rb', line 86

def url
  xpath_query_for_single_value '/projectURL'
end