eancom 0.1.0 → 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 +190 -5
- data/.gitlab-ci.yml +25 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +22 -18
- data/README.md +46 -0
- data/bin/console +3 -2
- data/definitions/desadv/d01b.rb +251 -0
- data/definitions/desadv/d96a.rb +208 -87
- 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 +328 -0
- data/definitions/segments/ali.rb +93 -0
- data/definitions/segments/bgm.rb +395 -0
- data/definitions/segments/cav.rb +122 -0
- data/definitions/segments/cci.rb +136 -0
- data/definitions/segments/cdi.rb +39 -0
- data/definitions/segments/cnt.rb +82 -0
- data/definitions/segments/cps.rb +76 -0
- data/definitions/segments/cta.rb +89 -0
- data/definitions/segments/cux.rb +174 -0
- data/definitions/segments/dgs.rb +34 -0
- data/definitions/segments/doc.rb +45 -0
- data/definitions/segments/dtm.rb +243 -0
- data/definitions/segments/efi.rb +67 -0
- data/definitions/segments/eqd.rb +37 -0
- data/definitions/segments/ftx.rb +165 -0
- data/definitions/segments/gin.rb +113 -0
- data/definitions/segments/imd.rb +360 -0
- data/definitions/segments/inv.rb +94 -0
- data/definitions/segments/lin.rb +133 -0
- data/definitions/segments/loc.rb +137 -0
- data/definitions/segments/mea.rb +189 -0
- data/definitions/segments/moa.rb +228 -0
- data/definitions/segments/nad.rb +314 -0
- data/definitions/segments/pac.rb +262 -0
- data/definitions/segments/pat.rb +171 -0
- data/definitions/segments/pcd.rb +72 -0
- data/definitions/segments/pci.rb +110 -0
- data/definitions/segments/pgi.rb +152 -0
- data/definitions/segments/pia.rb +501 -0
- data/definitions/segments/pri.rb +208 -0
- data/definitions/segments/qty.rb +293 -0
- data/definitions/segments/rff.rb +210 -0
- data/definitions/segments/rte.rb +52 -0
- data/definitions/segments/tax.rb +266 -0
- data/definitions/segments/tdt.rb +278 -0
- data/definitions/segments/tod.rb +64 -0
- data/definitions/segments/tru.rb +34 -0
- data/definitions/segments/una.rb +85 -0
- data/definitions/segments/unb.rb +284 -0
- data/definitions/segments/unh.rb +183 -0
- data/definitions/segments/uns.rb +40 -0
- data/definitions/segments/unt.rb +48 -0
- data/definitions/segments/unz.rb +48 -0
- data/definitions/slsrpt/d01b.rb +206 -0
- data/definitions/slsrpt/d96a.rb +199 -0
- data/eancom.gemspec +2 -1
- data/lib/eancom.rb +61 -16
- data/lib/eancom/definition.rb +1 -1
- data/lib/eancom/edifact.rb +60 -13
- data/lib/eancom/edifact/body.rb +63 -0
- data/lib/eancom/edifact/composite.rb +38 -0
- data/lib/eancom/edifact/data.rb +108 -0
- data/lib/eancom/edifact/document.rb +43 -11
- data/lib/eancom/edifact/document_element.rb +26 -0
- data/lib/eancom/edifact/footer.rb +7 -0
- data/lib/eancom/edifact/header.rb +15 -0
- data/lib/eancom/edifact/item.rb +40 -0
- data/lib/eancom/edifact/message.rb +24 -16
- data/lib/eancom/edifact/segment.rb +131 -12
- data/lib/eancom/edifact/segments/ajt.rb +32 -0
- data/lib/eancom/edifact/segments/alc.rb +61 -0
- data/lib/eancom/edifact/segments/ali.rb +50 -0
- data/lib/eancom/edifact/segments/bgm.rb +46 -0
- data/lib/eancom/edifact/segments/cav.rb +47 -0
- data/lib/eancom/edifact/segments/cci.rb +53 -0
- data/lib/eancom/edifact/segments/cdi.rb +30 -0
- data/lib/eancom/edifact/segments/cnt.rb +40 -0
- data/lib/eancom/edifact/segments/cps.rb +33 -0
- data/lib/eancom/edifact/segments/cta.rb +30 -0
- data/lib/eancom/edifact/segments/cux.rb +60 -0
- 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 +47 -0
- 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 +63 -0
- data/lib/eancom/edifact/segments/gin.rb +45 -0
- data/lib/eancom/edifact/segments/imd.rb +69 -0
- data/lib/eancom/edifact/segments/inv.rb +43 -0
- data/lib/eancom/edifact/segments/lin.rb +47 -0
- data/lib/eancom/edifact/segments/loc.rb +46 -0
- data/lib/eancom/edifact/segments/mea.rb +54 -0
- data/lib/eancom/edifact/segments/moa.rb +45 -0
- data/lib/eancom/edifact/segments/nad.rb +112 -0
- data/lib/eancom/edifact/segments/pac.rb +56 -0
- data/lib/eancom/edifact/segments/pat.rb +37 -0
- data/lib/eancom/edifact/segments/pcd.rb +33 -0
- data/lib/eancom/edifact/segments/pci.rb +40 -0
- data/lib/eancom/edifact/segments/pgi.rb +45 -0
- data/lib/eancom/edifact/segments/pia.rb +108 -0
- data/lib/eancom/edifact/segments/pri.rb +53 -0
- data/lib/eancom/edifact/segments/qty.rb +44 -0
- data/lib/eancom/edifact/segments/rff.rb +47 -0
- data/lib/eancom/edifact/segments/rte.rb +33 -0
- data/lib/eancom/edifact/segments/tax.rb +78 -0
- data/lib/eancom/edifact/segments/tdt.rb +57 -0
- 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 +52 -0
- data/lib/eancom/edifact/segments/unb.rb +68 -0
- data/lib/eancom/edifact/segments/unh.rb +50 -0
- data/lib/eancom/edifact/segments/uns.rb +32 -0
- data/lib/eancom/edifact/segments/unt.rb +28 -0
- data/lib/eancom/edifact/segments/unz.rb +28 -0
- data/lib/eancom/edifact/structure.rb +90 -0
- data/lib/eancom/factory.rb +9 -8
- data/lib/eancom/parser.rb +7 -0
- data/lib/eancom/parser/document.rb +60 -0
- data/lib/eancom/parser/segment.rb +71 -0
- data/lib/eancom/version.rb +1 -1
- data/pricat.json +1 -0
- metadata +141 -9
- data/lib/eancom/edifact/element.rb +0 -16
- data/lib/eancom/edifact/envelope.rb +0 -24
@@ -0,0 +1,45 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class MOA < Segment
|
4
|
+
TAG = 'MOA'.freeze
|
5
|
+
TYPE = :footer.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
monetary_amount_type_code_qualifier:,
|
12
|
+
monetary_amount: nil,
|
13
|
+
currency_identification_code: nil,
|
14
|
+
currency_type_code_qualifier: nil
|
15
|
+
)
|
16
|
+
@tag = tag
|
17
|
+
|
18
|
+
@monetary_amount_type_code_qualifier = monetary_amount_type_code_qualifier
|
19
|
+
@monetary_amount= monetary_amount
|
20
|
+
@currency_identification_code = currency_identification_code
|
21
|
+
@currency_type_code_qualifier = currency_type_code_qualifier
|
22
|
+
|
23
|
+
super(tag: tag || TAG)
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_json_hash
|
27
|
+
hash = {}
|
28
|
+
hash.merge!(monetary_amount_type_code_qualifier: find_identifier(:monetary_amount_type_code_qualifier)) if @monetary_amount_type_code_qualifier
|
29
|
+
hash.merge!(monetary_amount: @monetary_amount) if @monetary_amount
|
30
|
+
hash.merge!(currency_identification_code: @currency_identification_code) if @currency_identification_code
|
31
|
+
hash.merge!(currency_type_code_qualifier: find_identifier(:currency_type_code_qualifier)) if @currency_type_code_qualifier
|
32
|
+
hash
|
33
|
+
end
|
34
|
+
|
35
|
+
def group_name
|
36
|
+
'monetary_amounts'
|
37
|
+
end
|
38
|
+
|
39
|
+
def segment_type
|
40
|
+
TYPE
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class NAD < Segment
|
4
|
+
TAG = 'NAD'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
def initialize(
|
8
|
+
tag: nil,
|
9
|
+
party_function_code_qualifier:,
|
10
|
+
party_identifier:,
|
11
|
+
code_list_identification_code_1: '',
|
12
|
+
code_list_responsible_agency_code_1: nil,
|
13
|
+
name_and_address_description_1: nil,
|
14
|
+
name_and_address_description_2: nil,
|
15
|
+
name_and_address_description_3: nil,
|
16
|
+
name_and_address_description_4: nil,
|
17
|
+
name_and_address_description_5: nil,
|
18
|
+
party_name_1: nil,
|
19
|
+
party_name_2: nil,
|
20
|
+
party_name_3: nil,
|
21
|
+
party_name_4: nil,
|
22
|
+
party_name_5: nil,
|
23
|
+
street_and_number_1: nil,
|
24
|
+
street_and_number_2: nil,
|
25
|
+
street_and_number_3: nil,
|
26
|
+
street_and_number_4: nil,
|
27
|
+
street_and_number_5: nil,
|
28
|
+
city_name: nil,
|
29
|
+
country_sub_entity_name_code: nil,
|
30
|
+
code_list_identification_code_2: nil,
|
31
|
+
code_list_responsible_agency_code_2: nil,
|
32
|
+
country_sub_entry_name: nil,
|
33
|
+
postal_identification_code: nil,
|
34
|
+
country_name_code: nil
|
35
|
+
)
|
36
|
+
@tag = tag
|
37
|
+
@party_function_code_qualifier = party_function_code_qualifier
|
38
|
+
@party_identifier = party_identifier
|
39
|
+
@code_list_identification_code_1 = code_list_identification_code_1
|
40
|
+
@code_list_responsible_agency_code_1 = code_list_responsible_agency_code_1
|
41
|
+
@name_and_address_description_1 = name_and_address_description_1
|
42
|
+
@name_and_address_description_2 = name_and_address_description_2
|
43
|
+
@name_and_address_description_3 = name_and_address_description_3
|
44
|
+
@name_and_address_description_4 = name_and_address_description_4
|
45
|
+
@name_and_address_description_5 = name_and_address_description_5
|
46
|
+
@party_name_1 = party_name_1
|
47
|
+
@party_name_2 = party_name_2
|
48
|
+
@party_name_3 = party_name_3
|
49
|
+
@party_name_4 = party_name_4
|
50
|
+
@party_name_5 = party_name_5
|
51
|
+
@street_and_number_1 = street_and_number_1
|
52
|
+
@street_and_number_2 = street_and_number_2
|
53
|
+
@street_and_number_3 = street_and_number_3
|
54
|
+
@street_and_number_4 = street_and_number_4
|
55
|
+
@street_and_number_5 = street_and_number_5
|
56
|
+
@city_name = city_name
|
57
|
+
@country_sub_entity_name_code = country_sub_entity_name_code
|
58
|
+
@code_list_responsible_agency_code_2 = code_list_identification_code_2
|
59
|
+
@code_list_responsible_agency_code_2 = code_list_responsible_agency_code_2
|
60
|
+
@country_sub_entry_name = country_sub_entry_name
|
61
|
+
@postal_identification_code = postal_identification_code
|
62
|
+
@country_name_code = country_name_code
|
63
|
+
super(tag: tag || TAG)
|
64
|
+
end
|
65
|
+
|
66
|
+
def to_json_hash
|
67
|
+
hash = { identifier => {} }
|
68
|
+
hash[identifier].merge!({ party_identifier: @party_identifier }) if @party_identifier
|
69
|
+
hash[identifier].merge!({ name_and_address_description_1: @name_and_address_description_1 }) if @name_and_address_description_1
|
70
|
+
hash[identifier].merge!({ name_and_address_description_2: @name_and_address_description_2 }) if @name_and_address_description_2
|
71
|
+
hash[identifier].merge!({ name_and_address_description_3: @name_and_address_description_3 }) if @name_and_address_description_3
|
72
|
+
hash[identifier].merge!({ name_and_address_description_4: @name_and_address_description_4 }) if @name_and_address_description_4
|
73
|
+
hash[identifier].merge!({ name_and_address_description_5: @name_and_address_description_5 }) if @name_and_address_description_5
|
74
|
+
hash[identifier].merge!({ party_name_1: @party_name_1 }) if @party_name_1
|
75
|
+
hash[identifier].merge!({ party_name_2: @party_name_2 }) if @party_name_2
|
76
|
+
hash[identifier].merge!({ party_name_3: @party_name_3 }) if @party_name_3
|
77
|
+
hash[identifier].merge!({ party_name_4: @party_name_4 }) if @party_name_4
|
78
|
+
hash[identifier].merge!({ party_name_5: @party_name_5 }) if @party_name_5
|
79
|
+
hash[identifier].merge!({ street_and_number_1: @street_and_number_1 }) if @street_and_number_1
|
80
|
+
hash[identifier].merge!({ street_and_number_2: @street_and_number_2 }) if @street_and_number_2
|
81
|
+
hash[identifier].merge!({ street_and_number_3: @street_and_number_3 }) if @street_and_number_3
|
82
|
+
hash[identifier].merge!({ street_and_number_4: @street_and_number_4 }) if @street_and_number_4
|
83
|
+
hash[identifier].merge!({ street_and_number_5: @street_and_number_5 }) if @street_and_number_5
|
84
|
+
hash[identifier].merge!({ city_name: @city_name }) if @city_name
|
85
|
+
hash[identifier].merge!({ country_sub_entity_name_code: @country_sub_entity_name_code }) if @country_sub_entity_name_code
|
86
|
+
hash[identifier].merge!({ country_sub_entry_name: @country_sub_entry_name }) if @country_sub_entry_name
|
87
|
+
hash[identifier].merge!({ postal_identification_code: @postal_identification_code }) if @postal_identification_code
|
88
|
+
hash[identifier].merge!({ country_name_code: @country_name_code }) if @country_name_code
|
89
|
+
|
90
|
+
hash.merge!({ identifier: @identifier }) if @identifier
|
91
|
+
hash = {} if hash[identifier].empty?
|
92
|
+
hash
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
def segment_type
|
97
|
+
TYPE
|
98
|
+
end
|
99
|
+
|
100
|
+
def group_name
|
101
|
+
'nads'
|
102
|
+
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def identifier
|
107
|
+
@identifier ||= structure.find(:party_function_code_qualifier).dictionary[@party_function_code_qualifier][:identifier]
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class PAC < Segment
|
4
|
+
TAG = 'PAC'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
def initialize(
|
8
|
+
tag: nil,
|
9
|
+
package_quantity: nil,
|
10
|
+
packaging_level_code: nil,
|
11
|
+
packaging_related_description_code: nil,
|
12
|
+
packaging_terms_and_conditions: nil,
|
13
|
+
package_type_description_code: nil,
|
14
|
+
code_list_identification_code: nil,
|
15
|
+
code_list_responsible_agency_code: nil,
|
16
|
+
type_of_packages: nil,
|
17
|
+
description_format_code: nil,
|
18
|
+
type_of_packages_1: nil,
|
19
|
+
item_type_identification_code_1: nil,
|
20
|
+
type_of_packages_2: nil,
|
21
|
+
item_type_identification_code_2: nil,
|
22
|
+
returnable_package_freight_payment_responsibility_code: nil,
|
23
|
+
returnable_package_load_contents_code: nil
|
24
|
+
)
|
25
|
+
@tag = tag
|
26
|
+
@package_quantity = package_quantity
|
27
|
+
@packaging_level_code = packaging_level_code
|
28
|
+
@packaging_related_description_code = packaging_related_description_code
|
29
|
+
@packaging_terms_and_conditions = packaging_terms_and_conditions
|
30
|
+
@package_type_description_code = package_type_description_code
|
31
|
+
@code_list_identification_code = code_list_identification_code
|
32
|
+
@code_list_responsible_agency_code = code_list_responsible_agency_code
|
33
|
+
@type_of_packages = type_of_packages
|
34
|
+
@description_format_code = description_format_code
|
35
|
+
@type_of_packages_1 = type_of_packages_1
|
36
|
+
@item_type_identification_code_1 = item_type_identification_code_1
|
37
|
+
@type_of_packages_2 = type_of_packages_2
|
38
|
+
@item_type_identification_code_2 = item_type_identification_code_2
|
39
|
+
@returnable_package_freight_payment_responsibility_code = returnable_package_freight_payment_responsibility_code
|
40
|
+
@returnable_package_load_contents_code = returnable_package_load_contents_code
|
41
|
+
|
42
|
+
super(tag: tag || TAG)
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_json_hash
|
46
|
+
hash = {}
|
47
|
+
hash.merge!(package_quantity: @package_quantity) if @package_quantity
|
48
|
+
hash
|
49
|
+
end
|
50
|
+
|
51
|
+
def segment_type
|
52
|
+
TYPE
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class PAT < Segment
|
4
|
+
TAG = 'PAT'.freeze
|
5
|
+
TYPE = :header
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
payment_terms_type_code_qualifier: nil,
|
12
|
+
payment_terms_type_description_identifier: nil,
|
13
|
+
time_reference_code: nil
|
14
|
+
)
|
15
|
+
|
16
|
+
@tag = tag,
|
17
|
+
@payment_terms_type_code_qualifier = payment_terms_type_code_qualifier,
|
18
|
+
@payment_terms_type_description_identifier = payment_terms_type_description_identifier,
|
19
|
+
@time_reference_code = time_reference_code
|
20
|
+
|
21
|
+
super(tag: tag || TAG)
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_json_hash
|
25
|
+
hash = {}
|
26
|
+
hash.merge!(payment_terms_type_code_qualifier: find_identifier(:payment_terms_type_code_qualifier)) if @payment_terms_type_code_qualifier
|
27
|
+
hash.merge!(payment_terms_type_description_identifier: @payment_terms_type_description_identifier) if @payment_terms_type_description_identifier
|
28
|
+
hash.merge!(time_reference_code: @time_reference_code) if @time_reference_code
|
29
|
+
hash
|
30
|
+
end
|
31
|
+
|
32
|
+
def segment_type
|
33
|
+
TYPE
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class PCD < Segment
|
4
|
+
TAG = 'PCD'.freeze
|
5
|
+
TYPE = :header
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
percentage:,
|
12
|
+
percentage_type_code_qualifier: nil
|
13
|
+
)
|
14
|
+
@tag = tag
|
15
|
+
@percentage_type_code_qualifier = percentage_type_code_qualifier
|
16
|
+
@percentage = percentage
|
17
|
+
|
18
|
+
super(tag: tag || TAG)
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_json_hash
|
22
|
+
hash = {}
|
23
|
+
hash.merge!(percentage_type_code_qualifier: find_identifier(:percentage_type_code_qualifier)) if @percentage_type_code_qualifier
|
24
|
+
hash.merge!(percentage: @percentage) if @percentage
|
25
|
+
hash
|
26
|
+
end
|
27
|
+
|
28
|
+
def segment_type
|
29
|
+
TYPE
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class PCI < Segment
|
4
|
+
TAG = 'PCI'.freeze
|
5
|
+
TYPE = :body
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
marking_instructions_code:,
|
12
|
+
marks_and_labels_code: nil,
|
13
|
+
container_or_package_contents_indicator_mode: nil
|
14
|
+
)
|
15
|
+
|
16
|
+
@tag = tag
|
17
|
+
@marking_instructions_code = marking_instructions_code
|
18
|
+
@marks_and_labels_code = marks_and_labels_code
|
19
|
+
@container_or_package_contents_indicator_mode = container_or_package_contents_indicator_mode
|
20
|
+
super(tag: tag || TAG)
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_json_hash
|
24
|
+
hash = {}
|
25
|
+
hash.merge!(marking_instructions_code: find_identifier(:marking_instructions_code)) if @marking_instructions_code
|
26
|
+
hash.merge!(marks_and_labels_code: @marks_and_labels_code) if @marks_and_labels_code
|
27
|
+
hash.merge!(container_or_package_contents_indicator_mode: @container_or_package_contents_indicator_mode) if @container_or_package_contents_indicator_mode
|
28
|
+
hash
|
29
|
+
end
|
30
|
+
|
31
|
+
def group_name
|
32
|
+
'package_identification'
|
33
|
+
end
|
34
|
+
|
35
|
+
def segment_type
|
36
|
+
TYPE
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class PGI < Segment
|
4
|
+
TAG = 'PGI'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
product_group_type_code:,
|
12
|
+
product_group_name_code: nil,
|
13
|
+
code_list_identification_code: nil,
|
14
|
+
code_list_responsibility_agency_code: nil,
|
15
|
+
product_group_name: nil
|
16
|
+
)
|
17
|
+
@tag = tag
|
18
|
+
@product_group_type_code = product_group_type_code
|
19
|
+
@product_group_name_code = product_group_name_code
|
20
|
+
@code_list_identification_code = code_list_identification_code
|
21
|
+
@code_list_responsibility_agency_code = code_list_responsibility_agency_code
|
22
|
+
@product_group_name = product_group_name_code
|
23
|
+
|
24
|
+
super(tag: tag || TAG)
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_json_hash
|
28
|
+
hash = {
|
29
|
+
'product_group_identifier': identifier
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def segment_type
|
34
|
+
TYPE
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def identifier
|
40
|
+
@identifier ||= structure.find(:product_group_type_code).dictionary[@product_group_type_code][:identifier]
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class PIA < Segment
|
4
|
+
TAG = 'PIA'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
def initialize(
|
8
|
+
tag: nil,
|
9
|
+
product_identifier_code_qualifier:,
|
10
|
+
item_identifier_1:,
|
11
|
+
item_type_identification_code_1:,
|
12
|
+
code_list_identification_code_1: nil,
|
13
|
+
code_list_responsible_agency_code_1: nil,
|
14
|
+
item_identifier_2: nil,
|
15
|
+
item_type_identification_code_2: nil,
|
16
|
+
code_list_identification_code_2: nil,
|
17
|
+
code_list_responsible_agency_code_2: nil,
|
18
|
+
item_identifier_3: nil,
|
19
|
+
item_type_identification_code_3: nil,
|
20
|
+
code_list_identification_code_3: nil,
|
21
|
+
code_list_responsible_agency_code_3: nil,
|
22
|
+
item_identifier_4: nil,
|
23
|
+
item_type_identification_code_4: nil,
|
24
|
+
code_list_identification_code_4: nil,
|
25
|
+
code_list_responsible_agency_code_4: nil,
|
26
|
+
item_identifier_5: nil,
|
27
|
+
item_type_identification_code_5: nil,
|
28
|
+
code_list_identification_code_5: nil,
|
29
|
+
code_list_responsible_agency_code_5: nil
|
30
|
+
)
|
31
|
+
@tag = tag
|
32
|
+
@product_identifier_code_qualifier = product_identifier_code_qualifier
|
33
|
+
|
34
|
+
@item_identifier_1 = item_identifier_1
|
35
|
+
@item_type_identification_code_1 = item_type_identification_code_1
|
36
|
+
@code_list_identification_code_1 = code_list_identification_code_1
|
37
|
+
@code_list_responsible_agency_code_1 = code_list_responsible_agency_code_1
|
38
|
+
|
39
|
+
@item_identifier_2 = item_identifier_2
|
40
|
+
@item_type_identification_code_2 = item_type_identification_code_2
|
41
|
+
@code_list_identification_code_2 = code_list_identification_code_2
|
42
|
+
@code_list_responsible_agency_code_2 = code_list_responsible_agency_code_2
|
43
|
+
|
44
|
+
@item_identifier_3 = item_identifier_3
|
45
|
+
@item_type_identification_code_3 = item_type_identification_code_3
|
46
|
+
@code_list_identification_code_3 = code_list_identification_code_3
|
47
|
+
@code_list_responsible_agency_code_3 = code_list_responsible_agency_code_3
|
48
|
+
|
49
|
+
@item_identifier_4 = item_identifier_4
|
50
|
+
@item_type_identification_code_4 = item_type_identification_code_4
|
51
|
+
@code_list_identification_code_4 = code_list_identification_code_4
|
52
|
+
@code_list_responsible_agency_code_4 = code_list_responsible_agency_code_4
|
53
|
+
|
54
|
+
@item_identifier_5 = item_identifier_5
|
55
|
+
@item_type_identification_code_5 = item_type_identification_code_5
|
56
|
+
@code_list_identification_code_5 = code_list_identification_code_5
|
57
|
+
@code_list_responsible_agency_code_5 = code_list_responsible_agency_code_5
|
58
|
+
|
59
|
+
super(tag: tag || TAG)
|
60
|
+
end
|
61
|
+
|
62
|
+
def to_json_hash
|
63
|
+
hash = {}
|
64
|
+
hash.merge!(product_identifier_code_qualifier: find_identifier(:product_identifier_code_qualifier)) if @product_identifier_code_qualifier
|
65
|
+
hash.merge!(item_identifier_1: @item_identifier_1) if @item_identifier_1
|
66
|
+
hash.merge!(item_type_identification_code_1: find_identifier(:item_type_identification_code_1)) if @item_type_identification_code_1
|
67
|
+
hash.merge!(code_list_identification_code_1: @code_list_identification_code_1) if @code_list_identification_code_1
|
68
|
+
hash.merge!(code_list_responsible_agency_code_1: find_identifier(:code_list_responsible_agency_code_1)) if @code_list_responsible_agency_code_1
|
69
|
+
hash.merge!(item_identifier_2: @item_identifier_2) if @item_identifier_2
|
70
|
+
hash.merge!(item_type_identification_code_2: find_identifier(:item_type_identification_code_2)) if @item_type_identification_code_2
|
71
|
+
hash.merge!(code_list_identification_code_2: @code_list_identification_code_2) if @code_list_identification_code_2
|
72
|
+
hash.merge!(code_list_responsible_agency_code_2: find_identifier(:code_list_responsible_agency_code_2)) if @code_list_responsible_agency_code_2
|
73
|
+
hash.merge!(item_identifier_3: @item_identifier_3) if @item_identifier_3
|
74
|
+
hash.merge!(item_type_identification_code_3: find_identifier(:item_type_identification_code_3)) if @item_type_identification_code_3
|
75
|
+
hash.merge!(code_list_identification_code_3: @code_list_identification_code_3) if @code_list_identification_code_3
|
76
|
+
hash.merge!(code_list_responsible_agency_code_3: find_identifier(:code_list_responsible_agency_code_3)) if @code_list_responsible_agency_code_3
|
77
|
+
hash.merge!(item_identifier_4: @item_identifier_4) if @item_identifier_4
|
78
|
+
hash.merge!(item_type_identification_code_4: find_identifier(:item_type_identification_code_4)) if @item_type_identification_code_4
|
79
|
+
hash.merge!(code_list_identification_code_4: @code_list_identification_code_4) if @code_list_identification_code_4
|
80
|
+
hash.merge!(code_list_responsible_agency_code_4: find_identifier(:code_list_responsible_agency_code_4)) if @code_list_responsible_agency_code_4
|
81
|
+
hash.merge!(item_identifier_5: @item_identifier_5) if @item_identifier_5
|
82
|
+
hash.merge!(item_type_identification_code_5: find_identifier(:item_type_identification_code_5)) if @item_type_identification_code_5
|
83
|
+
hash.merge!(code_list_identification_code_5: @code_list_identification_code_5) if @code_list_identification_code_5
|
84
|
+
hash.merge!(code_list_responsible_agency_code_5: find_identifier(:code_list_responsible_agency_code_5)) if @code_list_responsible_agency_code_5
|
85
|
+
|
86
|
+
outer_hash = {}
|
87
|
+
outer_hash[find_identifier(:product_identifier_code_qualifier)] = hash
|
88
|
+
outer_hash
|
89
|
+
end
|
90
|
+
|
91
|
+
def group_name
|
92
|
+
'additional_product_id'
|
93
|
+
end
|
94
|
+
|
95
|
+
def segment_type
|
96
|
+
TYPE
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
100
|
+
|
101
|
+
def identifier
|
102
|
+
@identifier ||= structure.find(:product_identifier_code_qualifier).dictionary[@product_identifier_code_qualifier][:identifier]
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|