agris 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7858ee0c5eb1c3058b8af68342f76d1ff70e822d1e4a4fe8f441aaf1dc53483
4
- data.tar.gz: 3d681210bed7df9e36dc5ef613f19b0e946072faef0ab22f2e44a06686de29e3
3
+ metadata.gz: fb6a00f60484f228102da6c6b39aca2cc26057a5e4dba778ac28dea63e214e0a
4
+ data.tar.gz: 24a8b68a3c83a6f5b339ec0e491fd37664f26743476cca81f53ccbe7872520db
5
5
  SHA512:
6
- metadata.gz: 58c4086d2afcb13fc9c897c3415a0feed77336cc31bbe3b9817ad808065067f2c424f2907ec2195c6f3173e54ca998830da3ca48d91af9b2e31603343f78f73c
7
- data.tar.gz: 6fec59796e43d413239ca3db3a8f06f40581ab4795cc5fb1b60b755af1cbe55f46a26934931b531aa5d69dbe23d9734fcc347f33c33a75f99af550ae2bb818e5
6
+ metadata.gz: 5be6658248ae55cffa67b8a125a13e460b47b00d598721f8f94f3eb2cae6a7112ae8fd092f14b6902d4fc734e0f28624f1fd83e73ef38ead6398e949f3bdde82
7
+ data.tar.gz: 1b2784b44bf070775452801c629b065343d28a7083f990d1f589f7780ef46d0207138c0a6b49e3e2ef8122f478ba0597985d26d9b7fa1758d75883149e2c1f23
data/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@ version number — see [docs/RELEASING.md](docs/RELEASING.md). Raising that floo
10
10
  is a breaking change and takes a major bump; adding support for a newer Ruby
11
11
  takes none.
12
12
 
