Sha256: 4d8733c7e2c892ff4da44271e6e93ccf2a135b9583c71f6b83f1c2aae614fad6

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

module Eancom
  module Edifact
    class CNT < Segment
      TAG = 'CNT'.freeze
      TYPE = :body.freeze

      attr_reader :segment_type

      def initialize(
        tag: nil,
        control_total_type_code_quantifier:,
        control_total_value:,
        measurment_unit_code: nil
      )
        @tag = tag
        @control_total_type_code_quantifier = control_total_type_code_quantifier
        @control_total_value = control_total_value
        @measurment_unit_code = measurment_unit_code

        super(tag: tag || TAG)
      end

      def to_json_hash
        hash = {}
        hash.merge!(control_total_type_code_quantifier: find_identifier(:control_total_type_code_quantifier)) if @control_total_type_code_quantifier
        hash.merge!(control_total_value: @control_total_value) if @control_total_value
        hash
      end

      def group_name
        'counts'
      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/cnt.rb