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, included, #set_eid

Constructor Details

#initialize(data) ⇒ Contributor

Returns a new instance of Contributor.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 79

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

Instance Attribute Details

#biographical_noteObject (readonly)

biografia



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

def biographical_note
  @biographical_note
end

#corporate_nameObject (readonly)

Returns the value of attribute corporate_name.



72
73
74
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 72

def corporate_name
  @corporate_name
end

#corporate_name_invertedObject (readonly)

Returns the value of attribute corporate_name_inverted.



73
74
75
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 73

def corporate_name_inverted
  @corporate_name_inverted
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



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

def from_language
  @from_language
end

#key_namesObject (readonly)

nazwisko lub nazwiska



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

def key_names
  @key_names
end

#names_after_keyObject (readonly)

dodatkowe oznaczenia, np. OHP (zakon)



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

def names_after_key
  @names_after_key
end

#names_before_keyObject (readonly)

imię lub imiona



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

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

#person_name_invertedObject (readonly)

jednak czasami, nie ma :person_name, jest za to :person_name_inverted - e-isbn



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

def person_name_inverted
  @person_name_inverted
end

#prefix_to_keyObject (readonly)

prefix przed nazwiskiem, np. von, van



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

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.



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

def titles_before_names
  @titles_before_names
end

#to_xmlObject (readonly)

reprezentacja danych w xml-u



76
77
78
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 76

def to_xml
  @to_xml
end

#unnamed_personsObject (readonly)

:nodoc:



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

def unnamed_persons
  @unnamed_persons
end

Instance Method Details

#inspect_include_fieldsObject



103
104
105
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 103

def inspect_include_fields
  [:role_name, :person_name]
end

#role_nameObject



99
100
101
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 99

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