class Elibri::ONIX::Release_3_0::SupportingResource

Constants

ATTRIBUTES

from ONIX documentation: An optional and repeatable group of data elements which together describe a supporting resource.

RELATIONS

Attributes

content_type[RW]
data[RW]
form[RW]
mode[RW]
to_xml[RW]

Public Class Methods

new(data) click to toggle source
# File lib/elibri_onix/onix_3_0/supporting_resource.rb, line 25
def initialize(data)
  @data = data
  @to_xml = data.to_s
  @content_type = data.at_css('ResourceContentType').try(:text)
  @mode = data.at_css('ResourceMode').try(:text)
  @form = data.at_css('ResourceVersion').at_css('ResourceForm').try(:text)
  @link = data.at_css('ResourceVersion').at_css('ResourceLink').try(:text)
  set_eid(data)
  set_datestamp(data)
end

Public Instance Methods

content_type_name() click to toggle source
# File lib/elibri_onix/onix_3_0/supporting_resource.rb, line 36
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() click to toggle source
# File lib/elibri_onix/onix_3_0/supporting_resource.rb, line 53
def form_name
  Elibri::ONIX::Dict::Release_3_0::ResourceForm.find_by_onix_code(@form).const_name.downcase
end
inspect_include_fields() click to toggle source
# File lib/elibri_onix/onix_3_0/supporting_resource.rb, line 57
def inspect_include_fields
  [:content_type_name, :mode_name, :form_name]
end
mode_name() click to toggle source

def audience_name

Elibri::ONIX::Dict::Release_3_0::ContentAudience.find_by_onix_code(audience).const_name.downcase

end

# File lib/elibri_onix/onix_3_0/supporting_resource.rb, line 49
def mode_name
  Elibri::ONIX::Dict::Release_3_0::ResourceMode.find_by_onix_code(@mode).const_name.downcase
end