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