Class: Elibri::ONIX::Release_3_0::Contributor

Inherits:
Object
  • Object
show all
Includes:
ExternalId, ExternalTimestamp, Inspector
Defined in:
lib/elibri_onix/onix_3_0/contributor.rb

Constant Summary collapse

ATTRIBUTES =

:nodoc:

[
  :number, :role, :person_name, :from_language, :titles_before_names, :names_before_key, :prefix_to_key,
  :key_names, :names_after_key, :biographical_note, :unnamed_persons, :role_name
]
RELATIONS =

:nodoc:

[
  :inspect_include_fields
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inspector

#attribute_for_inspect, #inspect

Methods included from ExternalTimestamp

#datestamp, included, #set_datestamp

Methods included from ExternalId

#eid, #id, included, #set_eid

Constructor Details

#initialize(data) ⇒ Contributor

Returns a new instance of Contributor.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 73

def initialize(data)
  @to_xml = data.to_s
  @number = data.at_xpath('xmlns:SequenceNumber').try(:text).try(:to_i)
  @role = data.at_xpath('xmlns:ContributorRole').try(:text)
  @person_name = data.at_xpath('xmlns:PersonName').try(:text)
  @from_language = data.at_xpath('xmlns:FromLanguage').try(:text)
  @titles_before_names = data.at_xpath('xmlns:TitlesBeforeNames').try(:text)
  @names_before_key = data.at_xpath('xmlns:NamesBeforeKey').try(:text)
  @prefix_to_key = data.at_xpath('xmlns:PrefixToKey').try(:text)
  @key_names = data.at_xpath('xmlns:KeyNames').try(:text)
  @names_after_key = data.at_xpath('xmlns:NamesAfterKey').try(:text)
  @biographical_note = data.at_xpath('xmlns:BiographicalNote').try(:text)
  @unnamed_persons = data.at_xpath('xmlns:UnnamedPersons').try(:text)
  set_eid(data)
  set_datestamp(data)
end

Instance Attribute Details

#biographical_noteObject (readonly)

biografia



64
65
66
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 64

def biographical_note
  @biographical_note
end

#from_languageObject (readonly)

w przypadku tłumacza kod języka oryginału, lista języków dostępna pod adresem github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/LanguageCode.yml



46
47
48
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 46

def from_language
  @from_language
end

#key_namesObject (readonly)

nazwisko lub nazwiska



58
59
60
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 58

def key_names
  @key_names
end

#names_after_keyObject (readonly)

dodatkowe oznaczenia, np. OHP (zakon)



61
62
63
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 61

def names_after_key
  @names_after_key
end

#names_before_keyObject (readonly)

imię lub imiona



52
53
54
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 52

def names_before_key
  @names_before_key
end

#numberObject (readonly)

:nodoc:



34
35
36
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 34

def number
  @number
end

#person_nameObject (readonly)

pełne imię i nazwisko - to pole jest zawsze uzupełnione



42
43
44
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 42

def person_name
  @person_name
end

#prefix_to_keyObject (readonly)

prefix przed nazwiskiem, np. von, van



55
56
57
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 55

def prefix_to_key
  @prefix_to_key
end

#roleObject (readonly)

:doc: kod ONIX dla roli - np. ‘A01’ - autor, pełna lista pod adresem github.com/elibri/elibri_onix_dict/blob/master/lib/elibri_onix_dict/onix_3_0/serialized/ProductFormCode.yml



39
40
41
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 39

def role
  @role
end

#titles_before_namesObject (readonly)

tytuł naukowy, np. prof.



49
50
51
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 49

def titles_before_names
  @titles_before_names
end

#to_xmlObject (readonly)

reprezentacja danych w xml-u



70
71
72
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 70

def to_xml
  @to_xml
end

#unnamed_personsObject (readonly)

:nodoc:



67
68
69
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 67

def unnamed_persons
  @unnamed_persons
end

Instance Method Details

#inspect_include_fieldsObject



94
95
96
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 94

def inspect_include_fields
  [:role_name, :person_name]
end

#role_nameObject



90
91
92
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 90

def role_name
  Elibri::ONIX::Dict::Release_3_0::ContributorRole.find_by_onix_code(@role).const_name.downcase
end