lib/eancom/edifact/segments/nad.rb in eancom-1.6.3 vs lib/eancom/edifact/segments/nad.rb in eancom-2.0.0

- old
+ new

@@ -7,11 +7,11 @@ def initialize( tag: nil, party_function_code_qualifier:, party_identifier:, code_list_identification_code_1: '', - code_list_responsible_agancy_code_1:, + code_list_responsible_agency_code_1: nil, name_and_address_description_1: nil, name_and_address_description_2: nil, name_and_address_description_3: nil, name_and_address_description_4: nil, name_and_address_description_5: nil, @@ -26,20 +26,20 @@ street_and_number_4: nil, street_and_number_5: nil, city_name: nil, country_sub_entity_name_code: nil, code_list_identification_code_2: nil, - code_list_responsible_agancy_code_2: nil, + code_list_responsible_agency_code_2: nil, country_sub_entry_name: nil, postal_identification_code: nil, country_name_code: nil ) @tag = tag @party_function_code_qualifier = party_function_code_qualifier @party_identifier = party_identifier @code_list_identification_code_1 = code_list_identification_code_1 - @code_list_responsible_agancy_code_1 = code_list_responsible_agancy_code_1 + @code_list_responsible_agency_code_1 = code_list_responsible_agency_code_1 @name_and_address_description_1 = name_and_address_description_1 @name_and_address_description_2 = name_and_address_description_2 @name_and_address_description_3 = name_and_address_description_3 @name_and_address_description_4 = name_and_address_description_4 @name_and_address_description_5 = name_and_address_description_5 @@ -53,22 +53,21 @@ @street_and_number_3 = street_and_number_3 @street_and_number_4 = street_and_number_4 @street_and_number_5 = street_and_number_5 @city_name = city_name @country_sub_entity_name_code = country_sub_entity_name_code - @code_list_identification_code_2 = code_list_identification_code_2 - @code_list_responsible_agancy_code_2 = code_list_responsible_agancy_code_2 + @code_list_responsible_agency_code_2 = code_list_identification_code_2 + @code_list_responsible_agency_code_2 = code_list_responsible_agency_code_2 @country_sub_entry_name = country_sub_entry_name @postal_identification_code = postal_identification_code @country_name_code = country_name_code super(tag: tag || TAG) end def to_json_hash hash = { identifier => {} } hash[identifier].merge!({ party_identifier: @party_identifier }) if @party_identifier - hash[identifier].merge!(code_list_responsible_agancy_code_1: find_identifier(:code_list_responsible_agancy_code_1)) if @code_list_responsible_agancy_code_1 hash[identifier].merge!({ name_and_address_description_1: @name_and_address_description_1 }) if @name_and_address_description_1 hash[identifier].merge!({ name_and_address_description_2: @name_and_address_description_2 }) if @name_and_address_description_2 hash[identifier].merge!({ name_and_address_description_3: @name_and_address_description_3 }) if @name_and_address_description_3 hash[identifier].merge!({ name_and_address_description_4: @name_and_address_description_4 }) if @name_and_address_description_4 hash[identifier].merge!({ name_and_address_description_5: @name_and_address_description_5 }) if @name_and_address_description_5 @@ -86,15 +85,21 @@ hash[identifier].merge!({ country_sub_entity_name_code: @country_sub_entity_name_code }) if @country_sub_entity_name_code hash[identifier].merge!({ country_sub_entry_name: @country_sub_entry_name }) if @country_sub_entry_name hash[identifier].merge!({ postal_identification_code: @postal_identification_code }) if @postal_identification_code hash[identifier].merge!({ country_name_code: @country_name_code }) if @country_name_code + hash.merge!({ identifier: @identifier }) if @identifier hash = {} if hash[identifier].empty? hash + end def segment_type TYPE + end + + def group_name + 'nads' end private def identifier