class Elibri::ONIX::Release_3_0::TitleDetail
Constants
- ATTRIBUTES
- RELATIONS
Attributes
elements[RW]
to_xml[RW]
type[RW]
Public Class Methods
new(data)
click to toggle source
# File lib/elibri_onix/onix_3_0/title_detail.rb, line 27 def initialize(data) @to_xml = data.to_s @type = data.at_css('TitleType').try(:text) @elements = data.css('TitleElement').map { |element_data| TitleElement.new(element_data) } end
Public Instance Methods
collection_level()
click to toggle source
# File lib/elibri_onix/onix_3_0/title_detail.rb, line 63 def collection_level @elements.find {|element| element.level == "02"} end
collection_level_title()
click to toggle source
# File lib/elibri_onix/onix_3_0/title_detail.rb, line 59 def collection_level_title collection_level.try(:full_title) end
full_title()
click to toggle source
# File lib/elibri_onix/onix_3_0/title_detail.rb, line 41 def full_title String.new.tap do |_full_title| _full_title << collection_level_title if collection_level_title.present? if product_level_title.present? _full_title << ". " if _full_title.present? _full_title << product_level_title end end end
inspect_include_fields()
click to toggle source
# File lib/elibri_onix/onix_3_0/title_detail.rb, line 37 def inspect_include_fields [:type_name] end
product_level()
click to toggle source
# File lib/elibri_onix/onix_3_0/title_detail.rb, line 55 def product_level @elements.find {|element| element.level == "01"} end
product_level_title()
click to toggle source
# File lib/elibri_onix/onix_3_0/title_detail.rb, line 51 def product_level_title product_level.try(:full_title) end
type_name()
click to toggle source
# File lib/elibri_onix/onix_3_0/title_detail.rb, line 33 def type_name Elibri::ONIX::Dict::Release_3_0::TitleType.find_by_onix_code(self.type).const_name.downcase end