Class: Eancom::Edifact::DTM

Inherits:
Segment
  • Object
show all
Defined in:
lib/eancom/edifact/segments/dtm.rb

Constant Summary collapse

TAG =
'DTM'.freeze
TYPE =
:body.freeze

Instance Attribute Summary collapse

Attributes inherited from Segment

#tag

Instance Method Summary collapse

Methods inherited from Segment

#array, #group_name, initialize_by_components, #is_body?, #is_footer?, #is_header?, #item_group_name, #starts_item?, #starts_location?, #starts_message?, #structure, #tag?, #to_edi, #to_hash, #to_s, #validate_structure

Constructor Details

#initialize(tag: nil, type:, date_time:, format:) ⇒ DTM

Returns a new instance of DTM.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/eancom/edifact/segments/dtm.rb', line 9

def initialize(
    tag: nil,
    type:,
    date_time:,
    format:
  )
  @tag = tag
  @type = type
  @date_time = date_time
  @format = format

  super(tag: @tag || TAG)
end

Instance Attribute Details

#date_timeObject

Returns the value of attribute date_time.



7
8
9
# File 'lib/eancom/edifact/segments/dtm.rb', line 7

def date_time
  @date_time
end

#formatObject

Returns the value of attribute format.



7
8
9
# File 'lib/eancom/edifact/segments/dtm.rb', line 7

def format
  @format
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/eancom/edifact/segments/dtm.rb', line 7

def type
  @type
end

Instance Method Details

#segment_typeObject



31
32
33
# File 'lib/eancom/edifact/segments/dtm.rb', line 31

def segment_type
  TYPE
end

#to_json_hashObject



23
24
25
26
27
28
29
# File 'lib/eancom/edifact/segments/dtm.rb', line 23

def to_json_hash
  {
    identifier => {
        date_time: @date_time
      }
  }
end