tag = 'CCI' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::CCI) 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 #============================================================================== # Class Type code # #============================================================================== class_type_code = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '11' => { description: 'Product', identifier: 'product', }, }, description: "Class Type Code", required: false ) class_type_code.add(:class_type_code, data) structure << class_type_code #============================================================================== # Measurment details # #============================================================================== measurment_details = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: nil, description: "Measurment attribute code", required: false ) measurment_details.add(:measurment_attribute_code, data) structure << measurment_details #============================================================================== # Product Characteristic # #============================================================================== prodcut_characteristic = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..17, dictionary: { 'ORGANIC' => { description: 'Organic Trade Item', identifier: 'organic', }, 'PACKMAT' => { description: 'Packing Material', identifier: 'packmat', }, 'MATERIAL' => { description: 'Material', identifier: 'material', }, 'UOM' => { description: 'Ordering and Selling Unit of Measure', identifier: 'ordering_and_selling_unit_of_measure', }, }, description: "Characteristic description code", required: true ) prodcut_characteristic.add(:characteristic_description_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..17, dictionary: nil, description: "Code list identification code", required: false ) prodcut_characteristic.add(:code_list_identification_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '9' => { description: 'GS1', identifier: 'gs1', }, '60' => { description: 'Assigned by national trade agency', identifier: 'assigned_by_national_trade_agency', }, '91' => { description: 'Assigned by supplier or suppliers agent', identifier: 'assigned_by_supplier_or_suppliers_agent', }, '92' => { description: 'Assigned by buyer or buyers agent', identifier: 'assigned_by_buyer_or_buyers_agent', }, '174' => { description: 'DE, DIN', identifier: 'de_din', }, }, description: 'Code List responsibility Agency code', required: false ) prodcut_characteristic.add(:code_list_respobsibility_agency_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: nil, description: 'Characteristic description', required: false ) prodcut_characteristic.add(:characterisitc_description_1, data) prodcut_characteristic.add(:characterisitc_description_2, data) structure << prodcut_characteristic #============================================================================== Eancom.register_structure(tag: 'CCI', structure: structure)