module Eancom module Edifact class GIN < Segment TAG = 'GIN'.freeze TYPE = :body.freeze attr_reader :segment_type def initialize( tag: nil, object_identification_code_qualifier:, object_identifier_1: nil, object_identifier_2: nil, object_identifier_3: nil, object_identifier_4: nil, object_identifier_5: nil ) @tag = tag @object_identification_code_qualifier = object_identification_code_qualifier @object_identifier_1 = object_identifier_1 @object_identifier_2 = object_identifier_2 @object_identifier_3 = object_identifier_3 @object_identifier_4 = object_identifier_4 @object_identifier_5 = object_identifier_5 super(tag: @tag || TAG) end def to_json_hash hash = {} hash.merge!(object_identification_code_qualifier: @object_identification_code_qualifier) if @object_identification_code_qualifier hash.merge!(object_identifier_1: @object_identifier_1) if @object_identifier_1 hash.merge!(object_identifier_2: @object_identifier_2) if @object_identifier_2 hash.merge!(object_identifier_3: @object_identifier_3) if @object_identifier_3 hash.merge!(object_identifier_4: @object_identifier_4) if @object_identifier_4 hash.merge!(object_identifier_5: @object_identifier_5) if @object_identifier_5 hash end def segment_type TYPE end end end end