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,46 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class BGM < Segment
|
4
|
+
TAG = 'BGM'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
document_name_code:,
|
12
|
+
code_list_responsible_agency_code: nil,
|
13
|
+
code_list_identification_code: nil,
|
14
|
+
document_name: nil,
|
15
|
+
document_identifier: nil,
|
16
|
+
message_function_code: nil
|
17
|
+
)
|
18
|
+
@tag = tag
|
19
|
+
@document_name_code = document_name_code
|
20
|
+
@code_list_responsible_agency_code = code_list_responsible_agency_code
|
21
|
+
@code_list_identification_code = code_list_identification_code
|
22
|
+
@document_name = document_name
|
23
|
+
@document_identifier = document_identifier
|
24
|
+
@message_function_code = message_function_code
|
25
|
+
|
26
|
+
super(tag: tag || TAG)
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_json_hash
|
30
|
+
{
|
31
|
+
document_name_code: @document_name_code,
|
32
|
+
document_identifier: @document_identifier,
|
33
|
+
message_function_code: @message_function_code
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def starts_message?
|
38
|
+
true
|
39
|
+
end
|
40
|
+
|
41
|
+
def segment_type
|
42
|
+
TYPE
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class CAV < Segment
|
4
|
+
TAG = 'CAV'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
characterisitc_value_description_code: nil,
|
12
|
+
code_list_identification_code: nil,
|
13
|
+
code_list_respobsibility_agency_code: nil,
|
14
|
+
characterisitc_value_description_1: nil,
|
15
|
+
characterisitc_value_description_2: nil
|
16
|
+
)
|
17
|
+
@tag = tag
|
18
|
+
@characterisitc_value_description_code = characterisitc_value_description_code
|
19
|
+
@code_list_identification_code = code_list_identification_code
|
20
|
+
@code_list_respobsibility_agency_code = code_list_respobsibility_agency_code
|
21
|
+
@characterisitc_value_description_1 = characterisitc_value_description_1
|
22
|
+
@characterisitc_value_description_2 = characterisitc_value_description_2
|
23
|
+
|
24
|
+
super(tag: tag || TAG)
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_json_hash
|
28
|
+
hash = {}
|
29
|
+
hash.merge!(characterisitc_value_description_code: find_identifier(:characterisitc_value_description_code)) if @characterisitc_value_description_code
|
30
|
+
hash.merge!(code_list_identification_code: @code_list_identification_code) if @code_list_identification_code
|
31
|
+
hash.merge!(code_list_respobsibility_agency_code: find_identifier(:code_list_respobsibility_agency_code)) if @code_list_respobsibility_agency_code
|
32
|
+
hash.merge!(characterisitc_value_description_1: find_identifier(:characterisitc_value_description_1)) if @characterisitc_value_description_1
|
33
|
+
hash.merge!(characterisitc_value_description_2: @characterisitc_value_description_2) if @characterisitc_value_description_2
|
34
|
+
hash
|
35
|
+
end
|
36
|
+
|
37
|
+
def group_name
|
38
|
+
'characterisitcs'
|
39
|
+
end
|
40
|
+
|
41
|
+
def segment_type
|
42
|
+
TYPE
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class CCI < Segment
|
4
|
+
TAG = 'CCI'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
class_type_code: nil,
|
12
|
+
measurment_attribute_code: nil,
|
13
|
+
characteristic_description_code:,
|
14
|
+
code_list_identification_code: nil,
|
15
|
+
code_list_respobsibility_agency_code: nil,
|
16
|
+
characterisitc_description_1: nil,
|
17
|
+
characterisitc_description_2: nil
|
18
|
+
)
|
19
|
+
@tag = tag
|
20
|
+
@class_type_code = class_type_code
|
21
|
+
@measurment_attribute_code = measurment_attribute_code
|
22
|
+
@characteristic_description_code = characteristic_description_code
|
23
|
+
@code_list_identification_code = code_list_identification_code
|
24
|
+
@code_list_respobsibility_agency_code = code_list_respobsibility_agency_code
|
25
|
+
@characterisitc_description_1 = characterisitc_description_1
|
26
|
+
@characterisitc_description_2 = characterisitc_description_2
|
27
|
+
|
28
|
+
super(tag: tag || TAG)
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_json_hash
|
32
|
+
hash = {}
|
33
|
+
hash.merge!(class_type_code: find_identifier(:class_type_code)) if @class_type_code
|
34
|
+
hash.merge!(measurment_attribute_code: @measurment_attribute_code) if @measurment_attribute_code
|
35
|
+
hash.merge!(characteristic_description_code: find_identifier(:characteristic_description_code)) if @characteristic_description_code
|
36
|
+
hash.merge!(code_list_identification_code: @code_list_identification_code) if @code_list_identification_code
|
37
|
+
hash.merge!(code_list_respobsibility_agency_code: find_identifier(:code_list_respobsibility_agency_code)) if @code_list_respobsibility_agency_code
|
38
|
+
hash.merge!(characterisitc_description_1: @characterisitc_description_1) if @characterisitc_description_1
|
39
|
+
hash.merge!(characterisitc_description_2: @characterisitc_description_2) if @characterisitc_description_2
|
40
|
+
hash
|
41
|
+
end
|
42
|
+
|
43
|
+
def group_name
|
44
|
+
'characterisitcs'
|
45
|
+
end
|
46
|
+
|
47
|
+
def segment_type
|
48
|
+
TYPE
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class CDI < Segment
|
4
|
+
TAG = 'CDI'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
physical_or_logical_state_type_code_qualifier: nil
|
12
|
+
)
|
13
|
+
|
14
|
+
@tag = tag
|
15
|
+
@physical_or_logical_state_type_code_qualifier = physical_or_logical_state_type_code_qualifier
|
16
|
+
super(tag: @tag || TAG)
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_json_hash
|
20
|
+
hash = {}
|
21
|
+
hash.merge!(physical_or_logical_state_type_code_qualifier: find_identifier(:physical_or_logical_state_type_code_qualifier)) if @physical_or_logical_state_type_code_qualifier
|
22
|
+
hash
|
23
|
+
end
|
24
|
+
|
25
|
+
def segment_type
|
26
|
+
TYPE
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class CNT < Segment
|
4
|
+
TAG = 'CNT'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
control_total_type_code_quantifier:,
|
12
|
+
control_total_value:,
|
13
|
+
measurment_unit_code: nil
|
14
|
+
)
|
15
|
+
@tag = tag
|
16
|
+
@control_total_type_code_quantifier = control_total_type_code_quantifier
|
17
|
+
@control_total_value = control_total_value
|
18
|
+
@measurment_unit_code = measurment_unit_code
|
19
|
+
|
20
|
+
super(tag: tag || TAG)
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_json_hash
|
24
|
+
hash = {}
|
25
|
+
hash.merge!(control_total_type_code_quantifier: find_identifier(:control_total_type_code_quantifier)) if @control_total_type_code_quantifier
|
26
|
+
hash.merge!(control_total_value: @control_total_value) if @control_total_value
|
27
|
+
hash
|
28
|
+
end
|
29
|
+
|
30
|
+
def group_name
|
31
|
+
'counts'
|
32
|
+
end
|
33
|
+
|
34
|
+
def segment_type
|
35
|
+
TYPE
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class CPS < Segment
|
4
|
+
TAG = 'CPS'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
def initialize(
|
8
|
+
tag: nil,
|
9
|
+
hierarchical_structure_level_identifier:,
|
10
|
+
hierarchical_structure_parent_identifier: nil,
|
11
|
+
packaging_level_code: nil
|
12
|
+
)
|
13
|
+
@tag = tag
|
14
|
+
@hierarchical_structure_level_identifier = hierarchical_structure_level_identifier
|
15
|
+
@hierarchical_structure_parent_identifier = hierarchical_structure_parent_identifier
|
16
|
+
@packaging_level_code = packaging_level_code
|
17
|
+
|
18
|
+
super(tag: tag || TAG)
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_json_hash
|
22
|
+
hash = {}
|
23
|
+
hash.merge!(hierarchical_structure_level_identifier: @hierarchical_structure_level_identifier) if @hierarchical_structure_level_identifier
|
24
|
+
hash.merge!(hierarchical_structure_parent_identifier: @hierarchical_structure_parent_identifier) if @hierarchical_structure_parent_identifier
|
25
|
+
hash
|
26
|
+
end
|
27
|
+
|
28
|
+
def segment_type
|
29
|
+
TYPE
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class CTA < Segment
|
4
|
+
TAG = 'CTA'.freeze
|
5
|
+
TYPE = :body
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
contact_function_code:
|
12
|
+
)
|
13
|
+
|
14
|
+
@tag = tag
|
15
|
+
@contact_function_code = contact_function_code
|
16
|
+
super(tag: tag || TAG)
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_json_hash
|
20
|
+
hash = {}
|
21
|
+
hash.merge!(contact_function_code: find_identifier(:contact_function_code)) if @contact_function_code
|
22
|
+
hash
|
23
|
+
end
|
24
|
+
|
25
|
+
def segment_type
|
26
|
+
TYPE
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class CUX < Segment
|
4
|
+
TAG = 'CUX'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
currency_usage_code_qualifier_1:,
|
12
|
+
currency_identification_code_1:,
|
13
|
+
currency_type_code_qualifier_1: nil,
|
14
|
+
currency_rate_value_1: nil,
|
15
|
+
currency_usage_code_qualifier_2: nil,
|
16
|
+
currency_identification_code_2: nil,
|
17
|
+
currency_type_code_qualifier_2: nil,
|
18
|
+
currency_rate_value_2: nil,
|
19
|
+
currency_exchange_rate: nil,
|
20
|
+
exchange_rate_currency_market_identifier: nil
|
21
|
+
)
|
22
|
+
@tag = tag
|
23
|
+
@currency_usage_code_qualifier_1 = currency_usage_code_qualifier_1
|
24
|
+
@currency_identification_code_1 = currency_identification_code_1
|
25
|
+
@currency_type_code_qualifier_1 = currency_type_code_qualifier_1
|
26
|
+
@currency_rate_value_1 = currency_rate_value_1
|
27
|
+
@currency_usage_code_qualifier_2 = currency_usage_code_qualifier_2
|
28
|
+
@currency_identification_code_2 = currency_identification_code_2
|
29
|
+
@currency_type_code_qualifier_2 = currency_type_code_qualifier_2
|
30
|
+
@currency_rate_value_2 = currency_rate_value_2
|
31
|
+
@currency_exchange_rate = currency_exchange_rate
|
32
|
+
@exchange_rate_currency_market_identifier = exchange_rate_currency_market_identifier
|
33
|
+
|
34
|
+
super(tag: tag || TAG)
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_json_hash
|
38
|
+
hash = {}
|
39
|
+
hash.merge!(currency_usage_code_qualifier_1: find_identifier(:currency_usage_code_qualifier_1)) if @currency_usage_code_qualifier_1
|
40
|
+
hash.merge!(currency_identification_code_1: @currency_identification_code_1) if @currency_identification_code_1
|
41
|
+
hash.merge!(currency_type_code_qualifier_1: find_identifier(:currency_type_code_qualifier_1)) if @currency_type_code_qualifier_1
|
42
|
+
hash.merge!(currency_rate_value_1: @currency_rate_value_1) if @currency_rate_value_1
|
43
|
+
hash.merge!(currency_usage_code_qualifier_2: find_identifier(:currency_usage_code_qualifier_2)) if @currency_usage_code_qualifier_2
|
44
|
+
hash.merge!(currency_identification_code_2: @currency_identification_code_2) if @currency_identification_code_2
|
45
|
+
hash.merge!(currency_type_code_qualifier_2: find_identifier(:currency_type_code_qualifier_2)) if @currency_type_code_qualifier_2
|
46
|
+
hash.merge!(currency_rate_value_2: @currency_rate_value_2) if @currency_rate_value_2
|
47
|
+
{ currency: hash }
|
48
|
+
end
|
49
|
+
|
50
|
+
def item_group_name
|
51
|
+
'prices'
|
52
|
+
end
|
53
|
+
|
54
|
+
def segment_type
|
55
|
+
TYPE
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class DGS < Segment
|
4
|
+
TAG = 'DGS'.freeze
|
5
|
+
TYPE = :body
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
hazard_identification_code:
|
12
|
+
)
|
13
|
+
|
14
|
+
@tag = tag
|
15
|
+
@hazard_identification_code = hazard_identification_code
|
16
|
+
|
17
|
+
super(tag: tag || TAG)
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_json_hash
|
21
|
+
hash = {}
|
22
|
+
hash.merge!(hazard_identification_code: @hazard_identification_code)
|
23
|
+
hash
|
24
|
+
end
|
25
|
+
|
26
|
+
def segment_type
|
27
|
+
TYPE
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class DOC < Segment
|
4
|
+
TAG = 'DOC'.freeze
|
5
|
+
TYPE = :header
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
document_name_code:
|
12
|
+
)
|
13
|
+
@tag = tag
|
14
|
+
@document_name_code = document_name_code
|
15
|
+
|
16
|
+
super(tag: tag || TAG)
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_json_hash
|
20
|
+
{
|
21
|
+
document_name_code: @document_name_code
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def segment_type
|
26
|
+
TYPE
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class DTM < Segment
|
4
|
+
TAG = 'DTM'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_accessor :type, :date_time, :format
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
type:,
|
12
|
+
date_time:,
|
13
|
+
format:
|
14
|
+
)
|
15
|
+
@tag = tag
|
16
|
+
@type = type
|
17
|
+
@date_time = date_time
|
18
|
+
@format = format
|
19
|
+
|
20
|
+
super(tag: @tag || TAG)
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_json_hash
|
24
|
+
hash = { identifier => {} }
|
25
|
+
hash[identifier].merge!({ date_time: @date_time }) if @date_time
|
26
|
+
|
27
|
+
hash.merge!({ identifier: @identifier }) if @identifier
|
28
|
+
hash = {} if hash[identifier].empty?
|
29
|
+
hash
|
30
|
+
end
|
31
|
+
|
32
|
+
def group_name
|
33
|
+
'date_time_messages'
|
34
|
+
end
|
35
|
+
|
36
|
+
def segment_type
|
37
|
+
TYPE
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def identifier
|
43
|
+
@identifier ||= structure.find(:type).dictionary[@type][:identifier]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|