eddy 0.8.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -4
  3. data/CHANGELOG.md +51 -1
  4. data/Gemfile.lock +8 -8
  5. data/README.md +1 -1
  6. data/data/code-lists/333.tsv +8 -0
  7. data/data/segments/amt.segment.yml +7 -0
  8. data/data/segments/bia.segment.yml +10 -0
  9. data/data/segments/cur.segment.yml +8 -0
  10. data/data/segments/dtm.segment.yml +1 -0
  11. data/data/segments/fob.segment.yml +8 -0
  12. data/data/segments/itd.segment.yml +13 -0
  13. data/data/segments/mtx.segment.yml +7 -0
  14. data/data/segments/n9.segment.yml +7 -0
  15. data/data/segments/per.segment.yml +13 -0
  16. data/data/segments/po1.segment.yml +6 -0
  17. data/data/segments/po3.segment.yml +13 -0
  18. data/data/segments/qty.segment.yml +10 -0
  19. data/data/segments/ref.segment.yml +1 -0
  20. data/data/segments/sac.segment.yml +4 -0
  21. data/data/segments/sch.segment.yml +7 -0
  22. data/data/segments/sdq.segment.yml +8 -0
  23. data/data/segments/txi.segment.yml +9 -0
  24. data/data/transaction_sets/810.edi.yml +93 -0
  25. data/data/transaction_sets/846.edi.yml +57 -0
  26. data/data/transaction_sets/850.edi.yml +73 -0
  27. data/data/transaction_sets/855.edi.yml +74 -0
  28. data/data/transaction_sets/856.edi.yml +54 -0
  29. data/eddy.gemspec +1 -1
  30. data/exe/eddy +1 -0
  31. data/lib/definitions/elements/generated/100.currency_code.rb +200 -0
  32. data/lib/definitions/elements/generated/146.shipment_method_of_payment.rb +65 -0
  33. data/lib/definitions/elements/generated/1551.message_text.rb +29 -0
  34. data/lib/definitions/elements/generated/280.exchange_rate.rb +29 -0
  35. data/lib/definitions/elements/generated/309.location_qualifier.rb +209 -0
  36. data/lib/definitions/elements/generated/310.location_identifier.rb +29 -0
  37. data/lib/definitions/elements/generated/311.shipment_type_code.rb +42 -0
  38. data/lib/definitions/elements/generated/322.load_empty_status_code.rb +40 -0
  39. data/lib/definitions/elements/generated/325.tax_identification_number.rb +29 -0
  40. data/lib/definitions/elements/generated/333.terms_basis_date_code.rb +44 -0
  41. data/lib/definitions/elements/generated/336.terms_type_code.rb +102 -0
  42. data/lib/definitions/elements/generated/338.terms_discount_percent.rb +29 -0
  43. data/lib/definitions/elements/generated/351.terms_discount_days_due.rb +30 -0
  44. data/lib/definitions/elements/generated/363.note_reference_code.rb +278 -0
  45. data/lib/definitions/elements/generated/364.communication_number.rb +29 -0
  46. data/lib/definitions/elements/generated/365.communication_number_qualifier.rb +77 -0
  47. data/lib/definitions/elements/generated/366.contact_function_code.rb +267 -0
  48. data/lib/definitions/elements/generated/369.free_form_description.rb +29 -0
  49. data/lib/definitions/elements/generated/370.terms_discount_due_date.rb +29 -0
  50. data/lib/definitions/elements/generated/371.change_reason_code.rb +67 -0
  51. data/lib/definitions/elements/generated/378.allowance_charge_percent_qualifier.rb +48 -0
  52. data/lib/definitions/elements/generated/386.terms_net_days.rb +30 -0
  53. data/lib/definitions/elements/generated/446.terms_net_due_date.rb +29 -0
  54. data/lib/definitions/elements/generated/522.amount_qualifier_code.rb +1510 -0
  55. data/lib/definitions/elements/generated/673.quantity_qualifier.rb +869 -0
  56. data/lib/definitions/elements/generated/755.report_type_code.rb +559 -0
  57. data/lib/definitions/elements/generated/954.percent.rb +29 -0
  58. data/lib/definitions/elements/generated/963.tax_type_code.rb +111 -0
  59. data/lib/definitions/elements/manual/156.state_or_province_code.rb +16 -1
  60. data/lib/definitions/elements/manual/i/I10.interchange_control_standards_identifier.rb +2 -2
  61. data/lib/definitions/elements/manual/i/I11.interchange_control_version_number.rb +1 -0
  62. data/lib/definitions/segments/generated/amt.rb +56 -0
  63. data/lib/definitions/segments/generated/bia.rb +107 -0
  64. data/lib/definitions/segments/generated/cur.rb +73 -0
  65. data/lib/definitions/segments/generated/dtm.rb +17 -0
  66. data/lib/definitions/segments/generated/fob.rb +73 -0
  67. data/lib/definitions/segments/generated/hl.rb +90 -0
  68. data/lib/definitions/segments/generated/itd.rb +158 -0
  69. data/lib/definitions/segments/generated/mtx.rb +56 -0
  70. data/lib/definitions/segments/generated/n2.rb +56 -0
  71. data/lib/definitions/segments/generated/n9.rb +56 -0
  72. data/lib/definitions/segments/generated/per.rb +158 -0
  73. data/lib/definitions/segments/generated/po1.rb +102 -0
  74. data/lib/definitions/segments/generated/po3.rb +158 -0
  75. data/lib/definitions/segments/generated/qty.rb +73 -0
  76. data/lib/definitions/segments/generated/ref.rb +17 -0
  77. data/lib/definitions/segments/generated/sac.rb +68 -0
  78. data/lib/definitions/segments/generated/sch.rb +56 -0
  79. data/lib/definitions/segments/generated/sdq.rb +73 -0
  80. data/lib/definitions/segments/generated/txi.rb +90 -0
  81. data/lib/definitions/transaction_sets/manual/846/846.rb +122 -0
  82. data/lib/definitions/transaction_sets/manual/846/loops/lin.rb +155 -0
  83. data/lib/definitions/transaction_sets/manual/846/loops/n1.rb +107 -0
  84. data/lib/definitions/transaction_sets/manual/846/loops/qty.rb +75 -0
  85. data/lib/definitions/transaction_sets/manual/846/loops/sch.rb +59 -0
  86. data/lib/definitions/transaction_sets/manual/846/loops/sln.rb +59 -0
  87. data/lib/definitions/transaction_sets/manual/850/850.rb +108 -1
  88. data/lib/definitions/transaction_sets/manual/850/loops/ctp.rb +47 -0
  89. data/lib/definitions/transaction_sets/manual/850/loops/n1.rb +31 -10
  90. data/lib/definitions/transaction_sets/manual/850/loops/n9.rb +59 -0
  91. data/lib/definitions/transaction_sets/manual/850/loops/pid.rb +47 -0
  92. data/lib/definitions/transaction_sets/manual/850/loops/po1.rb +78 -10
  93. data/lib/definitions/transaction_sets/manual/850/loops/sac.rb +47 -0
  94. data/lib/eddy.rb +49 -3
  95. data/lib/eddy/build/transaction_set_builder.rb +1 -1
  96. data/lib/eddy/config.rb +0 -21
  97. data/lib/eddy/data.rb +0 -40
  98. data/lib/eddy/data/persistence/base.rb +5 -11
  99. data/lib/eddy/data/persistence/memory.rb +14 -22
  100. data/lib/eddy/errors.rb +13 -9
  101. data/lib/eddy/models/element/composite.rb +2 -0
  102. data/lib/eddy/models/element/id.rb +1 -1
  103. data/lib/eddy/models/element/r.rb +1 -0
  104. data/lib/eddy/models/functional_group.rb +3 -2
  105. data/lib/eddy/models/interchange.rb +5 -1
  106. data/lib/eddy/parse.rb +4 -56
  107. data/lib/eddy/parse/interchange.rb +58 -0
  108. data/lib/eddy/summary/loop.rb +1 -1
  109. data/lib/eddy/summary/segment.rb +2 -1
  110. data/lib/eddy/version.rb +1 -1
  111. metadata +78 -5
