Class: Elibri::ONIX::Release_3_0::ONIXMessage
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::ONIXMessage
- Includes:
- Inspector
- Defined in:
- lib/elibri_onix/onix_3_0/onix_message.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
attributes of root ONIXMessage node.
-
#header ⇒ Object
returned message header - Elibri::ONIX::Release_3_0::Header.
-
#products ⇒ Object
list of all products returned in this mnessage.
-
#release ⇒ Object
ONIX version number.
-
#to_xml ⇒ Object
xml representation of this message.
Instance Method Summary collapse
-
#initialize(xml, *initialization_args) ⇒ ONIXMessage
constructor
A new instance of ONIXMessage.
- #inspect_include_fields ⇒ Object
Methods included from Inspector
#attribute_for_inspect, #inspect
Constructor Details
#initialize(xml, *initialization_args) ⇒ ONIXMessage
Returns a new instance of ONIXMessage.
26 27 28 29 30 31 32 33 34 |
# File 'lib/elibri_onix/onix_3_0/onix_message.rb', line 26 def initialize(xml, *initialization_args) @to_xml = xml.to_s xml = Nokogiri::XML(xml) unless xml.is_a?(Nokogiri::XML::Document) = xml.children.first @attributes = extract_attributes(.attribute_nodes) @release = ['release'] @header = Header.new(.at_css('Header')) if .at_css('Header') @products = .css('Product').map { |product_node| Product.new(product_node) } end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
attributes of root ONIXMessage node
20 21 22 |
# File 'lib/elibri_onix/onix_3_0/onix_message.rb', line 20 def attributes @attributes end |
#header ⇒ Object
returned message header - Elibri::ONIX::Release_3_0::Header
17 18 19 |
# File 'lib/elibri_onix/onix_3_0/onix_message.rb', line 17 def header @header end |
#products ⇒ Object
list of all products returned in this mnessage
8 9 10 |
# File 'lib/elibri_onix/onix_3_0/onix_message.rb', line 8 def products @products end |
#release ⇒ Object
ONIX version number
14 15 16 |
# File 'lib/elibri_onix/onix_3_0/onix_message.rb', line 14 def release @release end |
#to_xml ⇒ Object
xml representation of this message
11 12 13 |
# File 'lib/elibri_onix/onix_3_0/onix_message.rb', line 11 def to_xml @to_xml end |
Instance Method Details
#inspect_include_fields ⇒ Object
22 23 24 |
# File 'lib/elibri_onix/onix_3_0/onix_message.rb', line 22 def inspect_include_fields [:header, :release, :products] end |