eancom 0.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +190 -5
  3. data/.gitlab-ci.yml +25 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile.lock +22 -18
  6. data/README.md +46 -0
  7. data/bin/console +3 -2
  8. data/definitions/desadv/d01b.rb +251 -0
  9. data/definitions/desadv/d96a.rb +208 -87
  10. data/definitions/invoic/d01b.rb +559 -0
  11. data/definitions/invoic/d96a.rb +389 -0
  12. data/definitions/invrpt/d01b.rb +134 -0
  13. data/definitions/invrpt/d96a.rb +125 -0
  14. data/definitions/orders/d01b.rb +182 -0
  15. data/definitions/orders/d96b.rb +198 -0
  16. data/definitions/ordrsp/d01b.rb +251 -0
  17. data/definitions/ordrsp/d96b.rb +226 -0
  18. data/definitions/pricat/d01b.rb +225 -0
  19. data/definitions/pricat/d96b.rb +207 -0
  20. data/definitions/retann/d01b.rb +172 -0
  21. data/definitions/retann/d96b.rb +221 -0
  22. data/definitions/segments/ajt.rb +47 -0
  23. data/definitions/segments/alc.rb +328 -0
  24. data/definitions/segments/ali.rb +93 -0
  25. data/definitions/segments/bgm.rb +395 -0
  26. data/definitions/segments/cav.rb +122 -0
  27. data/definitions/segments/cci.rb +136 -0
  28. data/definitions/segments/cdi.rb +39 -0
  29. data/definitions/segments/cnt.rb +82 -0
  30. data/definitions/segments/cps.rb +76 -0
  31. data/definitions/segments/cta.rb +89 -0
  32. data/definitions/segments/cux.rb +174 -0
  33. data/definitions/segments/dgs.rb +34 -0
  34. data/definitions/segments/doc.rb +45 -0
  35. data/definitions/segments/dtm.rb +243 -0
  36. data/definitions/segments/efi.rb +67 -0
  37. data/definitions/segments/eqd.rb +37 -0
  38. data/definitions/segments/ftx.rb +165 -0
  39. data/definitions/segments/gin.rb +113 -0
  40. data/definitions/segments/imd.rb +360 -0
  41. data/definitions/segments/inv.rb +94 -0
  42. data/definitions/segments/lin.rb +133 -0
  43. data/definitions/segments/loc.rb +137 -0
  44. data/definitions/segments/mea.rb +189 -0
  45. data/definitions/segments/moa.rb +228 -0
  46. data/definitions/segments/nad.rb +314 -0
  47. data/definitions/segments/pac.rb +262 -0
  48. data/definitions/segments/pat.rb +171 -0
  49. data/definitions/segments/pcd.rb +72 -0
  50. data/definitions/segments/pci.rb +110 -0
  51. data/definitions/segments/pgi.rb +152 -0
  52. data/definitions/segments/pia.rb +501 -0
  53. data/definitions/segments/pri.rb +208 -0
  54. data/definitions/segments/qty.rb +293 -0
  55. data/definitions/segments/rff.rb +210 -0
  56. data/definitions/segments/rte.rb +52 -0
  57. data/definitions/segments/tax.rb +266 -0
  58. data/definitions/segments/tdt.rb +278 -0
  59. data/definitions/segments/tod.rb +64 -0
  60. data/definitions/segments/tru.rb +34 -0
  61. data/definitions/segments/una.rb +85 -0
  62. data/definitions/segments/unb.rb +284 -0
  63. data/definitions/segments/unh.rb +183 -0
  64. data/definitions/segments/uns.rb +40 -0
  65. data/definitions/segments/unt.rb +48 -0
  66. data/definitions/segments/unz.rb +48 -0
  67. data/definitions/slsrpt/d01b.rb +206 -0
  68. data/definitions/slsrpt/d96a.rb +199 -0
  69. data/eancom.gemspec +2 -1
  70. data/lib/eancom.rb +61 -16
  71. data/lib/eancom/definition.rb +1 -1
  72. data/lib/eancom/edifact.rb +60 -13
  73. data/lib/eancom/edifact/body.rb +63 -0
  74. data/lib/eancom/edifact/composite.rb +38 -0
  75. data/lib/eancom/edifact/data.rb +108 -0
  76. data/lib/eancom/edifact/document.rb +43 -11
  77. data/lib/eancom/edifact/document_element.rb +26 -0
  78. data/lib/eancom/edifact/footer.rb +7 -0
  79. data/lib/eancom/edifact/header.rb +15 -0
  80. data/lib/eancom/edifact/item.rb +40 -0
  81. data/lib/eancom/edifact/message.rb +24 -16
  82. data/lib/eancom/edifact/segment.rb +131 -12
  83. data/lib/eancom/edifact/segments/ajt.rb +32 -0
  84. data/lib/eancom/edifact/segments/alc.rb +61 -0
  85. data/lib/eancom/edifact/segments/ali.rb +50 -0
  86. data/lib/eancom/edifact/segments/bgm.rb +46 -0
  87. data/lib/eancom/edifact/segments/cav.rb +47 -0
  88. data/lib/eancom/edifact/segments/cci.rb +53 -0
  89. data/lib/eancom/edifact/segments/cdi.rb +30 -0
  90. data/lib/eancom/edifact/segments/cnt.rb +40 -0
  91. data/lib/eancom/edifact/segments/cps.rb +33 -0
  92. data/lib/eancom/edifact/segments/cta.rb +30 -0
  93. data/lib/eancom/edifact/segments/cux.rb +60 -0
  94. data/lib/eancom/edifact/segments/dgs.rb +31 -0
  95. data/lib/eancom/edifact/segments/doc.rb +30 -0
  96. data/lib/eancom/edifact/segments/dtm.rb +47 -0
  97. data/lib/eancom/edifact/segments/efi.rb +38 -0
  98. data/lib/eancom/edifact/segments/eqd.rb +30 -0
  99. data/lib/eancom/edifact/segments/ftx.rb +63 -0
  100. data/lib/eancom/edifact/segments/gin.rb +45 -0
  101. data/lib/eancom/edifact/segments/imd.rb +69 -0
  102. data/lib/eancom/edifact/segments/inv.rb +43 -0
  103. data/lib/eancom/edifact/segments/lin.rb +47 -0
  104. data/lib/eancom/edifact/segments/loc.rb +46 -0
  105. data/lib/eancom/edifact/segments/mea.rb +54 -0
  106. data/lib/eancom/edifact/segments/moa.rb +45 -0
  107. data/lib/eancom/edifact/segments/nad.rb +112 -0
  108. data/lib/eancom/edifact/segments/pac.rb +56 -0
  109. data/lib/eancom/edifact/segments/pat.rb +37 -0
  110. data/lib/eancom/edifact/segments/pcd.rb +33 -0
  111. data/lib/eancom/edifact/segments/pci.rb +40 -0
  112. data/lib/eancom/edifact/segments/pgi.rb +45 -0
  113. data/lib/eancom/edifact/segments/pia.rb +108 -0
  114. data/lib/eancom/edifact/segments/pri.rb +53 -0
  115. data/lib/eancom/edifact/segments/qty.rb +44 -0
  116. data/lib/eancom/edifact/segments/rff.rb +47 -0
  117. data/lib/eancom/edifact/segments/rte.rb +33 -0
  118. data/lib/eancom/edifact/segments/tax.rb +78 -0
  119. data/lib/eancom/edifact/segments/tdt.rb +57 -0
  120. data/lib/eancom/edifact/segments/tod.rb +33 -0
  121. data/lib/eancom/edifact/segments/tru.rb +31 -0
  122. data/lib/eancom/edifact/segments/una.rb +52 -0
  123. data/lib/eancom/edifact/segments/unb.rb +68 -0
  124. data/lib/eancom/edifact/segments/unh.rb +50 -0
  125. data/lib/eancom/edifact/segments/uns.rb +32 -0
  126. data/lib/eancom/edifact/segments/unt.rb +28 -0
  127. data/lib/eancom/edifact/segments/unz.rb +28 -0
  128. data/lib/eancom/edifact/structure.rb +90 -0
  129. data/lib/eancom/factory.rb +9 -8
  130. data/lib/eancom/parser.rb +7 -0
  131. data/lib/eancom/parser/document.rb +60 -0
  132. data/lib/eancom/parser/segment.rb +71 -0
  133. data/lib/eancom/version.rb +1 -1
  134. data/pricat.json +1 -0
  135. metadata +141 -9
  136. data/lib/eancom/edifact/element.rb +0 -16
  137. data/lib/eancom/edifact/envelope.rb +0 -24