@@ -14,10 +14,12 @@ module Eddy
14
14
  @name = "Reference Identification"
15
15
  @ref01 = Eddy::Elements::E128.new(ref: "REF01", req: "M")
16
16
  @ref02 = Eddy::Elements::E127.new(ref: "REF02", req: "X")
17
+ @ref03 = Eddy::Elements::E352.new(ref: "REF03", req: "X")
17
18
  super(
18
19
  store,
19
20
  @ref01,
20
21
  @ref02,
22
+ @ref03,
21
23
  )
22
24
  end
23
25
 
@@ -51,6 +53,21 @@ module Eddy
51
53
  end
52
54
  alias ReferenceIdentification= REF02=
53
55
 
56
+ # ### REF03
57
+ #
58
+ # - Id: 352
59
+ # - Name: Description
60
+ # - Type: AN
61
+ # - Min/Max: 1/80
62
+ # - Description: A free-form description to clarify the related data elements and their content
63
+ #
64
+ # @param arg [String]
65
+ # @return [void]
66
+ def REF03=(arg)
67
+ @ref03.value = arg
68
+ end
69
+ alias Description= REF03=
70
+
54
71
  end
55
72
  end
56
73
  end
@@ -17,6 +17,10 @@ module Eddy
17
17
  @sac03 = Eddy::Elements::E559.new(ref: "SAC03", req: "X")
