eancom 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -3
  3. data/.gitlab-ci.yml +11 -13
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -4
  6. data/Gemfile.lock +23 -103
  7. data/README.md +46 -0
  8. data/definitions/desadv/d01b.rb +139 -93
  9. data/definitions/desadv/d96a.rb +187 -101
  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 +128 -36
  24. data/definitions/segments/bgm.rb +128 -0
  25. data/definitions/segments/cdi.rb +39 -0
  26. data/definitions/segments/cnt.rb +4 -0
  27. data/definitions/segments/cta.rb +89 -0
  28. data/definitions/segments/cux.rb +9 -2
  29. data/definitions/segments/dgs.rb +34 -0
  30. data/definitions/segments/doc.rb +45 -0
  31. data/definitions/segments/dtm.rb +85 -1
  32. data/definitions/segments/efi.rb +67 -0
  33. data/definitions/segments/eqd.rb +37 -0
  34. data/definitions/segments/ftx.rb +24 -2
  35. data/definitions/segments/gin.rb +113 -0
  36. data/definitions/segments/imd.rb +5 -1
  37. data/definitions/segments/inv.rb +94 -0
  38. data/definitions/segments/lin.rb +23 -3
  39. data/definitions/segments/loc.rb +52 -4
  40. data/definitions/segments/moa.rb +86 -2
  41. data/definitions/segments/nad.rb +69 -9
  42. data/definitions/segments/pac.rb +12 -0
  43. data/definitions/segments/pat.rb +171 -0
  44. data/definitions/segments/pcd.rb +72 -0
  45. data/definitions/segments/pci.rb +110 -0
  46. data/definitions/segments/pgi.rb +6 -2
  47. data/definitions/segments/pia.rb +21 -21
  48. data/definitions/segments/pri.rb +21 -1
  49. data/definitions/segments/qty.rb +219 -5
  50. data/definitions/segments/rff.rb +51 -7
  51. data/definitions/segments/rte.rb +52 -0
  52. data/definitions/segments/tax.rb +17 -10
  53. data/definitions/segments/tdt.rb +24 -0
  54. data/definitions/segments/tod.rb +64 -0
  55. data/definitions/segments/tru.rb +34 -0
  56. data/definitions/segments/una.rb +7 -7
  57. data/definitions/segments/unb.rb +4 -4
  58. data/definitions/segments/unh.rb +70 -5
  59. data/definitions/segments/uns.rb +2 -2
  60. data/definitions/segments/unt.rb +2 -2
  61. data/definitions/slsrpt/d01b.rb +104 -100
  62. data/definitions/slsrpt/d96a.rb +104 -99
  63. data/eancom.gemspec +5 -8
  64. data/lib/eancom/edifact/document.rb +2 -2
  65. data/lib/eancom/edifact/footer.rb +1 -0
  66. data/lib/eancom/edifact/segment.rb +2 -2
  67. data/lib/eancom/edifact/segments/ajt.rb +32 -0
  68. data/lib/eancom/edifact/segments/ali.rb +2 -4
  69. data/lib/eancom/edifact/segments/bgm.rb +4 -3
  70. data/lib/eancom/edifact/segments/cdi.rb +30 -0
  71. data/lib/eancom/edifact/segments/cnt.rb +8 -1
  72. data/lib/eancom/edifact/segments/cps.rb +4 -1
  73. data/lib/eancom/edifact/segments/cta.rb +30 -0
  74. data/lib/eancom/edifact/segments/cux.rb +1 -1
  75. data/lib/eancom/edifact/segments/dgs.rb +31 -0
  76. data/lib/eancom/edifact/segments/doc.rb +30 -0
  77. data/lib/eancom/edifact/segments/dtm.rb +10 -6
  78. data/lib/eancom/edifact/segments/efi.rb +38 -0
  79. data/lib/eancom/edifact/segments/eqd.rb +30 -0
  80. data/lib/eancom/edifact/segments/ftx.rb +2 -2
  81. data/lib/eancom/edifact/segments/gin.rb +45 -0
  82. data/lib/eancom/edifact/segments/imd.rb +1 -1
  83. data/lib/eancom/edifact/segments/inv.rb +43 -0
  84. data/lib/eancom/edifact/segments/lin.rb +7 -3
  85. data/lib/eancom/edifact/segments/loc.rb +8 -5
  86. data/lib/eancom/edifact/segments/mea.rb +1 -0
  87. data/lib/eancom/edifact/segments/moa.rb +3 -3
  88. data/lib/eancom/edifact/segments/nad.rb +11 -6
  89. data/lib/eancom/edifact/segments/pac.rb +3 -1
  90. data/lib/eancom/edifact/segments/pat.rb +37 -0
  91. data/lib/eancom/edifact/segments/pcd.rb +33 -0
  92. data/lib/eancom/edifact/segments/pci.rb +40 -0
  93. data/lib/eancom/edifact/segments/pia.rb +1 -0
  94. data/lib/eancom/edifact/segments/pri.rb +0 -1
  95. data/lib/eancom/edifact/segments/qty.rb +9 -5
  96. data/lib/eancom/edifact/segments/rff.rb +8 -2
  97. data/lib/eancom/edifact/segments/rte.rb +33 -0
  98. data/lib/eancom/edifact/segments/tax.rb +7 -1
  99. data/lib/eancom/edifact/segments/tdt.rb +4 -1
  100. data/lib/eancom/edifact/segments/tod.rb +33 -0
  101. data/lib/eancom/edifact/segments/tru.rb +31 -0
  102. data/lib/eancom/edifact/segments/una.rb +2 -1
  103. data/lib/eancom/edifact/segments/unb.rb +4 -5
  104. data/lib/eancom/edifact/segments/unh.rb +6 -4
  105. data/lib/eancom/edifact/segments/uns.rb +3 -0
  106. data/lib/eancom/edifact/structure.rb +0 -1
  107. data/lib/eancom/edifact.rb +15 -1
  108. data/lib/eancom/factory.rb +1 -1
  109. data/lib/eancom/parser/document.rb +2 -10
  110. data/lib/eancom/version.rb +1 -1
  111. data/lib/eancom.rb +3 -1
  112. data/pricat.json +1 -0
  113. metadata +51 -52
  114. data/.rspec_status +0 -225
  115. data/.rubocop.yml +0 -2
