Class: Puree::XMLExtractor::JournalArticle

Inherits:
Publication show all
Includes:
PageRangeMixin, PagesMixin, PeerReviewedMixin
Defined in:
lib/puree/xml_extractor/journal_article.rb

Overview

Journal article XML extractor.

Instance Method Summary collapse

Methods included from PeerReviewedMixin

#peer_reviewed

Methods included from PageRangeMixin

#page_range

Methods included from PagesMixin

#pages

Methods inherited from Publication

#bibliographical_note, #category, #description, #dois, #files, #keywords, #language, #links, #organisations, #owner, #persons_external, #persons_internal, #persons_other, #publication_place, #publisher, #statuses, #subtitle, #title, #translated_subtitle, #translated_title, #type

Methods included from WorkflowStateMixin

#workflow_state

Methods included from ExternalOrganisationsMixin

#external_organisations

Methods included from AssociatedMixin

#associated

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:) ⇒ JournalArticle

Returns a new instance of JournalArticle.



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

def initialize(xml:)
  super
end

Instance Method Details

#article_numberFixnum?

Returns:

  • (Fixnum, nil)


16
17
18
# File 'lib/puree/xml_extractor/journal_article.rb', line 16

def article_number
  xpath_query_for_single_value('/articleNumber')
end

#issueFixnum?

Returns:

  • (Fixnum, nil)


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

def issue
  xpath_result = xpath_query_for_single_value('/journalNumber')
  xpath_result ? xpath_result.to_i : nil
end

#journalPuree::Model::JournalHeader?

Returns:



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/puree/xml_extractor/journal_article.rb', line 27

def journal
  xpath_result = xpath_query '/journal'
  if !xpath_result.empty?
    header = Puree::Model::JournalHeader.new
    header.title = xpath_result.xpath('title').text.strip
    journal = xpath_result.xpath('journal')
    header.type = journal.xpath('typeClassification/term/localizedString').text.strip
    header.uuid = journal.attr('uuid').text.strip
    return header
  end
  nil
end

#volumeFixnum?

Returns:

  • (Fixnum, nil)


41
42
43
44
# File 'lib/puree/xml_extractor/journal_article.rb', line 41

def volume
  xpath_result = xpath_query_for_single_value('/volume')
  xpath_result ? xpath_result.to_i : nil
end