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

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.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 56

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

Instance Attribute Details

#biographical_noteObject (readonly)

biografia



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

def biographical_note
  @biographical_note
end

#corporate_nameObject (readonly)

Returns the value of attribute corporate_name.



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

def corporate_name
  @corporate_name
end

#corporate_name_invertedObject (readonly)

Returns the value of attribute corporate_name_inverted.



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

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



26
27
28
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 26

def from_language
  @from_language
end

#key_namesObject (readonly)

nazwisko lub nazwiska



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

def key_names
  @key_names
end

#names_after_keyObject (readonly)

dodatkowe oznaczenia, np. OHP (zakon)



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

def names_after_key
  @names_after_key
end

#names_before_keyObject (readonly)

imię lub imiona



32
33
34
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 32

def names_before_key
  @names_before_key
end

#numberObject (readonly)

:nodoc:



11
12
13
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 11

def number
  @number
end

#person_nameObject (readonly)

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



19
20
21
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 19

def person_name
  @person_name
end

#person_name_invertedObject (readonly)

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



22
23
24
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 22

def person_name_inverted
  @person_name_inverted
end

#prefix_to_keyObject (readonly)

prefix przed nazwiskiem, np. von, van



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

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



16
17
18
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 16

def role
  @role
end

#titles_before_namesObject (readonly)

tytuł naukowy, np. prof.



29
30
31
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 29

def titles_before_names
  @titles_before_names
end

#to_xmlObject (readonly)

reprezentacja danych w xml-u



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

def to_xml
  @to_xml
end

#unnamed_personsObject (readonly)

:nodoc:



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

def unnamed_persons
  @unnamed_persons
end

Instance Method Details

#inspect_include_fieldsObject



80
81
82
# File 'lib/elibri_onix/onix_3_0/contributor.rb', line 80

def inspect_include_fields
  [:role_name, :person_name]
end

#role_nameObject



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

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