tag = 'LIN' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::LIN) 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 #============================================================================== # Line item identifier # #============================================================================== line_item_identifier = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..6, dictionary: nil, description: "Application generated number of the item lines within the message", required: true ) line_item_identifier.add(:line_item_identifier_1, data) structure << line_item_identifier #============================================================================== # Action request/notification description code # #============================================================================== action_request_notification_description_code = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: nil, description: 'Action request/notification description code', required: false ) action_request_notification_description_code.add(:action_request_notification_description_code, data) structure << action_request_notification_description_code #============================================================================== # Item Number Identification # #============================================================================== item_number_identification = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..35, dictionary: nil, description: 'Item identifier', required: true ) item_number_identification.add(:item_identifier, data) data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { 'SRV' => { description: 'GS1 Global Trade Item Number', identifier: 'GS1' }, 'EN' => { description: 'International Article Numbering Association (EAN)', identifier: 'ean' } }, description: 'Item identifier', required: true ) item_number_identification.add(:item_type_identification_code, data) structure << item_number_identification #============================================================================== # Sub-Line information # #============================================================================== sub_line_information = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '1' => { description: 'Sub-line information', identifier: 'sub_line_information', } }, description: 'Sub-line indicator code', required: false ) sub_line_information.add(:sub_line_indicator_code, data) data = Eancom::Edifact::Data.new( type: String, length: 1..6, dictionary: nil, description: 'Line item identifier', required: false ) sub_line_information.add(:line_item_identifier_2, data) structure << sub_line_information #============================================================================== Eancom.register_structure(tag: 'LIN', structure: structure)