Class: Orcid::Work

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Validations
Defined in:
app/models/orcid/work.rb,
app/models/orcid/work/xml_parser.rb,
app/models/orcid/work/xml_renderer.rb

Overview

A well-defined data structure that coordinates with its :template in order to generate XML that can be POSTed/PUT as an Orcid Work.

Defined Under Namespace

Classes: ExternalIdentifier, XmlParser, XmlRenderer

Constant Summary collapse

VALID_WORK_TYPES =
%w(artistic-performance book-chapter book-review book
conference-abstract conference-paper conference-poster
data-set dictionary-entry disclosure dissertation
edited-book encyclopedia-entry invention journal-article
journal-issue lecture-speech license magazine-article
manual newsletter-article newspaper-article online-resource
other patent registered-copyright report research-technique
research-tool spin-off-company standards-and-policy
supervised-student-publication technical-standard test
translation trademark website working-paper
).freeze

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



63
64
65
66
67
68
# File 'app/models/orcid/work.rb', line 63

def ==(other)
  super ||
    other.instance_of?(self.class) &&
    id.present? &&
    other.id == id
end

#idObject



70
71
72
73
74
75
76
77
78
# File 'app/models/orcid/work.rb', line 70

def id
  if put_code.present?
    put_code
  elsif title.present? && work_type.present?
    [title, work_type]
  else
    nil
  end
end

#publication_date?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'app/models/orcid/work.rb', line 55

def publication_date?
  publication_year.present? || publication_month.present?
end

#to_xmlObject



59
60
61
# File 'app/models/orcid/work.rb', line 59

def to_xml
  XmlRenderer.call(self)
end

#work_citation?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/orcid/work.rb', line 51

def work_citation?
  citation_type.present? || citation.present?
end