tag = 'CTA' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::CTA) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: 'Message Header', required: true ) tag.add(:tag, data) structure << tag #============================================================================== # Contact function code # #============================================================================== contact_function_code = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { 'AD' => { description: 'Accounting contact', identifier: 'accounting_contact' }, 'AP' => { description: 'Accounts payable contact', identifier: 'accounts_payable_contact' }, 'AR' => { description: 'Accounts receivable contact', identifier: 'accounts_receivable_contact' }, 'GR' => { description: 'Goods receiving contact', identifier: 'goods_receiving_contact' }, 'IC' => { description: 'Information contact', identifier: 'information_contact' }, 'BJ' => { description: 'Department or person responsible for processing purchase order', identifier: 'dep_or_per_resp_for_proc_purchase_order' }, 'BO' => { description: 'After business hour contact', identifier: 'after_business_hour_contact' }, 'OC' => { description: 'Order contact', identifier: 'order_contact' }, 'PD' => { description: 'Purchasing contact', identifier: 'purchasing_contact' }, 'PM' => { description: 'Product management contact', identifier: 'product_management_contact' }, 'SR' => { description: 'Sales representative or department', identifier: 'sales_representative_or_department' }, 'QC' => { description: 'Quality coordinator contact', identifier: 'quality_coordinator_contact' } }, description: 'Contact function code', required: true ) contact_function_code.add(:contact_function_code, data) structure << contact_function_code #============================================================================== # DEPARTMENT OR EMPLOYEE DETAILS #============================================================================== # TODO Eancom.register_structure(tag: 'CTA', structure: structure)