@@ -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.freeze
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: nil,
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
- document_identifier: @document_identifier
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
- identifier => {
26
- date_time: @date_time
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: @free_text_value_code) if @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 @free_text_value_4
48
+ hash.merge!(free_text_value_5: @free_text_value_5) if @free_text_value_5
49
49
  hash
50
50
  end
51
51
 
@@ -0,0 +1,45 @@
1
+ module Eancom
2
+ module Edifact
3
+ class GIN < Segment
4
+ TAG = 'GIN'.freeze
5
+ TYPE = :body.freeze
6
+
7
+ attr_reader :segment_type
8
+
9
+ def initialize(
10
+ tag: nil,
11
+ object_identification_code_qualifier:,
12
+ object_identifier_1: nil,
13
+ object_identifier_2: nil,
14
+ object_identifier_3: nil,
15
+ object_identifier_4: nil,
16
+ object_identifier_5: nil
17
+ )
18
+ @tag = tag
19
+ @object_identification_code_qualifier = object_identification_code_qualifier
20
+ @object_identifier_1 = object_identifier_1
21
+ @object_identifier_2 = object_identifier_2
22
+ @object_identifier_3 = object_identifier_3
23
+ @object_identifier_4 = object_identifier_4
24
+ @object_identifier_5 = object_identifier_5
25
+
26
+ super(tag: @tag || TAG)
27
+ end
28
+
29
+ def to_json_hash
30
+ hash = {}
31
+ hash.merge!(object_identification_code_qualifier: @object_identification_code_qualifier) if @object_identification_code_qualifier
32
+ hash.merge!(object_identifier_1: @object_identifier_1) if @object_identifier_1
33
+ hash.merge!(object_identifier_2: @object_identifier_2) if @object_identifier_2
34
+ hash.merge!(object_identifier_3: @object_identifier_3) if @object_identifier_3
35
+ hash.merge!(object_identifier_4: @object_identifier_4) if @object_identifier_4
36
+ hash.merge!(object_identifier_5: @object_identifier_5) if @object_identifier_5
37
+ hash
38
+ end
39
+
40
+ def segment_type
41
+ TYPE
42
+ end
43
+ end
44
+ end
45
+ end
@@ -38,7 +38,7 @@ module Eancom
38
38
  hash = {}