18
18
  @sac04 = Eddy::Elements::E1301.new(ref: "SAC04", req: "X")
19
19
  @sac05 = Eddy::Elements::E610.new(ref: "SAC05", req: "O")
20
+ @sac06 = Eddy::Elements::E378.new(ref: "SAC06", req: "X")
21
+ @sac07 = Eddy::Elements::E322.new(ref: "SAC07", req: "X")
22
+ @sac12 = Eddy::Elements::E311.new(ref: "SAC12", req: "O")
23
+ @sac15 = Eddy::Elements::E352.new(ref: "SAC15", req: "X")
20
24
  super(
21
25
  store,
22
26
  @sac01,
@@ -24,6 +28,10 @@ module Eddy
24
28
  @sac03,
25
29
  @sac04,
26
30
  @sac05,
31
+ @sac06,
32
+ @sac07,
33
+ @sac12,
34
+ @sac15,
27
35
  )
28
36
  end
29
37
 
@@ -102,6 +110,66 @@ module Eddy
102
110
  end
103
111
  alias Amount= SAC05=
104
112
 
113
+ # ### SAC06
114
+ #
115
+ # - Id: 378
116
+ # - Name: Allowance/Charge Percent Qualifier
117
+ # - Type: ID
118
+ # - Min/Max: 1/1
119
+ # - Description: Code indicating on what basis allowance or charge percent is calculated
120
+ #
121
+ # @param arg [String]
122
+ # @return [void]
123
+ def SAC06=(arg)
124
+ @sac06.value = arg
125
+ end
126
+ alias AllowanceChargePercentQualifier= SAC06=
127
+
128
+ # ### SAC07
129
+ #
130
+ # - Id: 322
131
+ # - Name: Load/Empty Status Code
132
+ # - Type: ID
133
+ # - Min/Max: 1/1
134
+ # - Description: Code which specifies the loaded condition of transportation equipment
135
+ #
136
+ # @param arg [String]
137
+ # @return [void]
138
+ def SAC07=(arg)
139
+ @sac07.value = arg
140
+ end
141
+ alias LoadEmptyStatusCode= SAC07=
142
+
143
+ # ### SAC12
144
+ #
145
+ # - Id: 311
146
+ # - Name: Shipment Type Code
147
+ # - Type: ID
148
+ # - Min/Max: 1/2
149
+ # - Description: Code identifying shipment type
150
+ #
151
+ # @param arg [String]
152
+ # @return [void]
153
+ def SAC12=(arg)
154
+ @sac12.value = arg
155
+ end
156
+ alias ShipmentTypeCode= SAC12=
157
+
158
+ # ### SAC15
159
+ #
160
+ # - Id: 352
161
+ # - Name: Description
162
+ # - Type: AN
163
+ # - Min/Max: 1/80
164
+ # - Description: A free-form description to clarify the related data elements and their content
165
+ #
166
+ # @param arg [String]
167
+ # @return [void]
168
+ def SAC15=(arg)
169
+ @sac15.value = arg
170
+ end
171
+ alias Description= SAC15=
172
+
105
173
  end
