Class: Puree::XMLExtractor::JournalArticle
- Inherits:
-
ResearchOutput
- Object
- Base
- Resource
- ResearchOutput
- Puree::XMLExtractor::JournalArticle
- Includes:
- PageRangeMixin, PagesMixin, PeerReviewedMixin
- Defined in:
- lib/puree/xml_extractor/journal_article.rb
Overview
Journal article XML extractor.
Instance Method Summary collapse
-
#initialize(xml) ⇒ JournalArticle
constructor
A new instance of JournalArticle.
- #issue ⇒ Integer?
- #journal ⇒ Puree::Model::JournalHeader?
- #volume ⇒ Integer?
Methods included from PeerReviewedMixin
Methods included from PageRangeMixin
Methods included from PagesMixin
Methods inherited from ResearchOutput
#bibliographical_note, #category, #doi, #dois, #files, #keywords, #language, #links, #open_access_permission, #persons_external, #persons_internal, #persons_other, #publication_statuses, #scopus_citations_count, #scopus_id, #scopus_metrics, #subtitle, #title, #translated_subtitle, #translated_title
Methods included from TypeMixin
Methods included from WorkflowMixin
Methods included from ResearchOutputMixin
Methods included from ProjectMixin
Methods included from OwnerMixin
Methods included from OrganisationalUnitMixin
Methods included from AbstractMixin
Methods inherited from Resource
#created_at, #created_by, #id, #model, #modified_at, #modified_by, #previous_uuids, #uuid
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 14 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 11 def initialize(xml) super setup_model :journal_article end |
Instance Method Details
#issue ⇒ Integer?
17 18 19 20 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 17 def issue xpath_result = xpath_query_for_single_value('/journalNumber') xpath_result ? xpath_result.to_i : nil end |
#journal ⇒ Puree::Model::JournalHeader?
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 23 def journal xpath_result = xpath_query '/journalAssociation' if !xpath_result.empty? header = Puree::Model::JournalHeader.new header.title = xpath_result.xpath('title').text.strip journal = xpath_result.xpath('journal') xpath_result_type = journal.xpath('types/type') header.type = xpath_result_type.first.text.strip unless xpath_result_type.empty? header.uuid = journal.attr('uuid').text.strip header end end |
#volume ⇒ Integer?
37 38 39 40 |
# File 'lib/puree/xml_extractor/journal_article.rb', line 37 def volume xpath_result = xpath_query_for_single_value('/volume') xpath_result ? xpath_result.to_i : nil end |