39
39
  hash.merge!(description_format_code: find_identifier(:description_format_code)) if @description_format_code
40
40
  hash.merge!(item_characteristic_code: find_identifier(:item_characteristic_code)) if @item_characteristic_code
41
- hash.merge!(code_list_identification_code: @code_list_identification_code) if @code_list_identification_code
41
+ hash.merge!(code_list_identification_code: find_identifier(:code_list_identification_code)) if @code_list_identification_code
42
42
  hash.merge!(code_list_responsible_agency_code: find_identifier(:code_list_responsible_agency_code)) if @code_list_responsible_agency_code
43
43
  if @item_description_code
44
44
  identifier = find_identifier(:item_description_code)
@@ -0,0 +1,43 @@
1
+ module Eancom
2
+ module Edifact
3
+ class INV < Segment
4
+ TAG = 'INV'.freeze
5
+ TYPE = :body
6
+
7
+ attr_reader :segment_type
8
+
9
+ def initialize(
10
+ tag: nil,
11
+ inventory_movement_direction_code:,
12
+ inventory_type_code: nil,
13
+ inventory_movement_reason_code: nil,
14
+ inventory_balance_method_code: nil
15
+ )
16
+
17
+ @tag = tag
18
+ @inventory_movement_direction_code = inventory_movement_direction_code
19
+ @inventory_type_code = inventory_type_code
20
+ @inventory_movement_reason_code = inventory_movement_reason_code
21
+ @inventory_balance_method_code = inventory_balance_method_code
22
+ super(tag: tag || TAG)
23
+ end
24
+
25
+ def to_json_hash
26
+ hash = {}
27
+ hash.merge!(inventory_movement_direction_code: find_identifier(:inventory_movement_direction_code)) if @inventory_movement_direction_code
28
+ hash.merge!(inventory_type_code: @inventory_type_code) if @inventory_type_code
29
+ hash.merge!(inventory_movement_reason_code: @inventory_movement_reason_code) if @inventory_movement_reason_code
30
+ hash.merge!(inventory_balance_method_code: @inventory_balance_method_code) if @inventory_balance_method_code
31
+ hash
32
+ end
33
+
34
+ def group_name
35
+ 'inventory'
36
+ end
37
+
38
+ def segment_type
39
+ TYPE
40
+ end
41
+ end
42
+ end
43
+ end
@@ -29,9 +29,13 @@ module Eancom
29
29
  end
30
30
 
31
31
  def to_json_hash
32
- {
33
- ean: @item_identifier
34
- }
32
+ hash = {}
33
+ hash.merge!(ean: @item_identifier) if @item_identifier
34
+ hash.merge!(action_request_notification_description_code: @action_request_notification_description_code) if @action_request_notification_description_code
35
+ hash.merge!(item_type_identification_code: find_identifier(:item_type_identification_code)) if @item_type_identification_code
36
+ hash.merge!(sub_line_indicator_code: @sub_line_indicator_code) if @sub_line_indicator_code
37
+ hash.merge!(line_item_identifier_2: @line_item_identifier_2) if @line_item_identifier_2
38
+ hash
35
39
  end
36
40
 
