Class: Elibri::ONIX::Release_3_0::SupportingResource
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::SupportingResource
- Includes:
- ExternalId, ExternalTimestamp, Inspector
- Defined in:
- lib/elibri_onix/onix_3_0/supporting_resource.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#data ⇒ Object
Returns the value of attribute data.
-
#form ⇒ Object
Returns the value of attribute form.
-
#link ⇒ Object
Returns the value of attribute link.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#to_xml ⇒ Object
Returns the value of attribute to_xml.
Instance Method Summary collapse
- #content_type_name ⇒ Object
- #form_name ⇒ Object
-
#initialize(data) ⇒ SupportingResource
constructor
A new instance of SupportingResource.
- #inspect_include_fields ⇒ Object
-
#mode_name ⇒ Object
def audience_name Elibri::ONIX::Dict::Release_3_0::ContentAudience.find_by_onix_code(audience).const_name.downcase end.
Methods included from Inspector
#attribute_for_inspect, #inspect
Methods included from ExternalTimestamp
#datestamp, included, #set_datestamp
Methods included from ExternalId
Constructor Details
#initialize(data) ⇒ SupportingResource
Returns a new instance of SupportingResource.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 12 def initialize(data) @data = data @to_xml = data.to_s @content_type = data.at_css('ResourceContentType')&.text @mode = data.at_css('ResourceMode')&.text @form = data.at_css('ResourceVersion').at_css('ResourceForm')&.text @link = data.at_css('ResourceVersion').at_css('ResourceLink')&.text set_eid(data) set_datestamp(data) end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
10 11 12 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 10 def content_type @content_type end |
#data ⇒ Object
Returns the value of attribute data.
10 11 12 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 10 def data @data end |
#form ⇒ Object
Returns the value of attribute form.
10 11 12 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 10 def form @form end |
#link ⇒ Object
Returns the value of attribute link.
10 11 12 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 10 def link @link end |
#mode ⇒ Object
Returns the value of attribute mode.
10 11 12 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 10 def mode @mode end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
10 11 12 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 10 def to_xml @to_xml end |
Instance Method Details
#content_type_name ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 23 def content_type_name content_type = Elibri::ONIX::Dict::Release_3_0::ResourceContentType.find_by_onix_code(@content_type) if content_type content_type.const_name.downcase else raise ArgumentError, "Cannot find ResourceContentType for #{@content_type}" end end |
#form_name ⇒ Object
40 41 42 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 40 def form_name Elibri::ONIX::Dict::Release_3_0::ResourceForm.find_by_onix_code(@form).const_name.downcase end |
#inspect_include_fields ⇒ Object
44 45 46 |
# File 'lib/elibri_onix/onix_3_0/supporting_resource.rb', line 44 def inspect_include_fields [:content_type_name, :mode_name, :form_name] end |