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

Constant Summary collapse

ATTRIBUTES =

:nodoc:

[
  :sent_date_time, :sender
]
RELATIONS =

:nodoc:

[]

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.



33
34
35
36
37
# File 'lib/elibri_onix/onix_3_0/header.rb', line 33

def initialize(data)
  @to_xml = data.to_s
  @sent_date_time = Date.parse(data.xpath('xmlns:SentDateTime').try(:text)) if data.xpath('xmlns:SentDateTime')
  @sender = Sender.new(data.at_xpath('xmlns:Sender')) if data.at_xpath('xmlns:Sender')
end

Instance Attribute Details

#senderObject

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



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

def sender
  @sender
end

#sent_date_timeObject

date, at which message was sent



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

def sent_date_time
  @sent_date_time
end

#to_xmlObject

xml representation of message header



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

def to_xml
  @to_xml
end

Instance Method Details

#inspect_include_fieldsObject

:nodoc:



29
30
31
# File 'lib/elibri_onix/onix_3_0/header.rb', line 29

def inspect_include_fields
  [:sender]
end