37
41
  def segment_type
@@ -9,15 +9,17 @@ module Eancom
9
9
  def initialize(
10
10
  tag: nil,
11
11
  location_function_qualifier:,
12
- location_name_code:,
12
+ location_name_code: nil,
13
+ first_related_name_code: nil,
13
14
  code_list_identification_code: nil,
14
- code_list_responsible_agancy_code: nil
15
+ code_list_responsible_agency_code: nil
15
16
  )
16
17
  @tag = tag
17
18
  @location_function_qualifier = location_function_qualifier
18
19
  @location_name_code = location_name_code
20
+ @first_related_name_code = first_related_name_code
19
21
  @code_list_identification_code = code_list_identification_code
20
- @code_list_responsible_agancy_code = code_list_responsible_agancy_code
22
+ @code_list_responsible_agency_code = code_list_responsible_agency_code
21
23
 
22
24
  super(tag: tag || TAG)
23
25
  end
@@ -26,11 +28,12 @@ module Eancom
26
28
  hash = {}
27
29
  hash.merge!(location_function_qualifier: find_identifier(:location_function_qualifier)) if @location_function_qualifier
28
30
  hash.merge!(location_name_code: @location_name_code) if @location_name_code
31
+ hash.merge!(first_related_name_code: @first_related_name_code) if @first_related_name_code
29
32
  hash.merge!(code_list_identification_code: @code_list_identification_code) if @code_list_identification_code
30
- hash.merge!(code_list_responsible_agancy_code: find_identifier(:code_list_responsible_agancy_code)) if @code_list_responsible_agancy_code
33
+ hash.merge!(code_list_responsible_agency_code: find_identifier(:code_list_responsible_agency_code)) if @code_list_responsible_agency_code
31
34
  hash
32
35
  outer_hash = {}
33
- outer_hash.merge!({ location: hash})
36
+ outer_hash.merge!({ location: hash })
34
37
  outer_hash
35
38
  end
36
39
 
@@ -34,6 +34,7 @@ module Eancom
34
34
  hash.merge!(measurement_purpose_code_qualifier: find_identifier(:measurement_purpose_code_qualifier)) if @measurement_purpose_code_qualifier
35
35
  hash.merge!(measured_attribute_code: find_identifier(:measured_attribute_code)) if @measured_attribute_code
36
36
  hash.merge!(measurement_significance_code: find_identifier(:measurement_significance_code)) if @measurement_significance_code
37
+ hash.merge!(measurment_unit_code: find_identifier(:measurment_unit_code)) if @measurment_unit_code
37
38
  hash.merge!(measurement_value: @measurement_value) if @measurement_value
38
39
  hash.merge!(range_minimum_value: @range_minimum_value) if @range_minimum_value
39
40
  hash.merge!(range_maximum_value: @range_maximum_value) if @range_maximum_value
@@ -2,14 +2,14 @@ module Eancom
2
2
  module Edifact
3
3
  class MOA < Segment
4
4
  TAG = 'MOA'.freeze
5
- TYPE = :body.freeze
5
+ TYPE = :footer.freeze
6
6
 
7
7
  attr_reader :segment_type
8
8
 
9
9
  def initialize(
10
10
  tag: nil,
11
11
  monetary_amount_type_code_qualifier:,
12
- monetary_amount:,
12
+ monetary_amount: nil,
13
13
  currency_identification_code: nil,
14
14
  currency_type_code_qualifier: nil
15
15
  )
@@ -28,7 +28,7 @@ module Eancom
28
28
  hash.merge!(monetary_amount_type_code_qualifier: find_identifier(:monetary_amount_type_code_qualifier)) if @monetary_amount_type_code_qualifier
29
29
  hash.merge!(monetary_amount: @monetary_amount) if @monetary_amount
30
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
31
+ hash.merge!(currency_type_code_qualifier: find_identifier(:currency_type_code_qualifier)) if @currency_type_code_qualifier
32
32
  hash
