eancom 0.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +190 -5
  3. data/.gitlab-ci.yml +25 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile.lock +22 -18
  6. data/README.md +46 -0
  7. data/bin/console +3 -2
  8. data/definitions/desadv/d01b.rb +251 -0
  9. data/definitions/desadv/d96a.rb +208 -87
  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 +328 -0
  24. data/definitions/segments/ali.rb +93 -0
  25. data/definitions/segments/bgm.rb +395 -0
  26. data/definitions/segments/cav.rb +122 -0
  27. data/definitions/segments/cci.rb +136 -0
  28. data/definitions/segments/cdi.rb +39 -0
  29. data/definitions/segments/cnt.rb +82 -0
  30. data/definitions/segments/cps.rb +76 -0
  31. data/definitions/segments/cta.rb +89 -0
  32. data/definitions/segments/cux.rb +174 -0
  33. data/definitions/segments/dgs.rb +34 -0
  34. data/definitions/segments/doc.rb +45 -0
  35. data/definitions/segments/dtm.rb +243 -0
  36. data/definitions/segments/efi.rb +67 -0
  37. data/definitions/segments/eqd.rb +37 -0
  38. data/definitions/segments/ftx.rb +165 -0
  39. data/definitions/segments/gin.rb +113 -0
  40. data/definitions/segments/imd.rb +360 -0
  41. data/definitions/segments/inv.rb +94 -0
  42. data/definitions/segments/lin.rb +133 -0
  43. data/definitions/segments/loc.rb +137 -0
  44. data/definitions/segments/mea.rb +189 -0
  45. data/definitions/segments/moa.rb +228 -0
  46. data/definitions/segments/nad.rb +314 -0
  47. data/definitions/segments/pac.rb +262 -0
  48. data/definitions/segments/pat.rb +171 -0
  49. data/definitions/segments/pcd.rb +72 -0
  50. data/definitions/segments/pci.rb +110 -0
  51. data/definitions/segments/pgi.rb +152 -0
  52. data/definitions/segments/pia.rb +501 -0
  53. data/definitions/segments/pri.rb +208 -0
  54. data/definitions/segments/qty.rb +293 -0
  55. data/definitions/segments/rff.rb +210 -0
  56. data/definitions/segments/rte.rb +52 -0
  57. data/definitions/segments/tax.rb +266 -0
  58. data/definitions/segments/tdt.rb +278 -0
  59. data/definitions/segments/tod.rb +64 -0
  60. data/definitions/segments/tru.rb +34 -0
  61. data/definitions/segments/una.rb +85 -0
  62. data/definitions/segments/unb.rb +284 -0
  63. data/definitions/segments/unh.rb +183 -0
  64. data/definitions/segments/uns.rb +40 -0
  65. data/definitions/segments/unt.rb +48 -0
  66. data/definitions/segments/unz.rb +48 -0
  67. data/definitions/slsrpt/d01b.rb +206 -0
  68. data/definitions/slsrpt/d96a.rb +199 -0
  69. data/eancom.gemspec +2 -1
  70. data/lib/eancom.rb +61 -16
  71. data/lib/eancom/definition.rb +1 -1
  72. data/lib/eancom/edifact.rb +60 -13
  73. data/lib/eancom/edifact/body.rb +63 -0
  74. data/lib/eancom/edifact/composite.rb +38 -0
  75. data/lib/eancom/edifact/data.rb +108 -0
  76. data/lib/eancom/edifact/document.rb +43 -11
  77. data/lib/eancom/edifact/document_element.rb +26 -0
  78. data/lib/eancom/edifact/footer.rb +7 -0
  79. data/lib/eancom/edifact/header.rb +15 -0
  80. data/lib/eancom/edifact/item.rb +40 -0
  81. data/lib/eancom/edifact/message.rb +24 -16
  82. data/lib/eancom/edifact/segment.rb +131 -12
  83. data/lib/eancom/edifact/segments/ajt.rb +32 -0
  84. data/lib/eancom/edifact/segments/alc.rb +61 -0
  85. data/lib/eancom/edifact/segments/ali.rb +50 -0
  86. data/lib/eancom/edifact/segments/bgm.rb +46 -0
  87. data/lib/eancom/edifact/segments/cav.rb +47 -0
  88. data/lib/eancom/edifact/segments/cci.rb +53 -0
  89. data/lib/eancom/edifact/segments/cdi.rb +30 -0
  90. data/lib/eancom/edifact/segments/cnt.rb +40 -0
  91. data/lib/eancom/edifact/segments/cps.rb +33 -0
  92. data/lib/eancom/edifact/segments/cta.rb +30 -0
  93. data/lib/eancom/edifact/segments/cux.rb +60 -0
  94. data/lib/eancom/edifact/segments/dgs.rb +31 -0
  95. data/lib/eancom/edifact/segments/doc.rb +30 -0
  96. data/lib/eancom/edifact/segments/dtm.rb +47 -0
  97. data/lib/eancom/edifact/segments/efi.rb +38 -0
  98. data/lib/eancom/edifact/segments/eqd.rb +30 -0
  99. data/lib/eancom/edifact/segments/ftx.rb +63 -0
  100. data/lib/eancom/edifact/segments/gin.rb +45 -0
  101. data/lib/eancom/edifact/segments/imd.rb +69 -0
  102. data/lib/eancom/edifact/segments/inv.rb +43 -0
  103. data/lib/eancom/edifact/segments/lin.rb +47 -0
  104. data/lib/eancom/edifact/segments/loc.rb +46 -0
  105. data/lib/eancom/edifact/segments/mea.rb +54 -0
  106. data/lib/eancom/edifact/segments/moa.rb +45 -0
  107. data/lib/eancom/edifact/segments/nad.rb +112 -0
  108. data/lib/eancom/edifact/segments/pac.rb +56 -0
  109. data/lib/eancom/edifact/segments/pat.rb +37 -0
  110. data/lib/eancom/edifact/segments/pcd.rb +33 -0
  111. data/lib/eancom/edifact/segments/pci.rb +40 -0
  112. data/lib/eancom/edifact/segments/pgi.rb +45 -0
  113. data/lib/eancom/edifact/segments/pia.rb +108 -0
  114. data/lib/eancom/edifact/segments/pri.rb +53 -0
  115. data/lib/eancom/edifact/segments/qty.rb +44 -0
  116. data/lib/eancom/edifact/segments/rff.rb +47 -0
  117. data/lib/eancom/edifact/segments/rte.rb +33 -0
  118. data/lib/eancom/edifact/segments/tax.rb +78 -0
  119. data/lib/eancom/edifact/segments/tdt.rb +57 -0
  120. data/lib/eancom/edifact/segments/tod.rb +33 -0
  121. data/lib/eancom/edifact/segments/tru.rb +31 -0
  122. data/lib/eancom/edifact/segments/una.rb +52 -0
  123. data/lib/eancom/edifact/segments/unb.rb +68 -0
  124. data/lib/eancom/edifact/segments/unh.rb +50 -0
  125. data/lib/eancom/edifact/segments/uns.rb +32 -0
  126. data/lib/eancom/edifact/segments/unt.rb +28 -0
  127. data/lib/eancom/edifact/segments/unz.rb +28 -0
  128. data/lib/eancom/edifact/structure.rb +90 -0
  129. data/lib/eancom/factory.rb +9 -8
  130. data/lib/eancom/parser.rb +7 -0
  131. data/lib/eancom/parser/document.rb +60 -0
  132. data/lib/eancom/parser/segment.rb +71 -0
  133. data/lib/eancom/version.rb +1 -1
  134. data/pricat.json +1 -0
  135. metadata +141 -9
  136. data/lib/eancom/edifact/element.rb +0 -16
  137. data/lib/eancom/edifact/envelope.rb +0 -24
