Sha256: 43db44a77d511438124c1f248737fd4f990333bf8d4d4348dbdeef0b3cadc741

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Eancom
  module Edifact
    class PAT < Segment
      TAG = 'PAT'.freeze
      TYPE = :header

      attr_reader :segment_type

      def initialize(
        tag: nil,
        payment_terms_type_code_qualifier: nil,
        payment_terms_type_description_identifier: nil,
        time_reference_code: nil
      )

        @tag = tag,
        @payment_terms_type_code_qualifier = payment_terms_type_code_qualifier,
        @payment_terms_type_description_identifier = payment_terms_type_description_identifier,
        @time_reference_code = time_reference_code

        super(tag: tag || TAG)
      end

      def to_json_hash
        hash = {}
        hash.merge!(payment_terms_type_code_qualifier: find_identifier(:payment_terms_type_code_qualifier)) if @payment_terms_type_code_qualifier
        hash.merge!(payment_terms_type_description_identifier: @payment_terms_type_description_identifier) if @payment_terms_type_description_identifier
        hash.merge!(time_reference_code: @time_reference_code) if @time_reference_code
        hash
      end

      def segment_type
        TYPE
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eancom-2.0.0 lib/eancom/edifact/segments/pat.rb