@@ -0,0 +1,278 @@
1
+ tag = 'TDT'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::TDT)
3
+
4
+ structure = Eancom::Edifact::Structure.new(tag: tag)
5
+ #==============================================================================
6
+ # Tag #
7
+ #==============================================================================
8
+ tag = Eancom::Edifact::Composite.new()
9
+ data = Eancom::Edifact::Data.new(
10
+ type: String,
11
+ length: 3,
12
+ dictionary: nil,
13
+ description: "Message Header",
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+ #==============================================================================
20
+ # Transport stage code qualifier #
21
+ #==============================================================================
22
+ transport_stage_code_qualifier = Eancom::Edifact::Composite.new()
23
+
24
+ data = Eancom::Edifact::Data.new(
25
+ type: String,
26
+ length: 1..3,
27
+ dictionary: {
28
+ '10' => {
29
+ description: 'Pre-carriage transport',
30
+ identifier: 'pre_carriage_transport'
31
+ },
32
+ '12' => {
33
+ description: 'At departure',
34
+ identifier: 'at_departure'
35
+ },
36
+ '13' => {
37
+ description: 'At destination',
38
+ identifier: 'at_destination'
39
+ },
40
+ '20' => {
41
+ description: 'Main-carriage transport',
42
+ identifier: 'main_carriage_transport'
43
+ },
44
+ '30' => {
45
+ description: 'On-carriage transport',
46
+ identifier: 'on_carriage_transport'
47
+ }
48
+ },
49
+ description: "Transport stage code qualifier",
50
+ required: true
51
+ )
52
+ transport_stage_code_qualifier.add(:transport_stage_code_qualifier, data)
53
+
54
+ structure << transport_stage_code_qualifier
55
+ #==============================================================================
56
+ # Means of transport journey identifier #
57
+ #==============================================================================
58
+ means_of_transport_journey_identifier = Eancom::Edifact::Composite.new()
59
+
60
+ data = Eancom::Edifact::Data.new(
61
+ type: String,
62
+ length: 1..17,
63
+ dictionary: nil,
64
+ description: 'Means of transport journey identifier',
65
+ required: false
66
+ )
67
+ means_of_transport_journey_identifier.add(:means_of_transport_journey_identifier, data)
68
+
69
+ structure << means_of_transport_journey_identifier
70
+ #==============================================================================
71
+ # Mode of transport #
72
+ #==============================================================================
73
+ mode_of_transport = Eancom::Edifact::Composite.new()
74
+
75
+ data = Eancom::Edifact::Data.new(
76
+ type: String,
77
+ length: 1..3,
78
+ dictionary: {
79
+ '10' => {
80
+ description: '10',
81
+ identifier: '10'
82
+ },
83
+ '20' => {
84
+ description: '20',
85
+ identifier: '20'
86
+ },
87
+ '30' => {
88
+ description: '30',
89
+ identifier: '30'
90
+ },
91
+ '40' => {
92
+ description: '40',
93
+ identifier: '40'
94
+ },
95
+ '50' => {
96
+ description: '50',
97
+ identifier: '50'
98
+ },
99
+ '60' => {
100
+ description: '60',
101
+ identifier: '60'
102
+ }
103
+ },
104
+ description: 'Transport mode name code',
105
+ required: true
106
+ )
107
+ mode_of_transport.add(:transport_mode_name_code, data)
108
+
109
+ structure << mode_of_transport
110
+ #==============================================================================
111
+ # Transport Means #
112
+ #==============================================================================
113
+ transport_means = Eancom::Edifact::Composite.new()
114
+
115
+ data = Eancom::Edifact::Data.new(
116
+ type: String,
117
+ length: 1..8,
118
+ dictionary: {
119
+ '12' => {
120
+ description: 'Ship tanker',
121
+ identifier: 'ship_tanker'
122
+ },
123
+ '23' => {
124
+ description: 'Rail bulk order',
125
+ identifier: 'rail_bulk_order'
126
+ },
127
+ '25' => {
128
+ description: '25',
129
+ identifier: '25'
130
+ },
131
+ '31' => {
132
+ description: 'Truck',
133
+ identifier: 'truck'
134
+ },
135
+ '32' => {
136
+ description: 'Road tanker',
137
+ identifier: 'road_tanker'
138
+ }
139
+ },
140
+ description: 'Transport means description code',
141
+ required: false
142
+ )
143
+ transport_means.add(:transport_means_description_code, data)
144
+
145
+ data = Eancom::Edifact::Data.new(
146
+ type: String,
147
+ length: 1..17,
148
+ dictionary: nil,
149
+ description: 'Transport means description',
150
+ required: false
151
+ )
152
+ transport_means.add(:transport_means_description, data)
153
+
154
+ structure << transport_means
155
+ #==============================================================================
156
+ # Carrier #
157
+ #==============================================================================
158
+ carrier = Eancom::Edifact::Composite.new()
159
+
160
+ data = Eancom::Edifact::Data.new(
161
+ type: String,
162
+ length: 1..17,
163
+ dictionary: nil,
164
+ description: 'Carrier identifier GLN - Format n13',
165
+ required: false
166
+ )
167
+ carrier.add(:carrier_identifier, data)
168
+
169
+ data = Eancom::Edifact::Data.new(
170
+ type: String,
171
+ length: 1..17,
172
+ dictionary: nil,
173
+ description: 'Code list identification code',
174
+ required: false
175
+ )
176
+ carrier.add(:code_list_identification_code_1, data)
177
+
178
+ data = Eancom::Edifact::Data.new(
179
+ type: String,
180
+ length: 1..3,
181
+ dictionary: {
182
+ '9' => {
183
+ description: 'GS1',
184
+ identifier: 'gs1'
185
+ }
186
+ },
187
+ description: 'Code list responsible agency',
188
+ required: false
189
+ )
190
+ carrier.add(:code_list_responsible_agency_1, data)
191
+
192
+ data = Eancom::Edifact::Data.new(
193
+ type: String,
194
+ length: 1..35,
195
+ dictionary: nil,
196
+ description: 'Carrier name',
197
+ required: false
198
+ )
199
+ carrier.add(:carrier_name, data)
200
+
201
+ structure << carrier
202
+ #==============================================================================
203
+ # Transit direction identicator code
204
+ #==============================================================================
205
+ transit_direction_identicator_code = Eancom::Edifact::Composite.new
206
+
207
+ data = Eancom::Edifact::Data.new(
208
+ type: String,
209
+ length: 1..3,
210
+ dictionary: {
211
+ 'BS' => {
212
+ description: 'Buyer to supplier',
213
+ identifier: 'buyer_to_supplier'
214
+ },
215
+ 'SB' => {
216
+ description: 'Supplier to buyer',
217
+ identifier: 'supplier_to_buyer'
218
+ }
219
+ },
220
+ description: 'Transit direction identicator code',
221
+ required: false
222
+ )
223
+ transit_direction_identicator_code.add(:transit_direction_identicator_code, data)
224
+
225
+ structure << transit_direction_identicator_code
226
+ #==============================================================================
227
+ # Transport Identification #
228
+ #==============================================================================
229
+ transport_identification = Eancom::Edifact::Composite.new
230
+
231
+ data = Eancom::Edifact::Data.new(
232
+ type: String,
233
+ length: 1..9,
234
+ dictionary: nil,
235
+ description: 'Transport means identification name identifier',
236
+ required: false
237
+ )
238
+ transport_identification.add(:transport_means_identification_name_identifier, data)
239
+
240
+ data = Eancom::Edifact::Data.new(
241
+ type: String,
242
+ length: 1..3,
243
+ dictionary: nil,
244
+ description: 'Code list identification code',
245
+ required: false
246
+ )
247
+ transport_identification.add(:code_list_identification_code_2, data)
248
+
249
+ data = Eancom::Edifact::Data.new(
250
+ type: String,
251
+ length: 1..3,
252
+ dictionary: nil,
253
+ description: 'Code list responsible agency code',
254
+ required: false
255
+ )
256
+ transport_identification.add(:code_list_responsible_agency_2, data)
257
+
258
+ data = Eancom::Edifact::Data.new(
259
+ type: String,
260
+ length: 1..35,
261
+ dictionary: nil,
262
+ description: 'Transport means identification name',
263
+ required: false
264
+ )
265
+ transport_identification.add(:transport_means_identification_name, data)
266
+
267
+ data = Eancom::Edifact::Data.new(
268
+ type: String,
269
+ length: 1..3,
270
+ dictionary: nil,
271
+ description: 'Transport means nationality code',
272
+ required: false
273
+ )
274
+ transport_identification.add(:transport_means_nationality_code, data)
275
+
276
+ structure << transport_identification
277
+ #==============================================================================
278
+ Eancom.register_structure(tag: 'TDT', structure: structure)
@@ -0,0 +1,64 @@
1
+ tag = 'PAT'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::PAT)
3
+
4
+ structure = Eancom::Edifact::Structure.new(tag: tag)
5
+ #==============================================================================
6
+ # Tag #
7
+ #==============================================================================
8
+ tag = Eancom::Edifact::Composite.new
9
+ data = Eancom::Edifact::Data.new(
10
+ type: String,
11
+ length: 1..3,
12
+ dictionary: nil,
13
+ description: 'Message Header',
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+
20
+ delivery_or_transport_terms_function_code = Eancom::Edifact::Composite.new
21
+ data = Eancom::Edifact::Data.new(
22
+ type: String,
23
+ length: 1..3,
24
+ dictionary: {
25
+ '3' => {
26
+ description: 'Price and despatch condition',
27
+ identification: 'price_and_despatch_condition'
28
+ },
29
+ '5' => {
30
+ description: 'Transport condition',
31
+ identification: 'transport_condition'
32
+ },
33
+ '6' => {
34
+ description: 'Delivery condition',
35
+ identification: 'delivery_condition'
36
+ },
37
+ '10E' => {
38
+ description: 'Delivered by supplier (GS1 Temorary Code)',
39
+ identification: 'delivered_by_supplier_gs1'
40
+ }
41
+ },
42
+ description: 'Delivery or transport terms function code',
43
+ required: false
44
+ )
45
+ delivery_or_transport_terms_function_code.add(:delivery_or_transport_terms_function_code, data)
46
+
47
+ structure << delivery_or_transport_terms_function_code
48
+
49
+ #==============================================================================
50
+ # TERMS OF DELIVERY OR TRANSPORT #
51
+ #==============================================================================
52
+ delivery_or_transport_terms_description_code = Eancom::Edifact::Composite.new
53
+ data = Eancom::Edifact::Data.new(
54
+ type: String,
55
+ length: 1..3,
56
+ dictionary: nil,
57
+ description: 'Delivery or transport terms description code',
58
+ required: false
59
+ )
60
+ delivery_or_transport_terms_description_code.add(:delivery_or_transport_terms_description_code, data)
61
+
62
+ structure << delivery_or_transport_terms_description_code
63
+ #==============================================================================
64
+ Eancom.register_structure(tag: 'TOD', structure: structure)
@@ -0,0 +1,34 @@
1
+ tag = 'TRU'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::TRU)
3
+
4
+ structure = Eancom::Edifact::Structure.new(tag: tag)
5
+ #==============================================================================
6
+ # Tag #
7
+ #==============================================================================
8
+ tag = Eancom::Edifact::Composite.new
9
+ data = Eancom::Edifact::Data.new(
10
+ type: String,
11
+ length: 3,
12
+ dictionary: nil,
13
+ description: 'Message Header',
14
+ required: true
15
+ )
16
+ tag.add(:tag, data)
17
+
18
+ structure << tag
19
+ #==============================================================================
20
+ # Object identifier
21
+ #==============================================================================
22
+ object_identifier = Eancom::Edifact::Composite.new
23
+ data = Eancom::Edifact::Data.new(
24
+ type: String,
25
+ length: 1..35,
26
+ dictionary: nil,
27
+ description: 'Object identifier',
28
+ required: true
29
+ )
30
+ object_identifier.add(:object_identifier, data)
31
+
32
+ structure << object_identifier
33
+ #==============================================================================
34
+ Eancom.register_structure(tag: 'TRU', structure: structure)
@@ -0,0 +1,85 @@
1
+ tag = 'UNA'
2
+ Eancom.register_segment(tag: tag, klass: Eancom::Edifact::UNA)
3
+
4
+ structure = Eancom::Edifact::Structure.new(tag: tag)
5
+
6
+ composite = Eancom::Edifact::Composite.new()
7
+ data = Eancom::Edifact::Data.new(
8
+ type: String,
9
+ length: 1..3,
10
+ dictionary: nil,
11
+ description: "Service String Advice",
12
+ required: true
13
+ )
14
+ composite.add(:tag, data)
15
+ structure << composite
16
+
17
+ composite = Eancom::Edifact::Composite.new()
18
+ data = Eancom::Edifact::Data.new(
19
+ type: String,
20
+ length: 0..1,
21
+ dictionary: nil,
22
+ description: "Component data element separator",
23
+ required: true
24
+ )
25
+ composite.add(:una1, data)
26
+ structure << composite
27
+
28
+ composite = Eancom::Edifact::Composite.new()
29
+ data = Eancom::Edifact::Data.new(
30
+ type: String,
31
+ length: 0..1,
32
+ dictionary: nil,
33
+ description: "Data element separator",
34
+ required: true
35
+ )
36
+ composite.add(:una2, data)
37
+ structure << composite
38
+
39
+ composite = Eancom::Edifact::Composite.new()
40
+ data = Eancom::Edifact::Data.new(
41
+ type: String,
42
+ length: 0..1,
43
+ dictionary: nil,
44
+ description: "Decimal notation",
45
+ required: true
46
+ )
47
+ composite.add(:una3, data)
48
+ structure << composite
49
+
50
+ composite = Eancom::Edifact::Composite.new()
51
+ data = Eancom::Edifact::Data.new(
52
+ type: String,
53
+ length: 0..1,
54
+ dictionary: nil,
55
+ description: "Release character",
56
+ required: true
57
+ )
58
+ composite.add(:una4, data)
59
+ structure << composite
60
+
61
+ composite = Eancom::Edifact::Composite.new()
62
+ data = Eancom::Edifact::Data.new(
63
+ type: String,
64
+ length: 0..1,
65
+ dictionary: nil,
66
+ description: "Reserved for future use",
67
+ required: true
68
+ )
69
+ composite.add(:una5, data)
70
+ structure << composite
71
+
72
+ composite = Eancom::Edifact::Composite.new()
73
+ data = Eancom::Edifact::Data.new(
74
+ type: String,
75
+ length: 0..1,
76
+ dictionary: nil,
77
+ description: "Segment terminator",
78
+ required: true
79
+ )
80
+ composite.add(:una6, data)
81
+ structure << composite
82
+
83
+ Eancom.register_structure(tag: tag, structure: structure)
84
+
85
+