@@ -0,0 +1,53 @@
1
+ module Eancom
2
+ module Edifact
3
+ class PRI < Segment
4
+ TAG = 'PRI'.freeze
5
+ TYPE = :body.freeze
6
+
7
+ attr_reader :segment_type
8
+
9
+ def initialize(
10
+ tag: nil,
11
+ price_code_qualifier:,
12
+ price_amount:,
13
+ price_type_code: nil,
14
+ price_specification_code: nil,
15
+ unit_price_basis_value: nil,
16
+ measurment_unit_code: nil,
17
+ subline_item_price_change_operation_code: nil
18
+ )
19
+ @tag = tag
20
+
21
+ @price_code_qualifier = price_code_qualifier
22
+ @price_amount = price_amount
23
+ @price_type_code = price_type_code
24
+ @price_specification_code = price_specification_code
25
+ @unit_price_basis_value = unit_price_basis_value
26
+ @measurment_unit_code = measurment_unit_code
27
+ @subline_item_price_change_operation_code = subline_item_price_change_operation_code
28
+
29
+ super(tag: tag || TAG)
30
+ end
31
+
32
+ def to_json_hash
33
+ hash = {}
34
+ hash.merge!(price_code_qualifier: find_identifier(:price_code_qualifier)) if @price_code_qualifier
35
+ hash.merge!(price_amount: @price_amount) if @price_amount
36
+ hash.merge!(price_type_code: find_identifier(:price_type_code)) if @price_type_code
37
+ hash.merge!(price_specification_code: find_identifier(:price_specification_code)) if @price_specification_code
38
+ hash.merge!(unit_price_basis_value: @unit_price_basis_value) if @unit_price_basis_value
39
+ hash.merge!(measurment_unit_code: find_identifier(:measurment_unit_code)) if @measurment_unit_code
40
+ { price: hash }
41
+ end
42
+
43
+ def group_name
44
+ 'prices'
45
+ end
46
+
47
+ def segment_type
48
+ TYPE
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,44 @@
1
+ module Eancom
2
+ module Edifact
3
+ class QTY < Segment
4
+ TAG = 'QTY'.freeze
5
+ TYPE = :body.freeze
6
+
7
+ def initialize(
8
+ tag: nil,
9
+ quantity_type_code_qualifier:,
10
+ quantity:,
11
+ measurement_unit_code: nil
12
+ )
13
+ @tag = tag
14
+ @quantity_type_code_qualifier = quantity_type_code_qualifier
15
+ @quantity = quantity
16
+ @measurement_unit_code = measurement_unit_code
17
+
18
+ super(tag: tag || TAG)
19
+ end
20
+
21
+ def to_json_hash
22
+ hash = { identifier => {} }
23
+ hash[identifier].merge!({ quantity: @quantity }) if @quantity
24
+ hash.merge!(measurement_unit_code: find_identifier(:measurement_unit_code)) if @measurement_unit_code
25
+ hash.merge!(identifier: @identifier) if @identifier
26
+ hash
27
+ end
28
+
29
+ def group_name
30
+ 'quantities'
31
+ end
32
+
33
+ def segment_type
34
+ TYPE
35
+ end
36
+
37
+ private
38
+
39
+ def identifier
40
+ @identifier ||= structure.find(:quantity_type_code_qualifier).dictionary[@quantity_type_code_qualifier][:identifier]
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,47 @@
1
+ module Eancom
2
+ module Edifact
3
+ class RFF < Segment
4
+ TAG = 'RFF'.freeze
5
+ TYPE = :body.freeze
6
+
7
+ def initialize(
8
+ tag: nil,
9
+ reference_code_qualifier:,
10
+ reference_identifier: nil,
11
+ document_line_identifier: nil
12
+ )
13
+ @tag = tag
14
+ @reference_code_qualifier = reference_code_qualifier
15
+ @reference_identifier = reference_identifier
16
+ @document_line_identifier = document_line_identifier
17
+
18
+ super(tag: @tag || TAG)
19
+ end
20
+
21
+ def to_json_hash
22
+ {
23
+ identifier => {
24
+ reference_identifier: @reference_identifier,
25
+ document_line_identifier: @document_line_identifier
26
+ },
27
+ identifier: @identifier
28
+ }
29
+ end
30
+
31
+ def group_name
32
+ 'references'
33
+ end
34
+
35
+ def segment_type
36
+ TYPE
37
+ end
38
+
39
+ private
40
+
41
+ def identifier
42
+ @identifier ||= structure.find(:reference_code_qualifier).dictionary[@reference_code_qualifier][:identifier]
43
+ end
44
+ end
45
+ end
46
+ end
47
+
@@ -0,0 +1,33 @@
1
+ module Eancom
2
+ module Edifact
3
+ class RTE < Segment
4
+ TAG = 'RTE'.freeze
5
+ TYPE = :header
6
+
7
+ attr_reader :segment_type
8
+
9
+ def initialize(
10
+ tag: nil,
11
+ rate_type_code_qualifier: nil,
12
+ unit_price_basis_rate: nil
13
+ )
14
+ @tag = tag
15
+ @rate_type_code_qualifier = rate_type_code_qualifier
16
+ @unit_price_basis_rate = unit_price_basis_rate
17
+
18
+ super(tag: tag || TAG)
19
+ end
20
+
21
+ def to_json_hash
22
+ hash = {}
23
+ hash.merge!(rate_type_code_qualifier: find_identifier(:rate_type_code_qualifier)) if @rate_type_code_qualifier
24
+ hash.merge!(unit_price_basis_rate: @unit_price_basis_rate) if @unit_price_basis_rate
25
+ hash
26
+ end
27
+
28
+ def segment_type
29
+ TYPE
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,78 @@
1
+ module Eancom
2
+ module Edifact
3
+ class TAX < Segment
4
+ TAG = 'TAX'.freeze
5
+ TYPE = :body.freeze
6
+
7
+ attr_reader :segment_type
8
+
9
+ def initialize(
10
+ tag: nil,
11
+ duty_or_tax_or_fee_function_code_qualifier:,
12
+ duty_or_tax_or_fee_name_code: nil,
13
+ code_list_identification_code_1: nil,
14
+ code_list_responsibility_agency_code_1: nil,
15
+ duty_or_tax_or_fee_type_name: nil,
16
+ duty_or_tax_or_fee_account_code: nil,
17
+ code_list_identification_code_2: nil,
18
+ code_list_responsibility_agency_code_2: nil,
19
+ duty_or_tax_of_fee_assessment_basis_value: nil,
20
+ duty_tax_fee_rate_code: nil,
21
+ code_list_identification_code_3: nil,
22
+ code_list_responsibility_agency_code_3: nil,
23
+ duty_or_tax_or_fee_rate: nil,
24
+ duty_or_tax_or_fee_basis_code: nil,
25
+ code_list_identification_code_4: nil,
26
+ code_list_responsibility_agency_code_4: nil,
27
+ duty_or_tax_or_fee_category_code: nil
28
+ )
29
+ @tag = tag
30
+ @duty_or_tax_or_fee_function_code_qualifier = duty_or_tax_or_fee_function_code_qualifier
31
+ @duty_or_tax_or_fee_name_code = duty_or_tax_or_fee_name_code
32
+ @code_list_identification_code_1 = code_list_identification_code_1
33
+ @code_list_responsibility_agency_code_1 = code_list_responsibility_agency_code_1
34
+ @duty_or_tax_or_fee_type_name = duty_or_tax_or_fee_type_name
35
+ @duty_or_tax_or_fee_account_code = duty_or_tax_or_fee_account_code
36
+ @code_list_identification_code_2 = code_list_identification_code_2
37
+ @code_list_responsibility_agency_code_2 = code_list_responsibility_agency_code_2
38
+ @duty_or_tax_of_fee_assessment_basis_value = duty_or_tax_of_fee_assessment_basis_value
39
+ @duty_tax_fee_rate_code = duty_tax_fee_rate_code
40
+ @code_list_identification_code_3 = code_list_identification_code_3
41
+ @code_list_responsibility_agency_code_3 = code_list_responsibility_agency_code_3
42
+ @duty_or_tax_or_fee_rate = duty_or_tax_or_fee_rate
43
+ @duty_or_tax_or_fee_basis_code = duty_or_tax_or_fee_basis_code
44
+ @code_list_identification_code_4 = code_list_identification_code_4
45
+ @code_list_responsibility_agency_code_4 = code_list_responsibility_agency_code_4
46
+ @duty_or_tax_or_fee_category_code = duty_or_tax_or_fee_category_code
47
+
48
+ super(tag: tag || TAG)
49
+ end
50
+
51
+ def to_json_hash
52
+ hash = {}
53
+ hash.merge!(duty_or_tax_or_fee_function_code_qualifier: find_identifier(:duty_or_tax_or_fee_function_code_qualifier)) if @duty_or_tax_or_fee_function_code_qualifier
54
+ hash.merge!(duty_or_tax_or_fee_name_code: find_identifier(:duty_or_tax_or_fee_name_code)) if @duty_or_tax_or_fee_name_code
55
+ hash.merge!(duty_or_tax_or_fee_account_code: @duty_or_tax_or_fee_account_code) if @duty_or_tax_or_fee_account_code
56
+ hash.merge!(duty_tax_fee_rate_code: @duty_tax_fee_rate_code) if @duty_tax_fee_rate_code
57
+ hash.merge!(duty_or_tax_or_fee_rate: @duty_or_tax_or_fee_rate) if @duty_or_tax_or_fee_rate
58
+ hash.merge!(code_list_identification_code_3: @code_list_identification_code_3) if @code_list_identification_code_3
59
+ hash.merge!(code_list_responsibility_agency_code_3: @code_list_responsibility_agency_code_3) if @code_list_responsibility_agency_code_3
60
+ hash.merge!(code_list_responsibility_agency_code_4: @code_list_responsibility_agency_code_4) if @code_list_responsibility_agency_code_4
61
+ hash.merge!(duty_or_tax_or_fee_category_code: find_identifier(:duty_or_tax_or_fee_category_code)) if @duty_or_tax_or_fee_category_code
62
+ outer_hash = {}
63
+ identifier = find_identifier(:duty_or_tax_or_fee_function_code_qualifier)
64
+ outer_hash[identifier] = hash
65
+ outer_hash
66
+ end
67
+
68
+ def group_name
69
+ 'taxes'
70
+ end
71
+
72
+ def segment_type
73
+ TYPE
74
+ end
75
+
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,57 @@
1
+ module Eancom
2
+ module Edifact
3
+ class TDT < Segment
4
+ TAG = 'TDT'.freeze
5
+ TYPE = :body.freeze
6
+
7
+ def initialize(
8
+ tag: nil,
9
+ transport_stage_code_qualifier:,
10
+ means_of_transport_journey_identifier: nil,
11
+ transport_mode_name_code:,
12
+ transport_means_description_code: nil,
13
+ transport_means_description: nil,
14
+ carrier_identifier: nil,
15
+ code_list_identification_code_1: nil,
16
+ code_list_responsible_agency_1: nil,
17
+ carrier_name: nil,
18
+ transit_direction_identicator_code: nil,
19
+ transport_means_identification_name_identifier: nil,
20
+ code_list_identification_code_2: nil,
21
+ code_list_responsible_agency_2: nil,
22
+ transport_means_identification_name: nil,
23
+ transport_means_nationality_code: nil
24
+ )
25
+ @tag = tag
26
+ @transport_stage_code_qualifier = transport_stage_code_qualifier
27
+ @means_of_transport_journey_identifier = means_of_transport_journey_identifier
28
+ @transport_mode_name_code = transport_mode_name_code
29
+ @transport_means_description_code = transport_means_description_code
30
+ @transport_means_description = transport_means_description
31
+ @carrier_identifier = carrier_identifier
32
+ @code_list_identification_code_1 = code_list_identification_code_1
33
+ @code_list_responsible_agency_1 = code_list_responsible_agency_1
34
+ @carrier_name = carrier_name
35
+ @transit_direction_identicator_code = transit_direction_identicator_code
36
+ @transport_means_identification_name_identifier = transport_means_identification_name_identifier
37
+ @code_list_identification_code_2 = code_list_identification_code_2
38
+ @code_list_responsible_agency_2 = code_list_responsible_agency_2
39
+ @transport_means_identification_name = transport_means_identification_name
40
+ @transport_means_nationality_code = transport_means_nationality_code
41
+
42
+ super(tag: tag || TAG)
43
+ end
44
+
45
+ def to_json_hash
46
+ hash = {}
47
+ hash.merge!(transport_stage_code_qualifier: find_identifier(:transport_stage_code_qualifier)) if @transport_stage_code_qualifier
48
+ hash.merge!(transport_mode_name_code: find_identifier(:transport_mode_name_code)) if @transport_mode_name_code
49
+ hash
50
+ end
51
+
52
+ def segment_type
53
+ TYPE
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,33 @@
1
+ module Eancom
2
+ module Edifact
3
+ class TOD < Segment
4
+ TAG = 'TOD'.freeze
5
+ TYPE = :header
6
+
7
+ attr_reader :segment_type
8
+
9
+ def initialize(
10
+ tag: nil,
11
+ delivery_or_transport_terms_function_code: nil,
12
+ delivery_or_transport_terms_description_code: nil
13
+ )
14
+ @tag = tag
15
+ @delivery_or_transport_terms_function_code = delivery_or_transport_terms_function_code
16
+ @delivery_or_transport_terms_description_code = delivery_or_transport_terms_description_code
17
+
18
+ super(tag: tag || TAG)
19
+ end
20
+
21
+ def to_json_hash
22
+ hash = {}
23
+ hash.merge!(delivery_or_transport_terms_function_code: @delivery_or_transport_terms_function_code) if @delivery_or_transport_terms_function_code
24
+ hash.merge!(delivery_or_transport_terms_description_code: @delivery_or_transport_terms_description_code) if @delivery_or_transport_terms_description_code
25
+ hash
26
+ end
27
+
28
+ def segment_type
29
+ TYPE
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,31 @@
1
+ module Eancom
2
+ module Edifact
3
+ class TRU < Segment
4
+ TAG = 'TRU'.freeze
5
+ TYPE = :body
6
+
7
+ attr_reader :segment_type
8
+
9
+ def initialize(
10
+ tag: nil,
11
+ object_identifier:
12
+ )
13
+
14
+ @tag = tag
15
+ @object_identifier = object_identifier
16
+
17
+ super(tag: tag || TAG)
18
+ end
19
+
20
+ def to_json_hash
21
+ hash = {}
22
+ hash.merge!(object_identifier: @object_identifier)
23
+ hash
24
+ end
25
+
26
+ def segment_type
27
+ TYPE
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,52 @@
1
+ module Eancom
2
+ module Edifact
3
+ class UNA < Segment
4
+ TAG = 'UNA'.freeze
5
+ TYPE = :header.freeze
6
+
7
+ attr_reader :tag, :una1, :una2, :una3, :una4, :una5, :una6
8
+
9
+ def initialize(tag: nil,
10
+ una1: ':',
11
+ una2: '+',
12
+ una3: '.',
13
+ una4: '?',
14
+ una5: ' ',
15
+ una6: '\'',
16
+ **kwargs
17
+ )
18
+ @tag = tag
19
+ @una1 = una1
20
+ @una2 = una2
21
+ @una3 = una3
22
+ @una4 = una4
23
+ @una5 = una5
24
+ @una6 = una6
25
+
26
+ super(tag: (tag || TAG))
27
+ end
28
+
29
+
30
+ def to_s
31
+ stream = ""
32
+ stream << tag
33
+ stream << una1
34
+ stream << una2
35
+ stream << una3
36
+ stream << una4
37
+ stream << una5
38
+ stream << una6
39
+ stream
40
+ end
41
+
42
+ def to_json_hash
43
+ {}
44
+ end
45
+
46
+ def segment_type
47
+ TYPE
48
+ end
49
+
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,68 @@
1
+ module Eancom
2
+ module Edifact
3
+ class UNB < Segment
4
+ TAG = 'UNB'.freeze
5
+ TYPE = :header.freeze
6
+
7
+ def initialize(tag: nil,
8
+ syntax_identifier:,
9
+ syntax_version_number:,
10
+ interchange_sender_identification:,
11
+ sender_identifiction_code_qualifier:,
12
+ interchange_sender_internal_identification: nil,
13
+ interchange_recipient_identification:,
14
+ recipient_identifiction_code_qualifier:,
15
+ interchange_recipient_internal_identification: nil,
16
+ date:,
17
+ time:,
18
+ interchange_control_reference:,
19
+ recipient_reference: nil,
20
+ recipient_reference_qualifier: nil,
21
+ application_reference: nil,
22
+ processing_priority_code: nil,
23
+ acknowledgement_request: nil,
24
+ interchange_agreement_identifier: nil,
25
+ test_indicator: nil
26
+ )
27
+ @tag = tag
28
+ @syntax_identifier = syntax_identifier
29
+ @syntax_version_number = syntax_version_number
30
+ @interchange_sender_identification = interchange_sender_identification
31
+ @sender_identifiction_code_qualifier = sender_identifiction_code_qualifier
32
+ @interchange_sender_internal_identification = interchange_sender_internal_identification
33
+ @interchange_recipient_identification = interchange_recipient_identification
34
+ @recipient_identifiction_code_qualifier = recipient_identifiction_code_qualifier
35
+ @interchange_recipient_internal_identification = interchange_recipient_internal_identification
36
+ @date = date
37
+ @time = time
38
+ @interchange_control_reference = interchange_control_reference
39
+ @recipient_reference = recipient_reference
40
+ @recipient_reference_qualifier = recipient_reference_qualifier
41
+ @application_reference = application_reference
42
+ @processing_priority_code = processing_priority_code
43
+ @acknowledgement_request = acknowledgement_request
44
+ @interchange_agreement_identifier = interchange_agreement_identifier
45
+ @test_indicator = test_indicator
46
+ super(tag: tag || TAG)
47
+ end
48
+
49
+ def to_json_hash
50
+ {
51
+ interchange_sender_identification: @interchange_sender_identification,
52
+ interchange_recipient_identification: @interchange_recipient_identification,
53
+ date: @date,
54
+ time: @time,
55
+ interchange_control_reference: @interchange_control_reference,
56
+ application_reference: @application_reference,
57
+ interchange_agreement_identifier: @interchange_agreement_identifier
58
+ }
59
+ end
60
+
61
+ def segment_type
62
+ TYPE
63
+ end
64
+
65
+ end
66
+ end
67
+ end
68
+