xero-kiwi 0.5.2 → 0.6.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 +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +36 -0
- data/docs/accounting/credit-note.md +1 -1
- data/docs/accounting/overpayment.md +1 -1
- data/docs/accounting/prepayment.md +1 -1
- data/lib/xero_kiwi/accounting/allocation.rb +19 -5
- data/lib/xero_kiwi/version.rb +1 -1
- data/llms-full.txt +39 -3
- data/llms.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3c9271654c527275c19a5738effb1f5d334844a14898eaf467fc6671fbc308a
|
|
4
|
+
data.tar.gz: 0645a88a9ccd58130524e24d9981f3999b74ddf8ee98af9600a73f45cda4d29e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74bbf0e97f3207d0aaaa16c85a82fe5c1f8572ef10c3c5d802ed2b051538ad002c9aae5df62da3f9ffd7aa76e64d4446a33cfcb98ac5d9eec3edc2f6a143d1bb
|
|
7
|
+
data.tar.gz: 32141ab2ffa3f40865a432711e1e6147c99006325e30f633f035790ab1ffefd085021eda40d5f2e22621eda084fb34174691fe6c65c405497ab7452106c9aa69
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.6.0] - 2026-09-27
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **`Accounting::Allocation#amount` always returned nil.** It was mapped to Xero's `"Amount"`, which is the key for the allocation *request* body. Every response — and allocations only ever reach this gem embedded in a CreditNote, Prepayment or Overpayment response — carries `"AppliedAmount"`. The allocated value is now modelled as **`applied_amount`**, and `#amount` is an alias of it so callers who reached for the obvious name get the value they meant. Nothing that depended on a real value is affected, because there was never one to depend on.
|
|
8
|
+
|
|
9
|
+
This mattered more than a missing field usually would: `allocations.map(&:amount)` returned an array of nils rather than raising, so an importer would have written zeroes into every allocated amount with nothing failing anywhere. Reported by a consumer who checked stored payloads before trusting the typed path.
|
|
10
|
+
|
|
11
|
+
Four spec files had fabricated `"Amount"` payloads and so agreed with the bug instead of catching it; all now use the real response shape.
|
|
12
|
+
|
|
13
|
+
### Breaking
|
|
14
|
+
|
|
15
|
+
- `Allocation#to_h` now carries `:applied_amount` instead of `:amount`, and `:amount` is no longer a declared attribute (it is a plain reader, so one value maps to one key). Anyone reading `to_h[:amount]` was reading nil.
|
|
16
|
+
|
|
17
|
+
### Documentation
|
|
18
|
+
|
|
19
|
+
- The README now documents the release process. It covered running specs but said nothing about cutting a release, so the sequencing lived only in one person's head. It leads with the rule and the reason — `rake release` tags whatever is checked out, so a version bump riding along in a pull request gets orphaned the moment that PR is squash-merged, which is what happened to v0.5.2 — and records the thing that is not guessable from the repo: `docs/` ships inside the gem, so a documentation-only fix still needs a patch release to reach anyone.
|
|
20
|
+
|
|
3
21
|
## [0.5.2] - 2026-09-27
|
|
4
22
|
|
|
5
23
|
### Documentation
|
data/README.md
CHANGED
|
@@ -113,6 +113,42 @@ default `redis://127.0.0.1:6379/15`.
|
|
|
113
113
|
docker compose down # when you're done
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
### Releasing
|
|
117
|
+
|
|
118
|
+
**Merge first, then bump.** `rake release` tags whatever is checked out, so a
|
|
119
|
+
version bump that rides along inside a pull request gets orphaned the moment
|
|
120
|
+
that PR is squash-merged — the squash creates a new commit and the tag is left
|
|
121
|
+
pointing at the pre-merge branch commit, unreachable from `main`. Bumping after
|
|
122
|
+
the merge makes that impossible regardless of merge strategy.
|
|
123
|
+
|
|
124
|
+
So: land the work through a PR as normal, then
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
git checkout main && git pull
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
1. Bump `VERSION` in [lib/xero_kiwi/version.rb](lib/xero_kiwi/version.rb).
|
|
131
|
+
2. Move the `[Unreleased]` entries in [CHANGELOG.md](CHANGELOG.md) under a
|
|
132
|
+
dated version heading.
|
|
133
|
+
3. `bundle install` to refresh the lockfile's `xero-kiwi (x.y.z)`.
|
|
134
|
+
4. `bundle exec rake` — specs, RuboCop, and the `llms:check` freshness guard.
|
|
135
|
+
5. Commit to `main`. A commit-msg hook requires the `crimesjohnson:` prefix
|
|
136
|
+
there, so: `crimesjohnson: release x.y.z with <the headline>`.
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
bundle exec rake release # builds, tags, pushes the tag, publishes
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The gemspec sets `rubygems_mfa_required`, so this prompts for an OTP and can't
|
|
143
|
+
run unattended. Finally, cut the GitHub release from the changelog section:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
gh release create vx.y.z --title "vx.y.z — <headline>" --notes-file <(…) --verify-tag --latest
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Note that `docs/` ships inside the gem, so a documentation-only fix still needs
|
|
150
|
+
a patch release to reach anyone — it won't arrive through GitHub alone.
|
|
151
|
+
|
|
116
152
|
## Contributing
|
|
117
153
|
|
|
118
154
|
Bug reports and pull requests are welcome on GitHub at
|
|
@@ -61,7 +61,7 @@ fields Xero returns:
|
|
|
61
61
|
| `reference` | `String` | Additional reference number (ACCRECCREDIT only). |
|
|
62
62
|
| `sent_to_contact` | `Boolean` | Whether the credit note has been sent to the contact. |
|
|
63
63
|
| `remaining_credit` | `Numeric` | The remaining credit balance. |
|
|
64
|
-
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each
|
|
64
|
+
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each has `allocation_id`, `applied_amount`, `date`, `is_deleted`, and an `invoice` reference. |
|
|
65
65
|
| `branding_theme_id` | `String` | The branding theme ID applied to the credit note. |
|
|
66
66
|
| `has_attachments` | `Boolean` | Whether the credit note has attachments. |
|
|
67
67
|
|
|
@@ -57,7 +57,7 @@ fields Xero returns:
|
|
|
57
57
|
| `currency_code` | `String` | The currency code (e.g. `"NZD"`). |
|
|
58
58
|
| `currency_rate` | `String` | The currency rate (1.0 for base currency). |
|
|
59
59
|
| `remaining_credit` | `String` | The remaining credit balance. |
|
|
60
|
-
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each
|
|
60
|
+
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each has `allocation_id`, `applied_amount`, `date`, `is_deleted`, and an `invoice` reference. |
|
|
61
61
|
| `payments` | `Array<XeroKiwi::Accounting::Payment>` | Payment records (references). See [Payments](payment.md). |
|
|
62
62
|
| `has_attachments` | `Boolean` | Whether the overpayment has attachments. |
|
|
63
63
|
| `reference` | `String` | Reference for the overpayment. |
|
|
@@ -58,7 +58,7 @@ fields Xero returns:
|
|
|
58
58
|
| `currency_rate` | `String` | The currency rate (1.0 for base currency). |
|
|
59
59
|
| `invoice_number` | `String` | The invoice number (for receive prepayments only). |
|
|
60
60
|
| `remaining_credit` | `String` | The remaining credit balance. |
|
|
61
|
-
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each
|
|
61
|
+
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each has `allocation_id`, `applied_amount`, `date`, `is_deleted`, and an `invoice` reference. |
|
|
62
62
|
| `payments` | `Array<XeroKiwi::Accounting::Payment>` | Payment records (references). See [Payments](payment.md). |
|
|
63
63
|
| `has_attachments` | `Boolean` | Whether the prepayment has attachments. |
|
|
64
64
|
| `fully_paid_on_date` | `Time` | When the prepayment was fully allocated, parsed as UTC. |
|
|
@@ -5,17 +5,31 @@ module XeroKiwi
|
|
|
5
5
|
# Represents an allocation of a credit note, prepayment, or overpayment
|
|
6
6
|
# against an invoice.
|
|
7
7
|
#
|
|
8
|
+
# Xero names the allocated value differently depending on direction: the
|
|
9
|
+
# allocation *request* body takes "Amount", while every *response* — and
|
|
10
|
+
# allocations only ever reach this gem embedded in a CreditNote,
|
|
11
|
+
# Prepayment or Overpayment response — carries "AppliedAmount". This
|
|
12
|
+
# class was originally modelled off the request shape, so `amount`
|
|
13
|
+
# silently returned nil for every allocation the gem could actually
|
|
14
|
+
# produce. `#amount` is now an alias of `#applied_amount` so callers who
|
|
15
|
+
# reached for the obvious name get the value they meant.
|
|
16
|
+
#
|
|
8
17
|
# See: https://developer.xero.com/documentation/api/accounting/overpayments
|
|
9
18
|
class Allocation
|
|
10
19
|
include Resource
|
|
11
20
|
|
|
12
21
|
identity :allocation_id
|
|
13
22
|
|
|
14
|
-
attribute :allocation_id,
|
|
15
|
-
attribute :
|
|
16
|
-
attribute :date,
|
|
17
|
-
attribute :invoice,
|
|
18
|
-
attribute :is_deleted,
|
|
23
|
+
attribute :allocation_id, xero: "AllocationID", type: :guid
|
|
24
|
+
attribute :applied_amount, xero: "AppliedAmount", type: :decimal
|
|
25
|
+
attribute :date, xero: "Date", type: :date
|
|
26
|
+
attribute :invoice, xero: "Invoice", type: :object, of: Invoice, reference: true
|
|
27
|
+
attribute :is_deleted, xero: "IsDeleted", type: :bool
|
|
28
|
+
|
|
29
|
+
# Kept for callers written against the pre-0.6.0 attribute name. It
|
|
30
|
+
# could only ever have returned nil, so nothing that relied on a real
|
|
31
|
+
# value is affected.
|
|
32
|
+
def amount = applied_amount
|
|
19
33
|
end
|
|
20
34
|
end
|
|
21
35
|
end
|
data/lib/xero_kiwi/version.rb
CHANGED
data/llms-full.txt
CHANGED
|
@@ -126,6 +126,42 @@ default `redis://127.0.0.1:6379/15`.
|
|
|
126
126
|
docker compose down # when you're done
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
### Releasing
|
|
130
|
+
|
|
131
|
+
**Merge first, then bump.** `rake release` tags whatever is checked out, so a
|
|
132
|
+
version bump that rides along inside a pull request gets orphaned the moment
|
|
133
|
+
that PR is squash-merged — the squash creates a new commit and the tag is left
|
|
134
|
+
pointing at the pre-merge branch commit, unreachable from `main`. Bumping after
|
|
135
|
+
the merge makes that impossible regardless of merge strategy.
|
|
136
|
+
|
|
137
|
+
So: land the work through a PR as normal, then
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
git checkout main && git pull
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
1. Bump `VERSION` in [lib/xero_kiwi/version.rb](lib/xero_kiwi/version.rb).
|
|
144
|
+
2. Move the `[Unreleased]` entries in [CHANGELOG.md](CHANGELOG.md) under a
|
|
145
|
+
dated version heading.
|
|
146
|
+
3. `bundle install` to refresh the lockfile's `xero-kiwi (x.y.z)`.
|
|
147
|
+
4. `bundle exec rake` — specs, RuboCop, and the `llms:check` freshness guard.
|
|
148
|
+
5. Commit to `main`. A commit-msg hook requires the `crimesjohnson:` prefix
|
|
149
|
+
there, so: `crimesjohnson: release x.y.z with <the headline>`.
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
bundle exec rake release # builds, tags, pushes the tag, publishes
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The gemspec sets `rubygems_mfa_required`, so this prompts for an OTP and can't
|
|
156
|
+
run unattended. Finally, cut the GitHub release from the changelog section:
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
gh release create vx.y.z --title "vx.y.z — <headline>" --notes-file <(…) --verify-tag --latest
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Note that `docs/` ships inside the gem, so a documentation-only fix still needs
|
|
163
|
+
a patch release to reach anyone — it won't arrive through GitHub alone.
|
|
164
|
+
|
|
129
165
|
## Contributing
|
|
130
166
|
|
|
131
167
|
Bug reports and pull requests are welcome on GitHub at
|
|
@@ -2494,7 +2530,7 @@ fields Xero returns:
|
|
|
2494
2530
|
| `reference` | `String` | Additional reference number (ACCRECCREDIT only). |
|
|
2495
2531
|
| `sent_to_contact` | `Boolean` | Whether the credit note has been sent to the contact. |
|
|
2496
2532
|
| `remaining_credit` | `Numeric` | The remaining credit balance. |
|
|
2497
|
-
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each
|
|
2533
|
+
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each has `allocation_id`, `applied_amount`, `date`, `is_deleted`, and an `invoice` reference. |
|
|
2498
2534
|
| `branding_theme_id` | `String` | The branding theme ID applied to the credit note. |
|
|
2499
2535
|
| `has_attachments` | `Boolean` | Whether the credit note has attachments. |
|
|
2500
2536
|
|
|
@@ -2838,7 +2874,7 @@ fields Xero returns:
|
|
|
2838
2874
|
| `currency_code` | `String` | The currency code (e.g. `"NZD"`). |
|
|
2839
2875
|
| `currency_rate` | `String` | The currency rate (1.0 for base currency). |
|
|
2840
2876
|
| `remaining_credit` | `String` | The remaining credit balance. |
|
|
2841
|
-
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each
|
|
2877
|
+
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each has `allocation_id`, `applied_amount`, `date`, `is_deleted`, and an `invoice` reference. |
|
|
2842
2878
|
| `payments` | `Array<XeroKiwi::Accounting::Payment>` | Payment records (references). See [Payments](payment.md). |
|
|
2843
2879
|
| `has_attachments` | `Boolean` | Whether the overpayment has attachments. |
|
|
2844
2880
|
| `reference` | `String` | Reference for the overpayment. |
|
|
@@ -2939,7 +2975,7 @@ fields Xero returns:
|
|
|
2939
2975
|
| `currency_rate` | `String` | The currency rate (1.0 for base currency). |
|
|
2940
2976
|
| `invoice_number` | `String` | The invoice number (for receive prepayments only). |
|
|
2941
2977
|
| `remaining_credit` | `String` | The remaining credit balance. |
|
|
2942
|
-
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each
|
|
2978
|
+
| `allocations` | `Array<XeroKiwi::Accounting::Allocation>` | Allocations to invoices. Each has `allocation_id`, `applied_amount`, `date`, `is_deleted`, and an `invoice` reference. |
|
|
2943
2979
|
| `payments` | `Array<XeroKiwi::Accounting::Payment>` | Payment records (references). See [Payments](payment.md). |
|
|
2944
2980
|
| `has_attachments` | `Boolean` | Whether the prepayment has attachments. |
|
|
2945
2981
|
| `fully_paid_on_date` | `Time` | When the prepayment was fully allocated, parsed as UTC. |
|
data/llms.txt
CHANGED
|
@@ -64,7 +64,7 @@ XeroKiwi requires Ruby 3.4.1 or newer. Install with `gem "xero-kiwi"`.
|
|
|
64
64
|
|
|
65
65
|
## Optional
|
|
66
66
|
|
|
67
|
-
- [README](https://raw.githubusercontent.com/douglasgreyling/xero-kiwi/main/README.md): high-level overview, installation,
|
|
67
|
+
- [README](https://raw.githubusercontent.com/douglasgreyling/xero-kiwi/main/README.md): high-level overview, installation, the documentation table of contents, and the development and release process
|
|
68
68
|
- [Retries and rate limits](https://raw.githubusercontent.com/douglasgreyling/xero-kiwi/main/docs/retries-and-rate-limits.md): how XeroKiwi handles 429s and transient 5xxs, `client.rate_limit(tenant_id)` for remaining quota, tuning the retry policy, the Faraday middleware ordering, why 500 is deliberately not retried
|
|
69
69
|
- [Throttling](https://raw.githubusercontent.com/douglasgreyling/xero-kiwi/main/docs/throttling.md): the Redis-backed per-tenant token bucket for coordinating rate limits across processes, `default_throttle`, `#remaining`, fail-open behaviour, writing a custom limiter
|
|
70
70
|
- [CHANGELOG](https://raw.githubusercontent.com/douglasgreyling/xero-kiwi/main/CHANGELOG.md): version history
|