Sha256: 80cf4517876a4adb7837c2da642f2013864fdbbfccddfc5fc5257c7edd5672ea

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

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

      attr_reader :segment_type

      def initialize(
        tag: nil,
        percentage:,
        percentage_type_code_qualifier: nil
      )
        @tag = tag
        @percentage_type_code_qualifier = percentage_type_code_qualifier
        @percentage = percentage

        super(tag: tag || TAG)
      end

      def to_json_hash
        hash = {}
        hash.merge!(percentage_type_code_qualifier: find_identifier(:percentage_type_code_qualifier)) if @percentage_type_code_qualifier
        hash.merge!(percentage: @percentage) if @percentage
        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/pcd.rb