Class: Elibri::ONIX::Release_3_0::Header

Inherits:
Object
  • Object
show all
Includes:
Inspector
Defined in:
lib/elibri_onix/onix_3_0/header.rb

Overview

Class representing ONIX header

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inspector

#attribute_for_inspect, #inspect

Constructor Details

#initialize(data) ⇒ Header

Returns a new instance of Header.



23
24
25
26
27
# File 'lib/elibri_onix/onix_3_0/header.rb', line 23

def initialize(data)
  @to_xml = data.to_s
  @sent_date_time = Date.parse(data.at_css('SentDateTime').text) if data.at_css('SentDateTime')
  @sender = Sender.new(data.at_css('Sender')) if data.at_css('Sender')
end

Instance Attribute Details

#senderObject

sender of the message - Elibri::ONIX::Release_3_0::Sender



13
14
15
# File 'lib/elibri_onix/onix_3_0/header.rb', line 13

def sender
  @sender
end

#sent_date_timeObject

date, at which message was sent



10
11
12
# File 'lib/elibri_onix/onix_3_0/header.rb', line 10

def sent_date_time
  @sent_date_time
end

#to_xmlObject

xml representation of message header



16
17
18
# File 'lib/elibri_onix/onix_3_0/header.rb', line 16

def to_xml
  @to_xml
end

Instance Method Details

#inspect_include_fieldsObject

:nodoc:



19
20
21
# File 'lib/elibri_onix/onix_3_0/header.rb', line 19

def inspect_include_fields
  [:sender]
end