33
33
  end
34
34
 
@@ -9,7 +9,7 @@ module Eancom
9
9
  party_function_code_qualifier:,
10
10
  party_identifier:,
11
11
  code_list_identification_code_1: '',
12
- code_list_responsible_agancy_code_1:,
12
+ code_list_responsible_agency_code_1: nil,
13
13
  name_and_address_description_1: nil,
14
14
  name_and_address_description_2: nil,
15
15
  name_and_address_description_3: nil,
@@ -28,7 +28,7 @@ module Eancom
28
28
  city_name: nil,
29
29
  country_sub_entity_name_code: nil,
30
30
  code_list_identification_code_2: nil,
31
- code_list_responsible_agancy_code_2: nil,
31
+ code_list_responsible_agency_code_2: nil,
32
32
  country_sub_entry_name: nil,
33
33
  postal_identification_code: nil,
34
34
  country_name_code: nil
@@ -37,7 +37,7 @@ module Eancom
37
37
  @party_function_code_qualifier = party_function_code_qualifier
38
38
  @party_identifier = party_identifier
39
39
  @code_list_identification_code_1 = code_list_identification_code_1
40
- @code_list_responsible_agancy_code_1 = code_list_responsible_agancy_code_1
40
+ @code_list_responsible_agency_code_1 = code_list_responsible_agency_code_1
41
41
  @name_and_address_description_1 = name_and_address_description_1
42
42
  @name_and_address_description_2 = name_and_address_description_2
43
43
  @name_and_address_description_3 = name_and_address_description_3
@@ -55,8 +55,8 @@ module Eancom
55
55
  @street_and_number_5 = street_and_number_5
56
56
  @city_name = city_name
57
57
  @country_sub_entity_name_code = country_sub_entity_name_code
58
- @code_list_identification_code_2 = code_list_identification_code_2
59
- @code_list_responsible_agancy_code_2 = code_list_responsible_agancy_code_2
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
60
  @country_sub_entry_name = country_sub_entry_name
61
61
  @postal_identification_code = postal_identification_code
62
62
  @country_name_code = country_name_code
@@ -66,7 +66,6 @@ module Eancom
66
66
  def to_json_hash
67
67
  hash = { identifier => {} }
68
68
  hash[identifier].merge!({ party_identifier: @party_identifier }) if @party_identifier
69
- hash[identifier].merge!(code_list_responsible_agancy_code_1: find_identifier(:code_list_responsible_agancy_code_1)) if @code_list_responsible_agancy_code_1
70
69
  hash[identifier].merge!({ name_and_address_description_1: @name_and_address_description_1 }) if @name_and_address_description_1
71
70
  hash[identifier].merge!({ name_and_address_description_2: @name_and_address_description_2 }) if @name_and_address_description_2
72
71
  hash[identifier].merge!({ name_and_address_description_3: @name_and_address_description_3 }) if @name_and_address_description_3
@@ -88,14 +87,20 @@ module Eancom
88
87
  hash[identifier].merge!({ postal_identification_code: @postal_identification_code }) if @postal_identification_code
89
88
  hash[identifier].merge!({ country_name_code: @country_name_code }) if @country_name_code
90
89
 
90
+ hash.merge!({ identifier: @identifier }) if @identifier
91
91
  hash = {} if hash[identifier].empty?
92
92
  hash
93
+
93
94
  end
94
95
 
95
96
  def segment_type
96
97
  TYPE
97
98
  end
98
99
 
100
+ def group_name
101
+ 'nads'
102
+ end
103
+
99
104
  private
100
105
 
101
106
  def identifier
@@ -43,7 +43,9 @@ module Eancom
43
43
  end
44
44
 
45
45
  def to_json_hash
46
- {}
46
+ hash = {}
47
+ hash.merge!(package_quantity: @package_quantity) if @package_quantity
48
+ hash
47
49
  end
48
50
 
49
51
  def segment_type
@@ -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