eancom 1.6.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -4
  3. data/.gitlab-ci.yml +11 -13
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -4
  6. data/Gemfile.lock +21 -103
  7. data/README.md +46 -0
  8. data/definitions/desadv/d01b.rb +134 -87
  9. data/definitions/desadv/d96a.rb +145 -82
  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 +128 -36
  24. data/definitions/segments/bgm.rb +122 -2
  25. data/definitions/segments/cdi.rb +39 -0
  26. data/definitions/segments/cnt.rb +4 -0
  27. data/definitions/segments/cta.rb +89 -0
  28. data/definitions/segments/cux.rb +9 -2
  29. data/definitions/segments/dgs.rb +34 -0
  30. data/definitions/segments/doc.rb +45 -0
  31. data/definitions/segments/dtm.rb +75 -20
  32. data/definitions/segments/efi.rb +67 -0
  33. data/definitions/segments/eqd.rb +37 -0
  34. data/definitions/segments/ftx.rb +22 -8
  35. data/definitions/segments/gin.rb +113 -0
  36. data/definitions/segments/imd.rb +9 -13
  37. data/definitions/segments/inv.rb +94 -0
  38. data/definitions/segments/lin.rb +24 -4
  39. data/definitions/segments/loc.rb +52 -4
  40. data/definitions/segments/moa.rb +86 -2
  41. data/definitions/segments/nad.rb +69 -9
  42. data/definitions/segments/pac.rb +12 -0
  43. data/definitions/segments/pat.rb +171 -0
  44. data/definitions/segments/pcd.rb +9 -92
  45. data/definitions/segments/pci.rb +110 -0
  46. data/definitions/segments/pgi.rb +7 -3
  47. data/definitions/segments/pia.rb +21 -29
  48. data/definitions/segments/pri.rb +25 -13
  49. data/definitions/segments/qty.rb +204 -2
  50. data/definitions/segments/rff.rb +49 -13
  51. data/definitions/segments/rte.rb +52 -0
  52. data/definitions/segments/tax.rb +17 -10
  53. data/definitions/segments/tdt.rb +24 -0
  54. data/definitions/segments/tod.rb +64 -0
  55. data/definitions/segments/tru.rb +34 -0
  56. data/definitions/segments/una.rb +8 -8
  57. data/definitions/segments/unb.rb +4 -7
  58. data/definitions/segments/unh.rb +70 -5
  59. data/definitions/segments/uns.rb +2 -2
  60. data/definitions/segments/unt.rb +2 -2
  61. data/definitions/slsrpt/d01b.rb +132 -128
  62. data/definitions/slsrpt/d96a.rb +132 -129
  63. data/eancom.gemspec +5 -8
  64. data/lib/eancom/edifact/body.rb +37 -18
  65. data/lib/eancom/edifact/document.rb +20 -16
  66. data/lib/eancom/edifact/footer.rb +1 -0
  67. data/lib/eancom/edifact/item.rb +1 -1
  68. data/lib/eancom/edifact/message.rb +7 -39
  69. data/lib/eancom/edifact/segment.rb +9 -11
  70. data/lib/eancom/edifact/segments/ajt.rb +32 -0
  71. data/lib/eancom/edifact/segments/ali.rb +2 -4
  72. data/lib/eancom/edifact/segments/bgm.rb +4 -3
  73. data/lib/eancom/edifact/segments/cdi.rb +30 -0
  74. data/lib/eancom/edifact/segments/cnt.rb +8 -1
  75. data/lib/eancom/edifact/segments/cps.rb +4 -1
  76. data/lib/eancom/edifact/segments/cta.rb +30 -0
  77. data/lib/eancom/edifact/segments/cux.rb +1 -1
  78. data/lib/eancom/edifact/segments/dgs.rb +31 -0
  79. data/lib/eancom/edifact/segments/doc.rb +30 -0
  80. data/lib/eancom/edifact/segments/dtm.rb +10 -6
  81. data/lib/eancom/edifact/segments/efi.rb +38 -0
  82. data/lib/eancom/edifact/segments/eqd.rb +30 -0
  83. data/lib/eancom/edifact/segments/ftx.rb +2 -2
  84. data/lib/eancom/edifact/segments/gin.rb +45 -0
  85. data/lib/eancom/edifact/segments/imd.rb +1 -1
  86. data/lib/eancom/edifact/segments/inv.rb +43 -0
  87. data/lib/eancom/edifact/segments/lin.rb +7 -4
  88. data/lib/eancom/edifact/segments/loc.rb +8 -9
  89. data/lib/eancom/edifact/segments/mea.rb +1 -0
  90. data/lib/eancom/edifact/segments/moa.rb +3 -3
  91. data/lib/eancom/edifact/segments/nad.rb +11 -6
  92. data/lib/eancom/edifact/segments/pac.rb +3 -1
  93. data/lib/eancom/edifact/segments/pat.rb +37 -0
  94. data/lib/eancom/edifact/segments/pcd.rb +6 -17
  95. data/lib/eancom/edifact/segments/pci.rb +40 -0
  96. data/lib/eancom/edifact/segments/pia.rb +1 -0
  97. data/lib/eancom/edifact/segments/pri.rb +0 -1
  98. data/lib/eancom/edifact/segments/qty.rb +9 -5
  99. data/lib/eancom/edifact/segments/rff.rb +8 -2
  100. data/lib/eancom/edifact/segments/rte.rb +33 -0
  101. data/lib/eancom/edifact/segments/tax.rb +7 -1
  102. data/lib/eancom/edifact/segments/tdt.rb +4 -1
  103. data/lib/eancom/edifact/segments/tod.rb +33 -0
  104. data/lib/eancom/edifact/segments/tru.rb +31 -0
  105. data/lib/eancom/edifact/segments/una.rb +2 -1
  106. data/lib/eancom/edifact/segments/unb.rb +4 -5
  107. data/lib/eancom/edifact/segments/unh.rb +6 -4
  108. data/lib/eancom/edifact/segments/uns.rb +4 -1
  109. data/lib/eancom/edifact/structure.rb +0 -1
  110. data/lib/eancom/edifact.rb +15 -4
  111. data/lib/eancom/factory.rb +1 -1
  112. data/lib/eancom/parser/document.rb +3 -16
  113. data/lib/eancom/parser/segment.rb +9 -10
  114. data/lib/eancom/version.rb +1 -3
  115. data/lib/eancom.rb +3 -1
  116. data/pricat.json +1 -0
  117. metadata +45 -51
  118. data/.rubocop.yml +0 -2
  119. data/.tool-versions +0 -1
  120. data/definitions/segments/qvr.rb +0 -140
  121. data/lib/eancom/edifact/location.rb +0 -56
  122. data/lib/eancom/edifact/segments/qvr.rb +0 -50
