Sha256: 52329d4f1b36d175a004c308622e56dfc2a4247cf98ca65ed9db37d3d46e7c48

Contents?: true

Size: 723 Bytes

Versions: 15

Compression:

Stored size: 723 Bytes

Contents

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
eancom-1.6.3 lib/eancom/edifact/segments/dtm.rb
eancom-1.6.2 lib/eancom/edifact/segments/dtm.rb
eancom-1.6.0 lib/eancom/edifact/segments/dtm.rb
eancom-1.5.7 lib/eancom/edifact/segments/dtm.rb
eancom-1.5.6 lib/eancom/edifact/segments/dtm.rb
eancom-1.5.5 lib/eancom/edifact/segments/dtm.rb
eancom-1.5.4 lib/eancom/edifact/segments/dtm.rb
eancom-1.5.2 lib/eancom/edifact/segments/dtm.rb
eancom-1.5.1 lib/eancom/edifact/segments/dtm.rb
eancom-1.5.0 lib/eancom/edifact/segments/dtm.rb
eancom-1.4.0 lib/eancom/edifact/segments/dtm.rb
eancom-1.3.0 lib/eancom/edifact/segments/dtm.rb
eancom-1.2.0 lib/eancom/edifact/segments/dtm.rb
eancom-1.1.1 lib/eancom/edifact/segments/dtm.rb
eancom-1.1.0 lib/eancom/edifact/segments/dtm.rb