module Eancom module Edifact class DTM < Segment TAG = 'DTM'.freeze TYPE = :body.freeze attr_accessor :type, :date_time, :format def initialize( tag: nil, type:, date_time:, format: ) @tag = tag @type = type @date_time = date_time @format = format super(tag: @tag || TAG) end def to_json_hash { identifier => { date_time: @date_time } } end def segment_type TYPE end private def identifier @identifier ||= structure.find(:type).dictionary[@type][:identifier] end end end end