@@ -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)
@@ -6,7 +6,7 @@ structure = Eancom::Edifact::Structure.new(tag: tag)
6
6
  composite = Eancom::Edifact::Composite.new()
7
7
  data = Eancom::Edifact::Data.new(
8
8
  type: String,
9
- length: 3,
9
+ length: 1..3,
10
10
  dictionary: nil,
11
11
  description: "Service String Advice",
12
12
  required: true
@@ -17,7 +17,7 @@ structure << composite
17
17
  composite = Eancom::Edifact::Composite.new()
18
18
  data = Eancom::Edifact::Data.new(
19
19
  type: String,
20
- length: 1,
20
+ length: 0..1,
21
21
  dictionary: nil,
22
22
  description: "Component data element separator",
23
23
  required: true
@@ -28,7 +28,7 @@ structure << composite
28
28
  composite = Eancom::Edifact::Composite.new()
29
29
  data = Eancom::Edifact::Data.new(
30
30
  type: String,
31
- length: 1,
31
+ length: 0..1,
32
32
  dictionary: nil,
33
33
  description: "Data element separator",
34
34
  required: true
@@ -39,7 +39,7 @@ structure << composite
39
39
  composite = Eancom::Edifact::Composite.new()
40
40
  data = Eancom::Edifact::Data.new(
41
41
  type: String,
42
- length: 1,
42
+ length: 0..1,
43
43
  dictionary: nil,
44
44
  description: "Decimal notation",
45
45
  required: true
@@ -50,7 +50,7 @@ structure << composite
50
50
  composite = Eancom::Edifact::Composite.new()
51
51
  data = Eancom::Edifact::Data.new(
52
52
  type: String,
53
- length: 1,
53
+ length: 0..1,
54
54
  dictionary: nil,
55
55
  description: "Release character",
56
56
  required: true
@@ -61,7 +61,7 @@ structure << composite
61
61
  composite = Eancom::Edifact::Composite.new()
62
62
  data = Eancom::Edifact::Data.new(
63
63
  type: String,
64
- length: 1,
64
+ length: 0..1,
65
65
  dictionary: nil,
66
66
  description: "Reserved for future use",
67
67
  required: true
@@ -72,7 +72,7 @@ structure << composite
72
72
  composite = Eancom::Edifact::Composite.new()
73
73
  data = Eancom::Edifact::Data.new(
74
74
  type: String,
75
- length: 1,
75
+ length: 0..1,
76
76
  dictionary: nil,
77
77
  description: "Segment terminator",
78
78
  required: true
@@ -80,6 +80,6 @@ data = Eancom::Edifact::Data.new(
80
80
  composite.add(:una6, data)
81
81
  structure << composite
82
82
 
83
- Eancom.register_structure(tag: 'UNA', structure: structure)
83
+ Eancom.register_structure(tag: tag, structure: structure)
84
84
 
85
85
 
@@ -8,7 +8,7 @@ structure = Eancom::Edifact::Structure.new(tag: tag)
8
8
  tag = Eancom::Edifact::Composite.new()
9
9
  data = Eancom::Edifact::Data.new(
10
10
  type: String,
11
- length: 3,
11
+ length: 1..3,
12
12
  dictionary: nil,
13
13
  description: "Interchange Header",
14
14
  required: true
@@ -44,7 +44,7 @@ syntax_dictionary = {
44
44
  }
45
45
  data = Eancom::Edifact::Data.new(
46
46
  type: String,
47
- length: 4,
47
+ length: 1..4,
48
48
  dictionary: syntax_dictionary,
49
49
  description: "Syntax identifier.",
50
50
  required: true
@@ -57,9 +57,6 @@ syntax_version_dict = {
57
57
  },
58
58
  '3' => {
59
59
  description: 'Version 3'
60
- },
61
- '4' => {
62
- description: 'Version 4'
63
60
  }
64
61
  }
65
62
  data = Eancom::Edifact::Data.new(
@@ -157,7 +154,7 @@ date_and_time_of_preparation.add(:date, data)
157
154
 
158
155
  data = Eancom::Edifact::Data.new(
159
156
  type: String,
160
- length: 4,
157
+ length: 1..4,
161
158
  dictionary: nil,
162
159
  description: "Time (HHMM)",
163
160
  required: true
@@ -196,7 +193,7 @@ recipient_reference.add(:recipient_reference, data)
196
193
 
197
194
  data = Eancom::Edifact::Data.new(
198
195
  type: String,
199
- length: 2,
196
+ length: 1..2,
200
197
  dictionary: nil,
201
198
  description: "Recipient reference/password qualifier.",
202
199
  required: false
@@ -38,8 +38,33 @@ message_identifier = Eancom::Edifact::Composite.new()
38
38
  data = Eancom::Edifact::Data.new(
39
39
  type: String,
40
40
  length: 1..6,
41
- dictionary: nil,
42
- description: 'Identification of a message',
41
+ dictionary: {
42
+ 'ORDERS' => {
43
+ description: 'Purchase order message'
44
+ },
45
+ 'SLSRPT' => {
46
+ description: 'Sales data report message'
47
+ },
48
+ 'DESADV' => {
49
+ description: 'Despatch advice message'
50
+ },
51
+ 'INVRPT' => {
52
+ description: 'Inventory report message'
53
+ },
54
+ 'PRICAT' => {
55
+ description: 'Price catalogue message'
56
+ },
57
+ 'ORDRSP' => {
58
+ description: 'Orders report message'
59
+ },
60
+ 'INVOIC' => {
61
+ description: 'Invoice message'
62
+ },
63
+ 'RETANN' => {
64
+ description: 'Announcement for returns message'
65
+ }
66
+ },
67
+ description: 'Message Type',
43
68
  required: true
44
69
  )
45
70
  message_identifier.add(:message_type, data)
@@ -69,6 +94,9 @@ data = Eancom::Edifact::Data.new(
69
94
  },
70
95
  '96A' => {
71
96
  description: 'Release 96A'
97
+ },
98
+ 'UN' => {
99
+ description: 'UN/CEFACT'
72
100
  }
73
101
  },
74
102
  description: 'Message release number',
@@ -82,6 +110,9 @@ data = Eancom::Edifact::Data.new(
82
110
  dictionary: {
83
111
  'UN' => {
84
112
  description: 'UN/CEFACT'
113
+ },
114
+ 'EN' => {
115
+ description: 'Default value'
85
116
  }
86
117
  },
87
118
  description: 'Controlling agency',
@@ -92,15 +123,49 @@ message_identifier.add(:controlling_agency, data)
92
123
  data = Eancom::Edifact::Data.new(
93
124
  type: String,
94
125
  length: 1..6,
95
- dictionary: nil,
126
+ dictionary: {
127
+ 'EAN001' => {
128
+ description: 'GS1 version control number (GS1 Permanent Code)'
129
+ },
130
+ 'EAN011' => {
131
+ description: 'GS1 version control number (GS1 Permanent Code)'
132
+ },
133
+ 'EAN003' => {
134
+ description: 'GS1 version control number (GS1 Permanent Code)'
135
+ },
136
+ 'EAN004' => {
137
+ description: 'GS1 version control number (GS1 Permanent Code)'
138
+ },
139
+ 'EAN005' => {
140
+ description: 'GS1 version control number (GS1 Permanent Code)'
141
+ },
142
+ 'EAN006' => {
143
+ description: 'GS1 version control number (GS1 Permanent Code)'
144
+ },
145
+ 'EAN007' => {
146
+ description: 'GS1 version control number (GS1 Permanent Code)'
147
+ },
148
+ 'EAN008' => {
149
+ description: 'GS1 version control number (GS1 Permanent Code)'
150
+ },
151
+ 'EAN009' => {
152
+ description: 'GS1 version control number (GS1 Permanent Code)'
153
+ },
154
+ 'EAN010' => {
155
+ description: 'GS1 version control number (GS1 Code)'
156
+ },
157
+ 'GDSN23' => {
158
+ description: 'GDSN version 2.3 (GS1 Permanent Code)'
159
+ }
160
+ },
96
161
  description: 'Association assigned code',
97
- required: true
162
+ required: false
98
163
  )
99
164
  message_identifier.add(:association_assigned_code, data)
100
165
 
101
166
  structure << message_identifier
102
167
  #==============================================================================
103
- # Code list directory version number # #
168
+ # Code list directory version number #
104
169
  #==============================================================================
105
170
  code_list_directory_version_number = Eancom::Edifact::Composite.new()
106
171
 
@@ -8,7 +8,7 @@ structure = Eancom::Edifact::Structure.new(tag: tag)
8
8
  tag = Eancom::Edifact::Composite.new()
9
9
  data = Eancom::Edifact::Data.new(
10
10
  type: String,
11
- length: 3,
11
+ length: 1..3,
12
12
  dictionary: nil,
13
13
  description: "Message Header",
14
14
  required: true
@@ -23,7 +23,7 @@ section_identification = Eancom::Edifact::Composite.new()
23
23
 
24
24
  data = Eancom::Edifact::Data.new(
25
25
  type: String,
26
- length: 1,
26
+ length: 0..1,
27
27
  dictionary: {
28
28
  'S' => {
29
29
  description: 'Detail/summary section separation',
@@ -8,7 +8,7 @@ structure = Eancom::Edifact::Structure.new(tag: tag)
8
8
  tag = Eancom::Edifact::Composite.new()
9
9
  data = Eancom::Edifact::Data.new(
10
10
  type: String,
11
- length: 3,
11
+ length: 1..3,
12
12
  dictionary: nil,
13
13
  description: "Message Header",
14
14
  required: true
@@ -38,7 +38,7 @@ data = Eancom::Edifact::Data.new(
38
38
  type: String,
39
39
  length: 1..14,
40
40
  dictionary: nil,
41
- description: "Number of segments in the message",
41
+ description: "Message reference number",
42
42
  required: true
43
43
  )
44
44
  message_reference_number.add(:message_reference_number, data)