Class: Elibri::ONIX::Release_3_0::Collection
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::Collection
- Defined in:
- lib/elibri_onix/onix_3_0/collection.rb
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#title_detail ⇒ Object
Returns the value of attribute title_detail.
-
#to_xml ⇒ Object
Returns the value of attribute to_xml.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #full_title ⇒ Object
-
#initialize(data) ⇒ Collection
constructor
A new instance of Collection.
- #inspect_include_fields ⇒ Object
- #type_name ⇒ Object
Constructor Details
#initialize(data) ⇒ Collection
Returns a new instance of Collection.
8 9 10 11 12 13 |
# File 'lib/elibri_onix/onix_3_0/collection.rb', line 8 def initialize(data) @to_xml = data.to_s @type = data.at_css('CollectionType')&.text @elements = data.css('TitleElement').map { |element_data| TitleElement.new(element_data) } @title_detail = TitleDetail.new(data.at_css('TitleDetail')) if data.at_css('TitleDetail') end |
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/collection.rb', line 6 def elements @elements end |
#title_detail ⇒ Object
Returns the value of attribute title_detail.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/collection.rb', line 6 def title_detail @title_detail end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/collection.rb', line 6 def to_xml @to_xml end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/collection.rb', line 6 def type @type end |
Instance Method Details
#full_title ⇒ Object
15 16 17 |
# File 'lib/elibri_onix/onix_3_0/collection.rb', line 15 def full_title title_detail&.full_title end |
#inspect_include_fields ⇒ Object
23 24 25 |
# File 'lib/elibri_onix/onix_3_0/collection.rb', line 23 def inspect_include_fields [:type_name] end |
#type_name ⇒ Object
19 20 21 |
# File 'lib/elibri_onix/onix_3_0/collection.rb', line 19 def type_name Elibri::ONIX::Dict::Release_3_0::CollectionType.find_by_onix_code(@type).const_name.downcase end |