Class: Eancom::Edifact::NAD
- Defined in:
- lib/eancom/edifact/segments/nad.rb
Constant Summary collapse
- TAG =
'NAD'.freeze
- TYPE =
:body.freeze
Instance Attribute Summary
Attributes inherited from Segment
Instance Method Summary collapse
- #group_name ⇒ Object
-
#initialize(tag: nil, party_function_code_qualifier:, party_identifier:, code_list_identification_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, party_name_1: nil, party_name_2: nil, party_name_3: nil, party_name_4: nil, party_name_5: nil, street_and_number_1: nil, street_and_number_2: nil, street_and_number_3: nil, 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_agency_code_2: nil, country_sub_entry_name: nil, postal_identification_code: nil, country_name_code: nil) ⇒ NAD
constructor
A new instance of NAD.
- #segment_type ⇒ Object
- #to_json_hash ⇒ Object
Methods inherited from Segment
#array, initialize_by_components, #is_body?, #is_footer?, #is_header?, #item_group_name, #starts_item?, #starts_message?, #structure, #tag?, #to_edi, #to_hash, #to_s, #validate_structure
Constructor Details
#initialize(tag: nil, party_function_code_qualifier:, party_identifier:, code_list_identification_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, party_name_1: nil, party_name_2: nil, party_name_3: nil, party_name_4: nil, party_name_5: nil, street_and_number_1: nil, street_and_number_2: nil, street_and_number_3: nil, 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_agency_code_2: nil, country_sub_entry_name: nil, postal_identification_code: nil, country_name_code: nil) ⇒ NAD
Returns a new instance of NAD.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/eancom/edifact/segments/nad.rb', line 7 def initialize( tag: nil, party_function_code_qualifier:, party_identifier:, code_list_identification_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, party_name_1: nil, party_name_2: nil, party_name_3: nil, party_name_4: nil, party_name_5: nil, street_and_number_1: nil, street_and_number_2: nil, street_and_number_3: nil, 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_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_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 @party_name_1 = party_name_1 @party_name_2 = party_name_2 @party_name_3 = party_name_3 @party_name_4 = party_name_4 @party_name_5 = party_name_5 @street_and_number_1 = street_and_number_1 @street_and_number_2 = street_and_number_2 @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_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 |
Instance Method Details
#group_name ⇒ Object
100 101 102 |
# File 'lib/eancom/edifact/segments/nad.rb', line 100 def group_name 'nads' end |
#segment_type ⇒ Object
96 97 98 |
# File 'lib/eancom/edifact/segments/nad.rb', line 96 def segment_type TYPE end |
#to_json_hash ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/eancom/edifact/segments/nad.rb', line 66 def to_json_hash hash = { identifier => {} } hash[identifier].merge!({ party_identifier: @party_identifier }) if @party_identifier 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 hash[identifier].merge!({ party_name_1: @party_name_1 }) if @party_name_1 hash[identifier].merge!({ party_name_2: @party_name_2 }) if @party_name_2 hash[identifier].merge!({ party_name_3: @party_name_3 }) if @party_name_3 hash[identifier].merge!({ party_name_4: @party_name_4 }) if @party_name_4 hash[identifier].merge!({ party_name_5: @party_name_5 }) if @party_name_5 hash[identifier].merge!({ street_and_number_1: @street_and_number_1 }) if @street_and_number_1 hash[identifier].merge!({ street_and_number_2: @street_and_number_2 }) if @street_and_number_2 hash[identifier].merge!({ street_and_number_3: @street_and_number_3 }) if @street_and_number_3 hash[identifier].merge!({ street_and_number_4: @street_and_number_4 }) if @street_and_number_4 hash[identifier].merge!({ street_and_number_5: @street_and_number_5 }) if @street_and_number_5 hash[identifier].merge!({ city_name: @city_name }) if @city_name 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 |