eancom 1.6.3 → 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 +204 -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 -7
- 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
data/eancom.gemspec
CHANGED
@@ -23,12 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency 'rubocop'
|
32
|
-
spec.add_development_dependency 'simplecov'
|
33
|
-
spec.add_development_dependency 'timecop'
|
26
|
+
spec.add_development_dependency "pry"
|
27
|
+
spec.add_development_dependency "pry-remote"
|
28
|
+
spec.add_development_dependency "pry-nav"
|
29
|
+
spec.add_development_dependency "simplecov"
|
30
|
+
spec.add_development_dependency "timecop"
|
34
31
|
end
|
data/lib/eancom/edifact/body.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module Eancom
|
4
2
|
module Edifact
|
5
3
|
class Body < DocumentElement
|
6
|
-
|
4
|
+
|
5
|
+
attr_accessor :hash, :items, :messages
|
7
6
|
|
8
7
|
def initialize
|
9
8
|
super
|
@@ -12,32 +11,52 @@ module Eancom
|
|
12
11
|
end
|
13
12
|
|
14
13
|
def to_json_hash
|
15
|
-
@
|
14
|
+
@segments.each do |segment|
|
15
|
+
start_message(segment) if segment.starts_message?
|
16
|
+
start_item(segment) if segment.starts_item?
|
17
|
+
if @item
|
18
|
+
@item << segment
|
19
|
+
else
|
20
|
+
@message << segment
|
21
|
+
end
|
22
|
+
end
|
23
|
+
@message.add_item(@item.to_json_hash)
|
24
|
+
@messages << @message.to_json_hash
|
25
|
+
hash.merge!({ messages: messages })
|
26
|
+
{ body: hash }
|
16
27
|
end
|
17
28
|
|
18
|
-
def start_message
|
29
|
+
def start_message(segment)
|
19
30
|
if @message
|
20
31
|
@messages << @message.to_json_hash
|
32
|
+
if @item && !@item.empty?
|
33
|
+
@message.add_item(@item.to_json_hash)
|
34
|
+
end
|
35
|
+
@item = nil
|
21
36
|
end
|
22
|
-
@message = Eancom::Edifact::Message.new
|
37
|
+
@message = Eancom::Edifact::Message.new()
|
23
38
|
end
|
24
39
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
40
|
+
def start_item(segment)
|
41
|
+
if @item && !@item.empty?
|
42
|
+
@message.add_item(@item.to_json_hash)
|
43
|
+
end
|
44
|
+
@item = Eancom::Edifact::Item.new()
|
29
45
|
end
|
30
46
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
47
|
+
private
|
48
|
+
|
49
|
+
def merge(hash, segment)
|
50
|
+
if name = group_name(segment)
|
51
|
+
hash[name] = [] if hash[name].nil?
|
52
|
+
hash[name] << segment.to_json_hash
|
53
|
+
else
|
54
|
+
hash.merge!(segment.to_json_hash)
|
35
55
|
end
|
36
|
-
|
56
|
+
end
|
37
57
|
|
38
|
-
|
39
|
-
|
40
|
-
}
|
58
|
+
def group_name(segment)
|
59
|
+
return segment.group_name
|
41
60
|
end
|
42
61
|
end
|
43
62
|
end
|
@@ -1,25 +1,24 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module Eancom
|
4
2
|
module Edifact
|
5
3
|
class Document
|
4
|
+
|
6
5
|
attr_accessor :header_element, :body_element, :footer_element
|
7
6
|
|
8
7
|
def initialize
|
9
|
-
@header_element = Header.new
|
10
|
-
@body_element = Body.new
|
11
|
-
@footer_element = Footer.new
|
8
|
+
@header_element = Header.new()
|
9
|
+
@body_element = Body.new()
|
10
|
+
@footer_element = Footer.new()
|
12
11
|
end
|
13
12
|
|
14
|
-
def header
|
13
|
+
def header(&block)
|
15
14
|
yield(@header_element)
|
16
15
|
end
|
17
16
|
|
18
|
-
def body
|
17
|
+
def body(&block)
|
19
18
|
yield(@body_element)
|
20
19
|
end
|
21
20
|
|
22
|
-
def footer
|
21
|
+
def footer(&block)
|
23
22
|
yield(@footer_element)
|
24
23
|
end
|
25
24
|
|
@@ -35,6 +34,7 @@ module Eancom
|
|
35
34
|
@footer_element.segment(segment)
|
36
35
|
end
|
37
36
|
|
37
|
+
# Should header and footer segments be added to total_segments?
|
38
38
|
def total_segments
|
39
39
|
total = 0
|
40
40
|
total += @body_element.segments.count
|
@@ -42,14 +42,18 @@ module Eancom
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def to_s(debug: false)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
stream = ''
|
46
|
+
stream << @header_element.to_s(debug: debug)
|
47
|
+
stream << @body_element.to_s(debug: debug)
|
48
|
+
stream << @footer_element.to_s(debug: debug)
|
49
|
+
stream
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_json
|
53
|
+
hash = {}
|
54
|
+
hash.merge! @header_element.to_json_hash
|
55
|
+
hash.merge! @body_element.to_json_hash
|
56
|
+
hash.to_json
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
data/lib/eancom/edifact/item.rb
CHANGED
@@ -1,33 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module Eancom
|
4
2
|
module Edifact
|
5
3
|
class Message
|
6
|
-
attr_accessor :locations, :items, :hash
|
7
4
|
|
8
|
-
|
9
|
-
|
5
|
+
attr_accessor :items, :hash
|
6
|
+
|
7
|
+
def initialize()
|
10
8
|
@items = []
|
11
9
|
@hash = {}
|
12
10
|
end
|
13
11
|
|
14
|
-
def add_location(location)
|
15
|
-
@locations << location
|
16
|
-
end
|
17
|
-
|
18
12
|
def add_item(item)
|
19
13
|
@items << item
|
20
14
|
end
|
21
15
|
|
22
|
-
def <<(segment)
|
23
|
-
|
24
|
-
start_item if segment.starts_item?
|
25
|
-
|
26
|
-
if @location
|
27
|
-
@location << segment
|
28
|
-
elsif @item
|
29
|
-
@item << segment
|
30
|
-
elsif name = group_name(segment)
|
16
|
+
def << (segment)
|
17
|
+
if name = group_name(segment)
|
31
18
|
@hash[name] = [] if @hash[name].nil?
|
32
19
|
@hash[name] << segment.to_json_hash
|
33
20
|
else
|
@@ -36,16 +23,10 @@ module Eancom
|
|
36
23
|
end
|
37
24
|
|
38
25
|
def to_json_hash
|
39
|
-
if @location && !@location.empty?
|
40
|
-
add_location(@location.to_json_hash)
|
41
|
-
end
|
42
|
-
if @item && !@item.empty?
|
43
|
-
add_item(@item.to_json_hash)
|
44
|
-
end
|
45
26
|
message_hash = {}
|
27
|
+
items_hash = { items: @items }
|
46
28
|
message_hash.merge!(@hash)
|
47
|
-
message_hash.merge!(
|
48
|
-
message_hash.merge!({ items: @items }) if !@items.empty?
|
29
|
+
message_hash.merge!(items_hash)
|
49
30
|
message_hash
|
50
31
|
end
|
51
32
|
|
@@ -55,19 +36,6 @@ module Eancom
|
|
55
36
|
segment.group_name
|
56
37
|
end
|
57
38
|
|
58
|
-
def start_location
|
59
|
-
if @location && !@location.empty?
|
60
|
-
add_location(@location.to_json_hash)
|
61
|
-
end
|
62
|
-
@location = Eancom::Edifact::Location.new
|
63
|
-
end
|
64
|
-
|
65
|
-
def start_item
|
66
|
-
if @item && !@item.empty?
|
67
|
-
add_item(@item.to_json_hash)
|
68
|
-
end
|
69
|
-
@item = Eancom::Edifact::Item.new
|
70
|
-
end
|
71
39
|
end
|
72
40
|
end
|
73
41
|
end
|
@@ -11,18 +11,21 @@ module Eancom
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.initialize_by_components(structure, array)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
begin
|
15
|
+
new(**structure.build_hash(array))
|
16
|
+
rescue StandardError => e
|
17
|
+
raise SegmentParserError.new(
|
18
|
+
"'Parser Error in structure #{structure.tag} with array #{array}.\n \
|
19
|
+
'Inside Structure: \n \ '#{structure.to_s}.\n \
|
18
20
|
'Error:\n \
|
19
21
|
'#{e}"
|
22
|
+
)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
def validate_structure
|
23
27
|
attributes.each do |key, value|
|
24
28
|
next if value.nil?
|
25
|
-
|
26
29
|
structure.validate!(key, value)
|
27
30
|
end
|
28
31
|
end
|
@@ -36,10 +39,9 @@ module Eancom
|
|
36
39
|
end
|
37
40
|
|
38
41
|
def to_s
|
39
|
-
string = array.map do |e|
|
42
|
+
string = array.map do |e|
|
40
43
|
e = e.compact
|
41
44
|
next if e.empty?
|
42
|
-
|
43
45
|
[e.join(component_delimiter)]
|
44
46
|
end.join(data_delimiter)
|
45
47
|
clean_end_string(string)
|
@@ -83,10 +85,6 @@ module Eancom
|
|
83
85
|
false
|
84
86
|
end
|
85
87
|
|
86
|
-
def starts_location?
|
87
|
-
false
|
88
|
-
end
|
89
|
-
|
90
88
|
def starts_item?
|
91
89
|
false
|
92
90
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class AJT < Segment
|
4
|
+
TAG = 'AJT'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
adjustment_reason_description:
|
12
|
+
)
|
13
|
+
@tag = tag
|
14
|
+
@adjustment_reason_description = adjustment_reason_description
|
15
|
+
|
16
|
+
super(tag: tag || TAG)
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_json_hash
|
20
|
+
hash = {}
|
21
|
+
if @adjustment_reason_description
|
22
|
+
hash.merge!(adjustment_reason_description: find_identifier(:adjustment_reason_description))
|
23
|
+
end
|
24
|
+
hash
|
25
|
+
end
|
26
|
+
|
27
|
+
def segment_type
|
28
|
+
TYPE
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -2,7 +2,7 @@ module Eancom
|
|
2
2
|
module Edifact
|
3
3
|
class ALI < Segment
|
4
4
|
TAG = 'ALI'.freeze
|
5
|
-
TYPE = :body
|
5
|
+
TYPE = :body
|
6
6
|
|
7
7
|
attr_reader :segment_type
|
8
8
|
|
@@ -38,15 +38,13 @@ module Eancom
|
|
38
38
|
hash.merge!(special_condition_code_4: find_identifier(:special_condition_code_4)) if @special_condition_code_4
|
39
39
|
hash.merge!(special_condition_code_5: find_identifier(:special_condition_code_5)) if @special_condition_code_5
|
40
40
|
outer_hash = {}
|
41
|
-
outer_hash.merge!(additional_information: hash
|
41
|
+
outer_hash.merge!(additional_information: hash)
|
42
42
|
outer_hash
|
43
43
|
end
|
44
44
|
|
45
45
|
def segment_type
|
46
46
|
TYPE
|
47
47
|
end
|
48
|
-
|
49
|
-
|
50
48
|
end
|
51
49
|
end
|
52
50
|
end
|
@@ -8,7 +8,7 @@ module Eancom
|
|
8
8
|
|
9
9
|
def initialize(
|
10
10
|
tag: nil,
|
11
|
-
document_name_code
|
11
|
+
document_name_code:,
|
12
12
|
code_list_responsible_agency_code: nil,
|
13
13
|
code_list_identification_code: nil,
|
14
14
|
document_name: nil,
|
@@ -28,7 +28,9 @@ module Eancom
|
|
28
28
|
|
29
29
|
def to_json_hash
|
30
30
|
{
|
31
|
-
|
31
|
+
document_name_code: @document_name_code,
|
32
|
+
document_identifier: @document_identifier,
|
33
|
+
message_function_code: @message_function_code
|
32
34
|
}
|
33
35
|
end
|
34
36
|
|
@@ -39,7 +41,6 @@ module Eancom
|
|
39
41
|
def segment_type
|
40
42
|
TYPE
|
41
43
|
end
|
42
|
-
|
43
44
|
end
|
44
45
|
end
|
45
46
|
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
|
@@ -21,7 +21,14 @@ module Eancom
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def to_json_hash
|
24
|
-
{}
|
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'
|
25
32
|
end
|
26
33
|
|
27
34
|
def segment_type
|
@@ -19,7 +19,10 @@ module Eancom
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_json_hash
|
22
|
-
{}
|
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
|
23
26
|
end
|
24
27
|
|
25
28
|
def segment_type
|
@@ -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
|
@@ -10,7 +10,7 @@ module Eancom
|
|
10
10
|
tag: nil,
|
11
11
|
currency_usage_code_qualifier_1:,
|
12
12
|
currency_identification_code_1:,
|
13
|
-
currency_type_code_qualifier_1
|
13
|
+
currency_type_code_qualifier_1: nil,
|
14
14
|
currency_rate_value_1: nil,
|
15
15
|
currency_usage_code_qualifier_2: nil,
|
16
16
|
currency_identification_code_2: nil,
|
@@ -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
|
@@ -21,11 +21,16 @@ module Eancom
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def to_json_hash
|
24
|
-
{
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
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'
|
29
34
|
end
|
30
35
|
|
31
36
|
def segment_type
|
@@ -40,4 +45,3 @@ module Eancom
|
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|
43
|
-
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class EFI < Segment
|
4
|
+
TAG = 'EFI'.freeze
|
5
|
+
TYPE = :body.freeze
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
file_name: nil,
|
12
|
+
file_format_name:,
|
13
|
+
data_format_description_code:
|
14
|
+
)
|
15
|
+
|
16
|
+
@tag = tag
|
17
|
+
@file_name = file_name
|
18
|
+
@file_format_name = file_format_name
|
19
|
+
@data_format_description_code = data_format_description_code
|
20
|
+
|
21
|
+
super(tag: tag || TAG)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def to_json_hash
|
26
|
+
hash = {}
|
27
|
+
hash.merge!(file_name: file_name) if @file_name
|
28
|
+
hash.merge!(file_format_name: file_format_name) if @file_format_name
|
29
|
+
hash.merge!(data_format_description_code: find_identifier(:data_format_description_code)) if @data_format_description_code
|
30
|
+
hash
|
31
|
+
end
|
32
|
+
|
33
|
+
def segment_type
|
34
|
+
TYPE
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Eancom
|
2
|
+
module Edifact
|
3
|
+
class EQD < Segment
|
4
|
+
TAG = 'EQD'.freeze
|
5
|
+
TYPE = :header
|
6
|
+
|
7
|
+
attr_reader :segment_type
|
8
|
+
|
9
|
+
def initialize(
|
10
|
+
tag: nil,
|
11
|
+
equipment_code_qualifier: nil
|
12
|
+
)
|
13
|
+
|
14
|
+
@tag = tag
|
15
|
+
@equipment_code_qualifier = equipment_code_qualifier
|
16
|
+
|
17
|
+
super(tag: tag || TAG)
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_json_hash
|
21
|
+
hash = {}
|
22
|
+
hash.merge!(equipment_code_qualifier: find_identifier(:equipment_code_qualifier)) if @equipment_code_qualifier
|
23
|
+
end
|
24
|
+
|
25
|
+
def segment_type
|
26
|
+
TYPE
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -38,14 +38,14 @@ module Eancom
|
|
38
38
|
hash = {}
|
39
39
|
hash.merge!(text_subject_code_qualifier: @text_subject_code_qualifier) if @text_subject_code_qualifier
|
40
40
|
hash.merge!(free_text_function_code: find_identifier(:free_text_function_code)) if @free_text_function_code
|
41
|
-
hash.merge!(free_text_value_code:
|
41
|
+
hash.merge!(free_text_value_code: find_identifier(:free_text_value_code)) if @free_text_value_code
|
42
42
|
hash.merge!(code_list_identification_code: @code_list_identification_code) if @code_list_identification_code
|
43
43
|
hash.merge!(code_list_responsible_agency_code: find_identifier(:code_list_responsible_agency_code)) if @code_list_responsible_agency_code
|
44
44
|
hash.merge!(free_text_value_1: @free_text_value_1) if @free_text_value_1
|
45
45
|
hash.merge!(free_text_value_2: @free_text_value_2) if @free_text_value_2
|
46
46
|
hash.merge!(free_text_value_3: @free_text_value_3) if @free_text_value_3
|
47
47
|
hash.merge!(free_text_value_4: @free_text_value_4) if @free_text_value_4
|
48
|
-
hash.merge!(free_text_value_5: @free_text_value_5) if @
|
48
|
+
hash.merge!(free_text_value_5: @free_text_value_5) if @free_text_value_5
|
49
49
|
hash
|
50
50
|
end
|
51
51
|
|