tag = 'FTX' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::FTX) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 3, dictionary: nil, description: "Message Header", required: true ) tag.add(:tag, data) structure << tag #============================================================================== # Text subject code qualifier # #============================================================================== text_subject_code_qualifier = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: "Text subject code qualifier", required: true ) text_subject_code_qualifier.add(:text_subject_code_qualifier, data) structure << text_subject_code_qualifier #============================================================================== # Free Text function code #============================================================================== free_text_function_code = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '1' => { description: 'Text for subsequent use', identifier: 'text_for_subsequent_use' }, '3' => { description: 'Text for immediate use', identifier: 'text_for_immediate_use' } }, description: "Free Text function code", required: false ) free_text_function_code.add(:free_text_function_code, data) structure << free_text_function_code #============================================================================== # Text Reference #============================================================================== text_reference = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: nil, description: "Free Text value_code", required: false ) text_reference.add(:free_text_value_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..17, description: "Code list identification code", required: false ) text_reference.add(:code_list_identification_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '9' => { description: 'GS1', identifier: 'gs1' }, '91' => { description: "Assigned by supplier or supplier's agent", identifier: 'assigned_by_supplier_or_suppliers_agent' }, '92' => { description: "Assigned by buyer or buyer's agent", identifier: 'assigned_by_buyer_or_buyers_agent' }, '246' => { description: "GS1 Germany", identifier: 'gs1_germany' }, 'ZZZ' => { description: 'Mutually defined', identifier: 'mutually_defined' } }, description: "Code list responsible agency code", required: false ) text_reference.add(:code_list_responsible_agency_code, data) structure << text_reference #============================================================================== # Text Literal #============================================================================== text_literal = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..512, dictionary: nil, description: "Free Text Value", required: false ) text_literal.add(:free_text_value_1, data) data = Eancom::Edifact::Data.new( type: String, length: 0..512, dictionary: nil, description: "Free Text Value", required: false ) text_literal.add(:free_text_value_2, data) text_literal.add(:free_text_value_3, data) text_literal.add(:free_text_value_4, data) text_literal.add(:free_text_value_5, data) structure << text_literal #============================================================================== # Language Name code language_name_code = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: nil, description: "Language name Code", required: false ) language_name_code.add(:language_name_code, data) #============================================================================== Eancom.register_structure(tag: 'FTX', structure: structure)