Module: Puree::XMLExtractor::ResearchOutputMixin

Included in:
Dataset, ResearchOutput
Defined in:
lib/puree/xml_extractor/mixins/research_output_mixin.rb

Overview

Research output extractor mixin.

Instance Method Summary collapse

Instance Method Details

#research_outputsArray<Puree::Model::RelatedContentHeader>

Related research outputs



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/puree/xml_extractor/mixins/research_output_mixin.rb', line 11

def research_outputs
  xpath_result = xpath_query '/relatedResearchOutputs/relatedResearchOutput'
  data_arr = []
  xpath_result.each { |i|
    related = Puree::Model::RelatedContentHeader.new
    related.uuid = i.attr('uuid').strip
    xpath_result_name = i.xpath('names/name')
    related.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
    xpath_result_type = i.xpath('types/type')
    related.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
    data_arr << related
  }
  data_arr.uniq { |d| d.uuid }
end