106
174
  end
107
175
  end
@@ -0,0 +1,56 @@
1
+ module Eddy
2
+ module Segments
3
+ # ### Segment Summary:
4
+ #
5
+ # - Id: SCH
6
+ # - Name: Line Item Schedule
7
+ # - Purpose: To specify the data for scheduling a specific line-item
8
+ class SCH < Eddy::Models::Segment
9
+
10
+ # @param store [Eddy::Data::Store]
11
+ # @return [void]
12
+ def initialize(store)
13
+ @id = "SCH"
14
+ @name = "Line Item Schedule"
15
+ @sch01 = Eddy::Elements::E380.new(ref: "SCH01", req: "M")
16
+ @sch03 = Eddy::Elements::E98.new(ref: "SCH03", req: "O")
17
+ super(
18
+ store,
19
+ @sch01,
20
+ @sch03,
21
+ )
22
+ end
23
+
24
+ # ### SCH01
25
+ #
26
+ # - Id: 380
27
+ # - Name: Quantity
28
+ # - Type: R
29
+ # - Min/Max: 1/15
30
+ # - Description: Numeric value of quantity
31
+ #
32
+ # @param arg [Float]
33
+ # @return [void]
34
+ def SCH01=(arg)
35
+ @sch01.value = arg
36
+ end
37
+ alias Quantity= SCH01=
38
+
39
+ # ### SCH03
40
+ #
41
+ # - Id: 98
42
+ # - Name: Entity Identifier Code
43
+ # - Type: ID
44
+ # - Min/Max: 2/3
45
+ # - Description: Code identifying an organizational entity, a physical location, property or an individual
46
+ #
47
+ # @param arg [String]
48
+ # @return [void]
49
+ def SCH03=(arg)
50
+ @sch03.value = arg
51
+ end
52
+ alias EntityIdentifierCode= SCH03=
53
+
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,73 @@
1
+ module Eddy
2
+ module Segments
3
+ # ### Segment Summary:
4
+ #
5
+ # - Id: SDQ
6
+ # - Name: Destination Quantity
7
+ # - Purpose: To specify destination and quantity detail
8
+ class SDQ < Eddy::Models::Segment
9
+
10
+ # @param store [Eddy::Data::Store]
11
+ # @return [void]
12
+ def initialize(store)
13
+ @id = "SDQ"
14
+ @name = "Destination Quantity"
15
+ @sdq01 = Eddy::Elements::E355.new(ref: "SDQ01", req: "M")
16
+ @sdq02 = Eddy::Elements::E66.new(ref: "SDQ02", req: "O")
17
+ @sdq23 = Eddy::Elements::E310.new(ref: "SDQ23", req: "O")
18
+ super(
19
+ store,
20
+ @sdq01,
21
+ @sdq02,
22
+ @sdq23,
23
+ )
24
+ end
25
+
26
+ # ### SDQ01
27
+ #
28
+ # - Id: 355
29
+ # - Name: Unit or Basis for Measurement Code
30
+ # - Type: ID
31
+ # - Min/Max: 2/2
32
+ # - Description: Code specifying the units in which a value is being expressed, or manner in which a measurement has been taken
33
+ #
34
+ # @param arg [String]
35
+ # @return [void]
36
+ def SDQ01=(arg)
37
+ @sdq01.value = arg
38
+ end
39
+ alias UnitOrBasisForMeasurementCode= SDQ01=
40
+
41
+ # ### SDQ02
42
+ #
43
+ # - Id: 66
44
+ # - Name: Identification Code Qualifier
45
+ # - Type: ID
46
+ # - Min/Max: 1/2
47
+ # - Description: Code designating the system/method of code structure used for Identification Code (67)
48
+ #
49
+ # @param arg [String]
50
+ # @return [void]
51
+ def SDQ02=(arg)
52
+ @sdq02.value = arg
53
+ end
54
+ alias IdentificationCodeQualifier= SDQ02=
55
+
56
+ # ### SDQ23
57
+ #
58
+ # - Id: 310
59
+ # - Name: Location Identifier
60
+ # - Type: AN
61
+ # - Min/Max: 1/30
62
+ # - Description: Code which identifies a specific location
63
+ #
64
+ # @param arg [String]
65
+ # @return [void]
66
+ def SDQ23=(arg)
67
+ @sdq23.value = arg
68
+ end
69
+ alias LocationIdentifier= SDQ23=
70
+
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,90 @@
1
+ module Eddy
2
+ module Segments
3
+ # ### Segment Summary:
4
+ #
5
+ # - Id: TXI
6
+ # - Name: Tax Information
7
+ # - Purpose: To specify tax information.
8
+ class TXI < Eddy::Models::Segment
9
+
10
+ # @param store [Eddy::Data::Store]
11
+ # @return [void]
12
+ def initialize(store)
13
+ @id = "TXI"
14
+ @name = "Tax Information"
15
+ @txi01 = Eddy::Elements::E963.new(ref: "TXI01", req: "M")
16
+ @txi02 = Eddy::Elements::E782.new(ref: "TXI02", req: "X")
17
+ @txi03 = Eddy::Elements::E954.new(ref: "TXI03", req: "X")
18
+ @txi09 = Eddy::Elements::E325.new(ref: "TXI09", req: "O")
19
+ super(
20
+ store,
21
+ @txi01,
22
+ @txi02,
23
+ @txi03,
24
+ @txi09,
25
+ )
26
+ end
27
+
28
+ # ### TXI01
29
+ #
30
+ # - Id: 963
31
+ # - Name: Tax Type Code
32
+ # - Type: ID
33
+ # - Min/Max: 2/2
34
+ # - Description: Code specifying the type of tax
35
+ #
36
+ # @param arg [String]
37
+ # @return [void]
38
+ def TXI01=(arg)
39
+ @txi01.value = arg
40
+ end
41
+ alias TaxTypeCode= TXI01=
42
+
43
+ # ### TXI02
44
+ #
45
+ # - Id: 782
46
+ # - Name: Monetary Amount
47
+ # - Type: R
48
+ # - Min/Max: 1/18
49
+ # - Description: Monetary amount
50
+ #
51
+ # @param arg [Float]
52
+ # @return [void]
53
+ def TXI02=(arg)
54
+ @txi02.value = arg
55
+ end
56
+ alias MonetaryAmount= TXI02=
57
+
58
+ # ### TXI03
59
+ #
60
+ # - Id: 954
61
+ # - Name: Percent
62
+ # - Type: R
63
+ # - Min/Max: 1/10
64
+ # - Description: Percentage expressed as a decimal
65
+ #
66
+ # @param arg [Float]
67
+ # @return [void]
68
+ def TXI03=(arg)
69
+ @txi03.value = arg
70
+ end
71
+ alias Percent= TXI03=
72
+
73
+ # ### TXI09
74
+ #
75
+ # - Id: 325
76
+ # - Name: Tax Identification Number
77
+ # - Type: AN
78
+ # - Min/Max: 1/20
79
+ # - Description: Number assigned to a purchaser (buyer, orderer) by a taxing jurisdiction (state, county, etc.); often called a tax exemption number or certificate number
80
+ #
81
+ # @param arg [String]
82
+ # @return [void]
83
+ def TXI09=(arg)
84
+ @txi09.value = arg
85
+ end
86
+ alias TaxIdentificationNumber= TXI09=
87
+
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,122 @@
1
+ module Eddy
2
+ module TransactionSets
3
+ module TS846
4
+ # ### Transaction Set Summary:
5
+ #
6
+ # - Id: 846
7
+ # - Name: Inventory Inquiry/Advice
8
+ # - Functional Group: IB
9
+ class TS846 < Eddy::Models::TransactionSet
10
+
11
+ ID = "846".freeze
12
+ NAME = "Inventory Inquiry/Advice".freeze
13
+ FUNCTIONAL_GROUP = "IB".freeze
14
+
15
+ # @param store [Eddy::Data::Store]
16
+ # @return [void]
17
+ def initialize(store)
18
+ @bia = Eddy::Segments::BIA.new(store)
19
+ @cur = Eddy::Segments::CUR.new(store)
20
+ @dtm = Eddy::Segments::DTM.new(store)
21
+ @ref = Eddy::Segments::REF.new(store)
22
+ @per = Eddy::Segments::PER.new(store)
23
+ @l_n1 = Eddy::TransactionSets::TS846::Loops::N1::Base.new(store)
24
+ @l_lin = Eddy::TransactionSets::TS846::Loops::LIN::Base.new(store)
25
+ @ctt = Eddy::Segments::CTT.new(store)
26
+ super(
27
+ store,
28
+ @bia,
29
+ @cur,
30
+ @dtm,
31
+ @ref,
32
+ @per,
33
+ @l_n1,
34
+ @l_lin,
35
+ @ctt,
36
+ )
37
+ end
38
+
39
+ # (see Eddy::Segments::BIA)
40
+ #
41
+ # @yieldparam [Eddy::Segments::BIA]
42
+ # @return [Eddy::Segments::BIA]
43
+ def BIA()
44
+ yield(@bia) if block_given?
45
+ return @bia
46
+ end
47
+
48
+ # (see Eddy::Segments::CUR)
49
+ #
50
+ # @yieldparam [Eddy::Segments::CUR]
51
+ # @return [Eddy::Segments::CUR]
52
+ def CUR()
53
+ yield(@cur) if block_given?
54
+ return @cur
55
+ end
56
+
57
+ # (see Eddy::Segments::DTM)
58
+ #
59
+ # @yieldparam [Eddy::Segments::DTM]
60
+ # @return [Eddy::Segments::DTM]
61
+ def DTM()
62
+ yield(@dtm) if block_given?
63
+ return @dtm
64
+ end
65
+
66
+ # (see Eddy::Segments::REF)
67
+ #
68
+ # @yieldparam [Eddy::Segments::REF]
69
+ # @return [Eddy::Segments::REF]
70
+ def REF()
71
+ yield(@ref) if block_given?
72
+ return @ref
73
+ end
74
+
75
+ # (see Eddy::Segments::PER)
76
+ #
77
+ # @yieldparam [Eddy::Segments::PER]
78
+ # @return [Eddy::Segments::PER]
79
+ def PER()
80
+ yield(@per) if block_given?
81
+ return @per
82
+ end
83
+
84
+ # (see Eddy::TransactionSets::TS846::Loops::N1::Base)
85
+ #
86
+ # @yieldparam [Eddy::TransactionSets::TS846::Loops::N1::Repeat]
87
+ # @return [void]
88
+ def L_N1(&block)
89
+ if block_given?
90
+ @l_n1.repeat(&block)
91
+ else
92
+ raise Eddy::Errors::Error, "No block given in loop iteration"
93
+ end
94
+ return nil
95
+ end
96
+
97
+ # (see Eddy::TransactionSets::TS846::Loops::LIN::Base)
98
+ #
99
+ # @yieldparam [Eddy::TransactionSets::TS846::Loops::LIN::Repeat]
100
+ # @return [void]
101
+ def L_LIN(&block)
102
+ if block_given?
103
+ @l_lin.repeat(&block)
104
+ else
105
+ raise Eddy::Errors::Error, "No block given in loop iteration"
106
+ end
107
+ return nil
108
+ end
109
+
110
+ # (see Eddy::Segments::CTT)
111
+ #
112
+ # @yieldparam [Eddy::Segments::CTT]
113
+ # @return [Eddy::Segments::CTT]
114
+ def CTT()
115
+ yield(@ctt) if block_given?
116
+ return @ctt
117
+ end
118
+
119
+ end
120
+ end
121
+ end
122
+ end