Class: Elibri::ONIX::Release_3_0::Publisher

Inherits:
Object
  • Object
show all
Includes:
Inspector
Defined in:
lib/elibri_onix/onix_3_0/publisher.rb

Constant Summary collapse

ATTRIBUTES =
[
  :role, :name, :eid
]
RELATIONS =
[]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inspector

#attribute_for_inspect, #inspect

Constructor Details

#initialize(data) ⇒ Publisher

Returns a new instance of Publisher.



28
29
30
31
32
33
34
35
# File 'lib/elibri_onix/onix_3_0/publisher.rb', line 28

def initialize(data)
  @to_xml = data.to_s
  @role = data.at_xpath('xmlns:PublishingRole').try(:text)
  @name = data.at_xpath('xmlns:PublisherName').try(:text)
  if data.at_xpath('xmlns:PublisherIdentifier')
    @eid = data.at_xpath('xmlns:PublisherIdentifier').at_xpath('xmlns:IDValue').try(:text).try(:to_i)
  end
end

Instance Attribute Details

#eidObject

role występuje w tej chwili tylko 01 - główny wydawca



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

def eid
  @eid
end

#nameObject

role występuje w tej chwili tylko 01 - główny wydawca



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

def name
  @name
end

#roleObject

role występuje w tej chwili tylko 01 - główny wydawca



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

def role
  @role
end

#to_xmlObject

role występuje w tej chwili tylko 01 - główny wydawca



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

def to_xml
  @to_xml
end

Instance Method Details

#idObject



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

def id
  Kernel.warn "[DEPRECATION] `id` is deprecated. Please use `eid` instead."
  @eid
end

#inspect_include_fieldsObject



37
38
39
# File 'lib/elibri_onix/onix_3_0/publisher.rb', line 37

def inspect_include_fields
  [:eid, :name]
end