eancom 1.6.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -4
- data/.gitlab-ci.yml +11 -13
- data/.ruby-version +1 -1
- data/Gemfile +2 -4
- data/Gemfile.lock +21 -103
- data/README.md +46 -0
- data/definitions/desadv/d01b.rb +134 -87
- data/definitions/desadv/d96a.rb +145 -82
- data/definitions/invoic/d01b.rb +559 -0
- data/definitions/invoic/d96a.rb +389 -0
- data/definitions/invrpt/d01b.rb +134 -0
- data/definitions/invrpt/d96a.rb +125 -0
- data/definitions/orders/d01b.rb +182 -0
- data/definitions/orders/d96b.rb +198 -0
- data/definitions/ordrsp/d01b.rb +251 -0
- data/definitions/ordrsp/d96b.rb +226 -0
- data/definitions/pricat/d01b.rb +225 -0
- data/definitions/pricat/d96b.rb +207 -0
- data/definitions/retann/d01b.rb +172 -0
- data/definitions/retann/d96b.rb +221 -0
- data/definitions/segments/ajt.rb +47 -0
- data/definitions/segments/alc.rb +128 -36
- data/definitions/segments/bgm.rb +122 -2
- data/definitions/segments/cdi.rb +39 -0
- data/definitions/segments/cnt.rb +4 -0
- data/definitions/segments/cta.rb +89 -0
- data/definitions/segments/cux.rb +9 -2
- data/definitions/segments/dgs.rb +34 -0
- data/definitions/segments/doc.rb +45 -0
- data/definitions/segments/dtm.rb +75 -20
- data/definitions/segments/efi.rb +67 -0
- data/definitions/segments/eqd.rb +37 -0
- data/definitions/segments/ftx.rb +22 -8
- data/definitions/segments/gin.rb +113 -0
- data/definitions/segments/imd.rb +9 -13
- data/definitions/segments/inv.rb +94 -0
- data/definitions/segments/lin.rb +24 -4
- data/definitions/segments/loc.rb +52 -4
- data/definitions/segments/moa.rb +86 -2
- data/definitions/segments/nad.rb +69 -9
- data/definitions/segments/pac.rb +12 -0
- data/definitions/segments/pat.rb +171 -0
- data/definitions/segments/pcd.rb +9 -92
- data/definitions/segments/pci.rb +110 -0
- data/definitions/segments/pgi.rb +7 -3
- data/definitions/segments/pia.rb +21 -29
- data/definitions/segments/pri.rb +25 -13
- data/definitions/segments/qty.rb +208 -2
- data/definitions/segments/rff.rb +49 -13
- data/definitions/segments/rte.rb +52 -0
- data/definitions/segments/tax.rb +17 -10
- data/definitions/segments/tdt.rb +24 -0
- data/definitions/segments/tod.rb +64 -0
- data/definitions/segments/tru.rb +34 -0
- data/definitions/segments/una.rb +8 -8
- data/definitions/segments/unb.rb +4 -4
- data/definitions/segments/unh.rb +70 -5
- data/definitions/segments/uns.rb +2 -2
- data/definitions/segments/unt.rb +2 -2
- data/definitions/slsrpt/d01b.rb +132 -128
- data/definitions/slsrpt/d96a.rb +132 -129
- data/eancom.gemspec +5 -8
- data/lib/eancom/edifact/body.rb +37 -18
- data/lib/eancom/edifact/document.rb +20 -16
- data/lib/eancom/edifact/footer.rb +1 -0
- data/lib/eancom/edifact/item.rb +1 -1
- data/lib/eancom/edifact/message.rb +7 -39
- data/lib/eancom/edifact/segment.rb +9 -11
- data/lib/eancom/edifact/segments/ajt.rb +32 -0
- data/lib/eancom/edifact/segments/ali.rb +2 -4
- data/lib/eancom/edifact/segments/bgm.rb +4 -3
- data/lib/eancom/edifact/segments/cdi.rb +30 -0
- data/lib/eancom/edifact/segments/cnt.rb +8 -1
- data/lib/eancom/edifact/segments/cps.rb +4 -1
- data/lib/eancom/edifact/segments/cta.rb +30 -0
- data/lib/eancom/edifact/segments/cux.rb +1 -1
- data/lib/eancom/edifact/segments/dgs.rb +31 -0
- data/lib/eancom/edifact/segments/doc.rb +30 -0
- data/lib/eancom/edifact/segments/dtm.rb +10 -6
- data/lib/eancom/edifact/segments/efi.rb +38 -0
- data/lib/eancom/edifact/segments/eqd.rb +30 -0
- data/lib/eancom/edifact/segments/ftx.rb +2 -2
- data/lib/eancom/edifact/segments/gin.rb +45 -0
- data/lib/eancom/edifact/segments/imd.rb +1 -1
- data/lib/eancom/edifact/segments/inv.rb +43 -0
- data/lib/eancom/edifact/segments/lin.rb +7 -4
- data/lib/eancom/edifact/segments/loc.rb +8 -9
- data/lib/eancom/edifact/segments/mea.rb +1 -0
- data/lib/eancom/edifact/segments/moa.rb +3 -3
- data/lib/eancom/edifact/segments/nad.rb +11 -6
- data/lib/eancom/edifact/segments/pac.rb +3 -1
- data/lib/eancom/edifact/segments/pat.rb +37 -0
- data/lib/eancom/edifact/segments/pcd.rb +6 -17
- data/lib/eancom/edifact/segments/pci.rb +40 -0
- data/lib/eancom/edifact/segments/pia.rb +1 -0
- data/lib/eancom/edifact/segments/pri.rb +0 -1
- data/lib/eancom/edifact/segments/qty.rb +9 -5
- data/lib/eancom/edifact/segments/rff.rb +8 -2
- data/lib/eancom/edifact/segments/rte.rb +33 -0
- data/lib/eancom/edifact/segments/tax.rb +7 -1
- data/lib/eancom/edifact/segments/tdt.rb +4 -1
- data/lib/eancom/edifact/segments/tod.rb +33 -0
- data/lib/eancom/edifact/segments/tru.rb +31 -0
- data/lib/eancom/edifact/segments/una.rb +2 -1
- data/lib/eancom/edifact/segments/unb.rb +4 -5
- data/lib/eancom/edifact/segments/unh.rb +6 -4
- data/lib/eancom/edifact/segments/uns.rb +4 -1
- data/lib/eancom/edifact/structure.rb +0 -1
- data/lib/eancom/edifact.rb +15 -4
- data/lib/eancom/factory.rb +1 -1
- data/lib/eancom/parser/document.rb +3 -16
- data/lib/eancom/parser/segment.rb +9 -10
- data/lib/eancom/version.rb +1 -3
- data/lib/eancom.rb +3 -1
- data/pricat.json +1 -0
- metadata +45 -51
- data/.rubocop.yml +0 -2
- data/.tool-versions +0 -1
- data/definitions/segments/qvr.rb +0 -140
- data/lib/eancom/edifact/location.rb +0 -56
- data/lib/eancom/edifact/segments/qvr.rb +0 -50
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eancom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fadendaten GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: pry-nav
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: pry-remote
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,35 +39,7 @@ dependencies:
|
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
42
|
+
name: pry-nav
|
85
43
|
requirement: !ruby/object:Gem::Requirement
|
86
44
|
requirements:
|
87
45
|
- - ">="
|
@@ -133,9 +91,7 @@ files:
|
|
133
91
|
- ".gitignore"
|
134
92
|
- ".gitlab-ci.yml"
|
135
93
|
- ".rspec"
|
136
|
-
- ".rubocop.yml"
|
137
94
|
- ".ruby-version"
|
138
|
-
- ".tool-versions"
|
139
95
|
- ".travis.yml"
|
140
96
|
- Gemfile
|
141
97
|
- Gemfile.lock
|
@@ -146,32 +102,57 @@ files:
|
|
146
102
|
- bin/setup
|
147
103
|
- definitions/desadv/d01b.rb
|
148
104
|
- definitions/desadv/d96a.rb
|
105
|
+
- definitions/invoic/d01b.rb
|
106
|
+
- definitions/invoic/d96a.rb
|
107
|
+
- definitions/invrpt/d01b.rb
|
108
|
+
- definitions/invrpt/d96a.rb
|
109
|
+
- definitions/orders/d01b.rb
|
110
|
+
- definitions/orders/d96b.rb
|
111
|
+
- definitions/ordrsp/d01b.rb
|
112
|
+
- definitions/ordrsp/d96b.rb
|
113
|
+
- definitions/pricat/d01b.rb
|
114
|
+
- definitions/pricat/d96b.rb
|
115
|
+
- definitions/retann/d01b.rb
|
116
|
+
- definitions/retann/d96b.rb
|
117
|
+
- definitions/segments/ajt.rb
|
149
118
|
- definitions/segments/alc.rb
|
150
119
|
- definitions/segments/ali.rb
|
151
120
|
- definitions/segments/bgm.rb
|
152
121
|
- definitions/segments/cav.rb
|
153
122
|
- definitions/segments/cci.rb
|
123
|
+
- definitions/segments/cdi.rb
|
154
124
|
- definitions/segments/cnt.rb
|
155
125
|
- definitions/segments/cps.rb
|
126
|
+
- definitions/segments/cta.rb
|
156
127
|
- definitions/segments/cux.rb
|
128
|
+
- definitions/segments/dgs.rb
|
129
|
+
- definitions/segments/doc.rb
|
157
130
|
- definitions/segments/dtm.rb
|
131
|
+
- definitions/segments/efi.rb
|
132
|
+
- definitions/segments/eqd.rb
|
158
133
|
- definitions/segments/ftx.rb
|
134
|
+
- definitions/segments/gin.rb
|
159
135
|
- definitions/segments/imd.rb
|
136
|
+
- definitions/segments/inv.rb
|
160
137
|
- definitions/segments/lin.rb
|
161
138
|
- definitions/segments/loc.rb
|
162
139
|
- definitions/segments/mea.rb
|
163
140
|
- definitions/segments/moa.rb
|
164
141
|
- definitions/segments/nad.rb
|
165
142
|
- definitions/segments/pac.rb
|
143
|
+
- definitions/segments/pat.rb
|
166
144
|
- definitions/segments/pcd.rb
|
145
|
+
- definitions/segments/pci.rb
|
167
146
|
- definitions/segments/pgi.rb
|
168
147
|
- definitions/segments/pia.rb
|
169
148
|
- definitions/segments/pri.rb
|
170
149
|
- definitions/segments/qty.rb
|
171
|
-
- definitions/segments/qvr.rb
|
172
150
|
- definitions/segments/rff.rb
|
151
|
+
- definitions/segments/rte.rb
|
173
152
|
- definitions/segments/tax.rb
|
174
153
|
- definitions/segments/tdt.rb
|
154
|
+
- definitions/segments/tod.rb
|
155
|
+
- definitions/segments/tru.rb
|
175
156
|
- definitions/segments/una.rb
|
176
157
|
- definitions/segments/unb.rb
|
177
158
|
- definitions/segments/unh.rb
|
@@ -192,35 +173,47 @@ files:
|
|
192
173
|
- lib/eancom/edifact/footer.rb
|
193
174
|
- lib/eancom/edifact/header.rb
|
194
175
|
- lib/eancom/edifact/item.rb
|
195
|
-
- lib/eancom/edifact/location.rb
|
196
176
|
- lib/eancom/edifact/message.rb
|
197
177
|
- lib/eancom/edifact/segment.rb
|
178
|
+
- lib/eancom/edifact/segments/ajt.rb
|
198
179
|
- lib/eancom/edifact/segments/alc.rb
|
199
180
|
- lib/eancom/edifact/segments/ali.rb
|
200
181
|
- lib/eancom/edifact/segments/bgm.rb
|
201
182
|
- lib/eancom/edifact/segments/cav.rb
|
202
183
|
- lib/eancom/edifact/segments/cci.rb
|
184
|
+
- lib/eancom/edifact/segments/cdi.rb
|
203
185
|
- lib/eancom/edifact/segments/cnt.rb
|
204
186
|
- lib/eancom/edifact/segments/cps.rb
|
187
|
+
- lib/eancom/edifact/segments/cta.rb
|
205
188
|
- lib/eancom/edifact/segments/cux.rb
|
189
|
+
- lib/eancom/edifact/segments/dgs.rb
|
190
|
+
- lib/eancom/edifact/segments/doc.rb
|
206
191
|
- lib/eancom/edifact/segments/dtm.rb
|
192
|
+
- lib/eancom/edifact/segments/efi.rb
|
193
|
+
- lib/eancom/edifact/segments/eqd.rb
|
207
194
|
- lib/eancom/edifact/segments/ftx.rb
|
195
|
+
- lib/eancom/edifact/segments/gin.rb
|
208
196
|
- lib/eancom/edifact/segments/imd.rb
|
197
|
+
- lib/eancom/edifact/segments/inv.rb
|
209
198
|
- lib/eancom/edifact/segments/lin.rb
|
210
199
|
- lib/eancom/edifact/segments/loc.rb
|
211
200
|
- lib/eancom/edifact/segments/mea.rb
|
212
201
|
- lib/eancom/edifact/segments/moa.rb
|
213
202
|
- lib/eancom/edifact/segments/nad.rb
|
214
203
|
- lib/eancom/edifact/segments/pac.rb
|
204
|
+
- lib/eancom/edifact/segments/pat.rb
|
215
205
|
- lib/eancom/edifact/segments/pcd.rb
|
206
|
+
- lib/eancom/edifact/segments/pci.rb
|
216
207
|
- lib/eancom/edifact/segments/pgi.rb
|
217
208
|
- lib/eancom/edifact/segments/pia.rb
|
218
209
|
- lib/eancom/edifact/segments/pri.rb
|
219
210
|
- lib/eancom/edifact/segments/qty.rb
|
220
|
-
- lib/eancom/edifact/segments/qvr.rb
|
221
211
|
- lib/eancom/edifact/segments/rff.rb
|
212
|
+
- lib/eancom/edifact/segments/rte.rb
|
222
213
|
- lib/eancom/edifact/segments/tax.rb
|
223
214
|
- lib/eancom/edifact/segments/tdt.rb
|
215
|
+
- lib/eancom/edifact/segments/tod.rb
|
216
|
+
- lib/eancom/edifact/segments/tru.rb
|
224
217
|
- lib/eancom/edifact/segments/una.rb
|
225
218
|
- lib/eancom/edifact/segments/unb.rb
|
226
219
|
- lib/eancom/edifact/segments/unh.rb
|
@@ -233,6 +226,7 @@ files:
|
|
233
226
|
- lib/eancom/parser/document.rb
|
234
227
|
- lib/eancom/parser/segment.rb
|
235
228
|
- lib/eancom/version.rb
|
229
|
+
- pricat.json
|
236
230
|
homepage: https://fadendaten.ch
|
237
231
|
licenses:
|
238
232
|
- MIT
|
@@ -253,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
247
|
- !ruby/object:Gem::Version
|
254
248
|
version: '0'
|
255
249
|
requirements: []
|
256
|
-
rubygems_version: 3.2.
|
250
|
+
rubygems_version: 3.2.3
|
257
251
|
signing_key:
|
258
252
|
specification_version: 4
|
259
253
|
summary: EDIFACT Generator for the EANCOM Subset
|
data/.rubocop.yml
DELETED
data/.tool-versions
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby 3.0.2
|
data/definitions/segments/qvr.rb
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
tag = 'QVR'
|
4
|
-
Eancom.register_segment(tag: tag, klass: Eancom::Edifact::QVR)
|
5
|
-
|
6
|
-
structure = Eancom::Edifact::Structure.new(tag: tag)
|
7
|
-
#==============================================================================
|
8
|
-
# Tag #
|
9
|
-
#==============================================================================
|
10
|
-
tag = Eancom::Edifact::Composite.new
|
11
|
-
data = Eancom::Edifact::Data.new(
|
12
|
-
type: String,
|
13
|
-
length: 3,
|
14
|
-
dictionary: nil,
|
15
|
-
description: "Message Header",
|
16
|
-
required: true
|
17
|
-
)
|
18
|
-
tag.add(:tag, data)
|
19
|
-
|
20
|
-
structure << tag
|
21
|
-
#==============================================================================
|
22
|
-
# Quantity difference information
|
23
|
-
#==============================================================================
|
24
|
-
quantity_difference_information = Eancom::Edifact::Composite.new
|
25
|
-
|
26
|
-
data = Eancom::Edifact::Data.new(
|
27
|
-
type: Integer,
|
28
|
-
length: 1..15,
|
29
|
-
dictionary: nil,
|
30
|
-
description: "Specify the actual variance amount here.",
|
31
|
-
required: true
|
32
|
-
)
|
33
|
-
quantity_difference_information.add(:quantity_variance_value, data)
|
34
|
-
|
35
|
-
data = Eancom::Edifact::Data.new(
|
36
|
-
type: String,
|
37
|
-
length: 1..3,
|
38
|
-
dictionary: {
|
39
|
-
'21' => {
|
40
|
-
description: 'Ordered quantity',
|
41
|
-
identifier: 'ordered_quantity'
|
42
|
-
},
|
43
|
-
'66' => {
|
44
|
-
description: 'Committed quantity',
|
45
|
-
identifier: 'committed_quantity'
|
46
|
-
}
|
47
|
-
},
|
48
|
-
description: "Quantity type code qualifier",
|
49
|
-
required: true
|
50
|
-
)
|
51
|
-
quantity_difference_information.add(:quantity_type_code_qualifier, data)
|
52
|
-
|
53
|
-
structure << quantity_difference_information
|
54
|
-
#==============================================================================
|
55
|
-
# Discrepancy nature identification code
|
56
|
-
#==============================================================================
|
57
|
-
discrepancy_nature_identification_code = Eancom::Edifact::Composite.new
|
58
|
-
|
59
|
-
data = Eancom::Edifact::Data.new(
|
60
|
-
type: String,
|
61
|
-
length: 0..3,
|
62
|
-
dictionary: {
|
63
|
-
'BP' => {
|
64
|
-
description: 'Shipment partial - back order to follow',
|
65
|
-
identifier: 'shipment_partial_back_order_to_follow',
|
66
|
-
},
|
67
|
-
'CP' => {
|
68
|
-
description: 'Shipment partial - considered complete, no backorder',
|
69
|
-
identifier: 'shipment_partial_considered_complete_no_backorder',
|
70
|
-
},
|
71
|
-
},
|
72
|
-
description: "",
|
73
|
-
required: true
|
74
|
-
)
|
75
|
-
discrepancy_nature_identification_code.add(:discrepancy_nature_identification_code, data)
|
76
|
-
|
77
|
-
structure << discrepancy_nature_identification_code
|
78
|
-
#==============================================================================
|
79
|
-
# Reason for change
|
80
|
-
#==============================================================================
|
81
|
-
reason_for_change = Eancom::Edifact::Composite.new
|
82
|
-
|
83
|
-
data = Eancom::Edifact::Data.new(
|
84
|
-
type: String,
|
85
|
-
length: 1..3,
|
86
|
-
dictionary: {
|
87
|
-
'WR' => {
|
88
|
-
description: 'Temporarily unavailable',
|
89
|
-
identifier: 'temporarily_unavailable',
|
90
|
-
},
|
91
|
-
},
|
92
|
-
description: "Change reason description code",
|
93
|
-
required: false
|
94
|
-
)
|
95
|
-
reason_for_change.add(:change_reason_description_code, data)
|
96
|
-
|
97
|
-
data = Eancom::Edifact::Data.new(
|
98
|
-
type: String,
|
99
|
-
length: 0..17,
|
100
|
-
dictionary: nil,
|
101
|
-
description: 'Code list identification code',
|
102
|
-
required: false
|
103
|
-
)
|
104
|
-
reason_for_change.add(:code_list_idenfitifaction_code, data)
|
105
|
-
|
106
|
-
data = Eancom::Edifact::Data.new(
|
107
|
-
type: String,
|
108
|
-
length: 0..3,
|
109
|
-
dictionary: {
|
110
|
-
'9' => {
|
111
|
-
description: 'GS1',
|
112
|
-
identifier: 'gsi',
|
113
|
-
},
|
114
|
-
'91' => {
|
115
|
-
description: 'Assigned by supplier or suppliers agent',
|
116
|
-
identifier: 'assigned_by_supplier_or_suppliers_agent'
|
117
|
-
},
|
118
|
-
'92' => {
|
119
|
-
description: 'Assigned by buyer or buyers agent',
|
120
|
-
identifier: 'assigned_by_buyer_or_buyers_agent'
|
121
|
-
}
|
122
|
-
},
|
123
|
-
description: 'Code list responsible agancy code',
|
124
|
-
required: false
|
125
|
-
)
|
126
|
-
reason_for_change.add(:code_list_responsibility_agency_code, data)
|
127
|
-
|
128
|
-
data = Eancom::Edifact::Data.new(
|
129
|
-
type: String,
|
130
|
-
length: 1..35,
|
131
|
-
dictionary: nil,
|
132
|
-
description: "Change reason description",
|
133
|
-
required: false
|
134
|
-
)
|
135
|
-
reason_for_change.add(:change_reason_description, data)
|
136
|
-
|
137
|
-
structure << reason_for_change
|
138
|
-
|
139
|
-
#==============================================================================
|
140
|
-
Eancom.register_structure(tag: 'QVR', structure: structure)
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Eancom
|
4
|
-
module Edifact
|
5
|
-
class Location
|
6
|
-
attr_accessor :items, :hash
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@items = []
|
10
|
-
@hash = {}
|
11
|
-
end
|
12
|
-
|
13
|
-
def add_item(item)
|
14
|
-
@items << item
|
15
|
-
end
|
16
|
-
|
17
|
-
def <<(segment)
|
18
|
-
start_item if segment.starts_item?
|
19
|
-
|
20
|
-
if @item
|
21
|
-
@item << segment
|
22
|
-
elsif name = group_name(segment)
|
23
|
-
@hash[name] = [] if @hash[name].nil?
|
24
|
-
@hash[name] << segment.to_json_hash
|
25
|
-
else
|
26
|
-
@hash.merge!(segment.to_json_hash)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def to_json_hash
|
31
|
-
if @item && !@item.empty?
|
32
|
-
add_item(@item.to_json_hash)
|
33
|
-
end
|
34
|
-
|
35
|
-
@hash.merge({ items: @items })
|
36
|
-
end
|
37
|
-
|
38
|
-
def empty?
|
39
|
-
@hash.empty?
|
40
|
-
end
|
41
|
-
|
42
|
-
def start_item
|
43
|
-
if @item && !@item.empty?
|
44
|
-
add_item(@item.to_json_hash)
|
45
|
-
end
|
46
|
-
@item = Eancom::Edifact::Item.new
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def group_name(segment)
|
52
|
-
segment.item_group_name || segment.group_name
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Eancom
|
4
|
-
module Edifact
|
5
|
-
class QVR < Segment
|
6
|
-
TAG = 'QVR'
|
7
|
-
TYPE = :body
|
8
|
-
|
9
|
-
def initialize(
|
10
|
-
tag: nil,
|
11
|
-
quantity_variance_value:,
|
12
|
-
quantity_type_code_qualifier:,
|
13
|
-
discrepancy_nature_identification_code: nil,
|
14
|
-
change_reason_description_code: nil,
|
15
|
-
code_list_identification_code: nil,
|
16
|
-
code_list_responsible_agency_code: nil,
|
17
|
-
change_reason_description: nil
|
18
|
-
)
|
19
|
-
@tag = tag
|
20
|
-
|
21
|
-
@quantity_variance_value = quantity_variance_value
|
22
|
-
@quantity_type_code_qualifier = quantity_type_code_qualifier
|
23
|
-
@discrepancy_nature_identification_code = discrepancy_nature_identification_code
|
24
|
-
@change_reason_description_code = change_reason_description_code
|
25
|
-
@code_list_identification_code = code_list_identification_code
|
26
|
-
@code_list_responsible_agency_code = code_list_responsible_agency_code
|
27
|
-
@change_reason_description = change_reason_description
|
28
|
-
|
29
|
-
super(tag: tag || TAG)
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_json_hash
|
33
|
-
hash = {}
|
34
|
-
hash.merge!(quantity_variance_value: quantity_variance_value)
|
35
|
-
hash.merge!(quantity_type_code_qualifier: find_identifier(:quantity_type_code_qualifier))
|
36
|
-
hash.merge!(discrepancy_nature_identification_code: find_identifier(:discrepancy_nature_identification_code)) if @discrepancy_nature_identification_code
|
37
|
-
hash.merge!(change_reason_description: @change_reason_description) if @change_reason_description
|
38
|
-
hash
|
39
|
-
end
|
40
|
-
|
41
|
-
def group_name
|
42
|
-
'quantity_variances'
|
43
|
-
end
|
44
|
-
|
45
|
-
def segment_type
|
46
|
-
TYPE
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|