13
+ ## [Unreleased]
14
+
15
+ ## [1.1.0] - 2026-09-22
16
+
17
+ ### Added
18
+
19
+ - `Api::NewVoucher::FreightTicketReferenceDetail`, the `ACPV3` voucher detail
20
+ that references the grain ticket whose freight an FV voucher pays. AGRIS
21
+ stamps the ticket with the voucher number on import. (#58)
22
+
13
23
  ## [1.0.0] - 2026-09-14
14
24
 
15
25
  First release since `v0.19.0`. The `1.0.0` bump declares the public API stable
@@ -76,4 +86,6 @@ Releases up to and including `v0.19.0` predate this changelog. See the
76
86
  [commit history](https://github.com/westernmilling/agris.rb/commits/master)
77
87
  and [release tags](https://github.com/westernmilling/agris.rb/tags).
78
88
 
89
+ [Unreleased]: https://github.com/westernmilling/agris.rb/compare/v1.1.0...HEAD
90
+ [1.1.0]: https://github.com/westernmilling/agris.rb/compare/v1.0.0...v1.1.0
79
91
  [1.0.0]: https://github.com/westernmilling/agris.rb/compare/v0.19.0...v1.0.0
data/agris.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'savon', '~> 2.11'
25
25
 
26
26
  spec.add_development_dependency 'bundler', '>= 2.3'
27
+ spec.add_development_dependency 'factory_bot', '~> 6.4'
27
28
  spec.add_development_dependency 'pry-byebug'
28
29
  spec.add_development_dependency 'rake', '~> 12.3.3'
29
30
  spec.add_development_dependency 'rspec', '~> 3.0'
data/docs/specs/README.md CHANGED
@@ -1,26 +1,24 @@
1
1
  # Specs
2
2
 
3
- Source of truth for behavior in the `agris` gem. Implementation, tests, and PRs trace back to spec IDs (R#, E#, AC-#, AT#).
3
+ Specs in this repo are **build prompts**: short, point-in-time briefs for one PR. The code is
4
+ the source of truth; a prompt records what a slice was asked to deliver and is not updated
5
+ after review. Divergence between prompt and merged code is an expected record of what review
6
+ corrected.
4
7
 
5
- ## How to add a spec
6
- 1. Copy `spec-template.md` into the appropriate area folder (see below).
7
- 2. Name the file by feature, kebab-case (e.g., `import-grain-ticket.md`).
8
- 3. Fill in Goal → Rules → Acceptance Criteria → Acceptance Tests.
9
- 4. Reference spec IDs in commits, tests, and PR descriptions.
8
+ Standing facts (Agris behaviour, business rules, spike results) live in Jira and Confluence and
9
+ are cited, not repeated. A prompt states only what is specific to its slice.
10
10
 
11
- ## Layout
11
+ ## Writing one
12
+ 1. Name the file for the Jira task the PR delivers: `docs/specs/<key>-<slug>.md`
13
+ (e.g. `ot3-257-freight-ticket-reference.md`).
14
+ 2. Keep it to roughly 25–45 lines: **Goal** (2–3 sentences), **Scope** stated positively
15
+ ("Exactly: …" plus one "Later: …" line), **Rules** (R#, MUST / MUST NOT), **Acceptance
16
+ criteria** (AC#, the complete test list), and **Slice-specific notes** for gotchas.
17
+ 3. Note the diff budget (≤200 lines) and split before dispatch if the estimate is over.
18
+ 4. Commit it with the PR as a `docs(specs):` commit and paste it into the PR description
19
+ in a collapsed `<details>` block titled "Build prompt (frozen — not updated after review)".
20
+ 5. Cite R# and AC# in commit bodies and the PR's test checklist. Do not put spec IDs or
21
+ paths in code or test comments.
12
22
 
13
- Specs are grouped by Agris API area, mirroring `lib/agris/api/`:
14
-
15
- - `grain/` — tickets, contracts (purchase/sales), commodity codes, grade factors, rates
16
- - `inventory/` — delivery tickets, orders
17
- - `accounts-payables/` — voucher posting
18
- - `accounts-receivables/` — invoice posting
19
- - `messages/` — document-tracking and "changed since" queries
20
- - `support/` — support / utility messages
21
-
22
- Cross-cutting specs (config, transport, error model) can live at the top level of `docs/specs/`.
23
-
24
- ## Templates
25
- - `spec-template.md` — blank template, copy this.
26
- - `rename-folder.example.md` — completed example showing the expected level of detail.
23
+ `spec-template.md` and `rename-folder.example.md` are the retired long-form house format,
24
+ kept for reference only. The area folders (`grain/`, `inventory/`, …) are unused by prompts.
@@ -0,0 +1,48 @@
1
+ # Build Prompt — OT3-257: ACPV3 freight ticket reference detail
2
+
3
+ Jira: OT3-255 task OT3-257 · 2026-09-16 · Budget ≤200.
4
+ Condensed after the build from the house-format spec this PR first carried; rules and ACs
5
+ match the shipped code. Standing facts live in Jira OT3-256 (staging spike, 2026-09-14) and
6
+ the BRD "Freight Voucher via Agris API" (Confluence, SD space) and are not repeated here.
7
+
8
+ ## Goal
9
+ Let a consumer post an AGRIS accounts-payable freight voucher (type FV) that references the
10
+ grain ticket it pays. AGRIS 22.3.0 SU5 or later (AGS-17887) stamps the voucher number on the
11
+ ticket and drops it from the unpaid Freight Expenses population. The gem gains the ACPV3
12
+ detail record; contracto wires it into vouchers in OT3-259.
13
+
14
+ ## Scope
15
+ Exactly: `Agris::Api::NewVoucher::FreightTicketReferenceDetail` in `lib/agris/api/new_voucher.rb`,
16
+ its RSpec file, a `NewVoucher` RSpec file for mixed details, this prompt, and an `Unreleased`
17
+ changelog line. Later: the 1.1.0 bump and dated changelog heading (release PR); consumer-side
18
+ rules in contracto's `docs/specs/freight-conventions.md` (OT3-258).
19
+
20
+ ## Rules
21
+ - R1 — includes `XmlModel`; `ATTRIBUTE_NAMES` is exactly `in_out_code`, `ticket_location`,
22
+ `ticket_number`, `freight_amount`, `record_type`; `attr_reader(*ATTRIBUTE_NAMES)` as on
23
+ `NewVoucher` and `NewDisbursement`.
24
+ - R2 — `record_type` is always `'ACPV3'`; a value passed to the constructor is overwritten.
25
+ - R3 — `to_xml_hash` emits `:@recordtype => 'ACPV3'` plus `:@inoutcode`, `:@ticketlocation`,
26
+ `:@ticketnumber`, `:@freightamount` for whichever attributes were supplied, values untouched.
27
+ An omitted attribute emits no key (existing `XmlModel` behaviour; AGRIS decides validity).
28
+ - R4 — `NewVoucher#add_detail` needs no change: a voucher holding a `GeneralLedgerDetail` and
29
+ this detail serializes both, in insertion order, each under its own record type.
30
+ - R5 — MUST NOT validate AGRIS-side rules (ACPV3 sum equals voucher amount, shipper equals
31
+ remit-to, an ACPV2 line present). AGRIS reports those in-band via `PostResult#reject_reasons`.
32
+
33
+ ## Acceptance criteria (the complete test list)
34
+ - AC-1 — `record_type` defaults to ACPV3; `record_type: 'OTHER'` still reads and serializes ACPV3.
35
+ - AC-2 — all four attributes supplied (I / 051 / 0028786 / 230.85, the spike's ticket): readers
36
+ return the inputs; `to_xml_hash` equals exactly the five-key hash.
37
+ - AC-3 — only `ticket_number` supplied: the other readers return nil; hash keys are exactly
38
+ `:@ticketnumber` and `:@recordtype`.
39
+ - AC-4 — `ATTRIBUTE_NAMES` lists exactly the five names.
40
+ - AC-5 — `NewVoucher` with one GL detail then one ACPV3 detail: `details` in insertion order,
41
+ record types `%w(ACPV2 ACPV3)`, header `to_xml_hash` excludes the details.
42
+
43
+ ## Slice-specific notes
44
+ - The two older detail classes have no readers and are left alone.
45
+ - No spec IDs or paths in code or test comments (Coding Style Rules §2.4); traceability is this
46
+ prompt plus the PR checklist.
47
+ - Wire shape confirmed by rendering the real `create_voucher` payload: the ACPV3 element lands
48
+ flat inside `<details>` beside ACPV0 and ACPV2.
@@ -106,6 +106,26 @@ module Agris
106
106
  @record_type = 'ACPV1'
107
107
  end
108
108
  end
109
+
110
+ class FreightTicketReferenceDetail
111
+ include XmlModel
112
+
113
+ ATTRIBUTE_NAMES = %w(
114
+ in_out_code
115
+ ticket_location
116
+ ticket_number
117
+ freight_amount
118
+ record_type
119
+ ).freeze
120
+
121
+ attr_reader(*ATTRIBUTE_NAMES)
122
+
123
+ def initialize(hash = {})
124
+ super
125
+
126
+ @record_type = 'ACPV3'
127
+ end
128
+ end
109
129
  end
110
130
  end
111
131
  end
data/lib/agris/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Agris
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Gray
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2026-09-14 00:00:00.000000000 Z
12
+ date: 2026-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '2.3'
42
+ - !ruby/object:Gem::Dependency
43
+ name: factory_bot
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '6.4'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '6.4'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: pry-byebug
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -184,6 +198,7 @@ files:
184
198
  - docs/specs/grain/.gitkeep
185
199
  - docs/specs/inventory/.gitkeep
186
200
  - docs/specs/messages/.gitkeep
201
+ - docs/specs/ot3-257-freight-ticket-reference.md
187
202
  - docs/specs/rename-folder.example.md
188
203
  - docs/specs/spec-template.md
189
204
  - docs/specs/support/.gitkeep
@@ -285,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
300
  - !ruby/object:Gem::Version
286
301
  version: '0'
287
302
  requirements: []
288
- rubygems_version: 3.3.7
303
+ rubygems_version: 3.3.27
289
304
  signing_key:
290
305
  specification_version: 4
291
306
  summary: Ruby client library for Agris API