module Puree::XMLExtractor::ResearchOutputMixin

Research output extractor mixin.

Public Instance Methods

research_outputs() click to toggle source

Related research outputs @return [Array<Puree::Model::RelatedContentHeader>]

# 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('name/text')
    related.title = xpath_result_name.first.text.strip unless xpath_result_name.empty?
    xpath_result_type = i.xpath('type/term/text')
    related.type = xpath_result_type.first.text.strip unless xpath_result_type.empty?
    data_arr << related
  }
  data_arr.uniq { |d| d.uuid }
end