ksef_client 0.1.0.rc2 → 0.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 +4 -4
- data/CHANGELOG.md +26 -0
- data/README.md +9 -8
- data/lib/ksef/client.rb +26 -2
- data/lib/ksef/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 417315e4a0a7bef0cffda15bbdd96925f6f1e5a20f9a31fd122736c7ec156f27
|
|
4
|
+
data.tar.gz: f78102d55b9da5b25be64bca58e48017b5bb4da1de91b90f01fbce6fe9a27147
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f89a321f6c580dd96e832361c803b9f3cc1fc1844164dea3111e720b1f5955cf5d0ba26de6113cd80a663a55135de1b6dde6472589e5c54f7b020638ceb8594
|
|
7
|
+
data.tar.gz: 568038ebc5f9306e3375eb4039592ebeb7badfc8d34c598f719dc4f5c7be19ebcf0744d5f96eeb2280f8131f2c50d7334b53b9a53b949a215be3d9b3e6bc25b2
|
data/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,8 @@ gem version for which API state".
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.1.0] — 2026-09-14
|
|
14
|
+
|
|
13
15
|
**Targets:** KSeF API 2.0 · FA(3) `1-0E` · upstream `CIRFMF/ksef-api@1c34fe27`,
|
|
14
16
|
`CIRFMF/ksef-client-csharp@406904d6`, `CIRFMF/ksef-pdf-generator@2b7c1dae` (sample corpus,
|
|
15
17
|
`docs/REFERENCE.md` §1.4)
|
|
@@ -25,6 +27,21 @@ gem version for which API state".
|
|
|
25
27
|
> code at all yet, so it is absent rather than stubbed.
|
|
26
28
|
|
|
27
29
|
### Added
|
|
30
|
+
|
|
31
|
+
- **`Ksef::Client#wait_for_session`** — waits until KSeF has finished processing a whole
|
|
32
|
+
session, rather than just closing it.
|
|
33
|
+
|
|
34
|
+
**Closing and finishing are two different clocks.** `#session` closes on the way out, which
|
|
35
|
+
*starts* asynchronous generation of the collective UPO; the session then sits at `170` until
|
|
36
|
+
that completes at `200`. `#wait_until_accepted` does not cover it — an accepted invoice says
|
|
37
|
+
nothing about the session's own progress — so a caller that sends, waits for the invoice and
|
|
38
|
+
then asks for `#collective_upo` is racing.
|
|
39
|
+
|
|
40
|
+
The wait already existed on `Sessions::Status` and simply was not reachable through the
|
|
41
|
+
facade, which left `#collective_upo`'s own documentation instructing callers to poll
|
|
42
|
+
`#session_status` by hand. Two places in this repository did exactly that, and the live one
|
|
43
|
+
got it wrong — see below.
|
|
44
|
+
|
|
28
45
|
- **A recorded flow for the two retrieval paths nothing had ever run**:
|
|
29
46
|
`GET /invoices/ksef/{ksefNumber}` and the pre-signed **storage** leg. All 31 interactions in
|
|
30
47
|
the first three cassettes were on the API host, and none touched `/invoices/ksef/` — so
|
|
@@ -177,6 +194,15 @@ gem version for which API state".
|
|
|
177
194
|
|
|
178
195
|
### Fixed
|
|
179
196
|
|
|
197
|
+
- **The live integration suite asserted a terminal session code without waiting for one**, so
|
|
198
|
+
the nightly of 2026-09-13 went red on a commit that passed on 09-12 and 09-14. It read
|
|
199
|
+
`session_status` once, immediately after `wait_until_accepted`, and required `code >= 200` —
|
|
200
|
+
but `170` means closed with the collective UPO still generating, exactly as
|
|
201
|
+
`SessionCodes`' own documentation says. A race, not a flake: roughly one night in ten on
|
|
202
|
+
this sample, which is enough to reset a three-consecutive-night release gate. It now uses
|
|
203
|
+
the new `Client#wait_for_session`.
|
|
204
|
+
|
|
205
|
+
|
|
180
206
|
- **`json` 3.0.0 broke every API response, for users as well as CI.** json 3 dropped the second
|
|
181
207
|
*positional* argument to `JSON.parse`, and `Faraday::Response::Json#parse` still passes one —
|
|
182
208
|
so every JSON response from KSeF raised
|
data/README.md
CHANGED
|
@@ -88,21 +88,22 @@ submitted.
|
|
|
88
88
|
|
|
89
89
|
## Installation
|
|
90
90
|
|
|
91
|
-
**0.1.0 is not released yet.** Only `0.1.0.rc1` is on RubyGems — a name-claiming
|
|
92
|
-
placeholder that deliberately contains none of the API below — and Bundler will not select a
|
|
93
|
-
prerelease for an unconstrained requirement, so `gem "ksef_client"` fails outright. Until
|
|
94
|
-
0.1.0 ships, install from git:
|
|
95
|
-
|
|
96
91
|
```ruby
|
|
97
|
-
gem "ksef_client"
|
|
92
|
+
gem "ksef_client"
|
|
98
93
|
```
|
|
99
94
|
|
|
100
|
-
|
|
95
|
+
Or track the branch, where fixes land first:
|
|
101
96
|
|
|
102
97
|
```ruby
|
|
103
|
-
gem "ksef_client"
|
|
98
|
+
gem "ksef_client", github: "tibortc/ksef_client"
|
|
104
99
|
```
|
|
105
100
|
|
|
101
|
+
**Not the `0.1.0.rc1` prerelease**, if you go looking. It predates this API — a name-claiming
|
|
102
|
+
placeholder holding the transport layer and nothing else, with no authentication, no FA(3) and
|
|
103
|
+
no sessions. It is still on RubyGems because a published version cannot be withdrawn and
|
|
104
|
+
replaced; the line above will not select it, since Bundler skips prereleases for an
|
|
105
|
+
unconstrained requirement.
|
|
106
|
+
|
|
106
107
|
The gem is named `ksef_client`; the namespace is `Ksef`.
|
|
107
108
|
|
|
108
109
|
```ruby
|
data/lib/ksef/client.rb
CHANGED
|
@@ -159,8 +159,8 @@ module Ksef
|
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
# The collective UPO for a whole session, following the unmetered link when it is still
|
|
162
|
-
# valid. Available only after the session has closed *and* finished processing
|
|
163
|
-
# {#
|
|
162
|
+
# valid. Available only after the session has closed *and* finished processing, so call
|
|
163
|
+
# {#wait_for_session} first — `170` means closed but not done.
|
|
164
164
|
#
|
|
165
165
|
# @param session_reference [String]
|
|
166
166
|
# @return [Array<Ksef::UPO::Document>] one per page; a collective UPO holds at most
|
|
@@ -174,6 +174,30 @@ module Ksef
|
|
|
174
174
|
# @return [Ksef::Sessions::SessionState]
|
|
175
175
|
def session_status(session_reference) = status_client.session(session_reference)
|
|
176
176
|
|
|
177
|
+
# Waits until KSeF has finished processing a whole session.
|
|
178
|
+
#
|
|
179
|
+
# **Closing a session and finishing it are two different clocks.** {#session} closes on
|
|
180
|
+
# the way out, which *starts* asynchronous generation of the collective UPO; the session
|
|
181
|
+
# then sits at `170` until that finishes at `200`. {#wait_until_accepted} does not cover
|
|
182
|
+
# it — an accepted invoice says nothing about the session's own progress — so a caller
|
|
183
|
+
# that sends, waits for the invoice and then asks for {#collective_upo} is racing.
|
|
184
|
+
#
|
|
185
|
+
# This existed on {Sessions::Status} from the start and was simply not reachable through
|
|
186
|
+
# the facade, which left `#collective_upo`'s own documentation telling callers to poll
|
|
187
|
+
# {#session_status} by hand. Two places in this repository did exactly that, and one of
|
|
188
|
+
# them got it wrong: `spec/integration/session_flow_spec.rb` read the status once and
|
|
189
|
+
# asserted a terminal code, which passed until the nightly of 2026-09-13 found TEST still
|
|
190
|
+
# at `170`.
|
|
191
|
+
#
|
|
192
|
+
# @param session_reference [String]
|
|
193
|
+
# @param deadline [Numeric] seconds; defaults to {Sessions::Status::DEFAULT_DEADLINE}
|
|
194
|
+
# @yieldparam state [Ksef::Sessions::SessionState] after each poll, for progress reporting
|
|
195
|
+
# @return [Ksef::Sessions::SessionState] no longer in progress
|
|
196
|
+
# @raise [Ksef::TimeoutError] when the deadline passes with the session still working
|
|
197
|
+
def wait_for_session(session_reference, **, &)
|
|
198
|
+
status_client.wait_for_session(session_reference, **, &)
|
|
199
|
+
end
|
|
200
|
+
|
|
177
201
|
# Downloads an invoice KSeF holds, by its KSeF number.
|
|
178
202
|
#
|
|
179
203
|
# @param ksef_number [String, Ksef::KsefNumber]
|
data/lib/ksef/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ksef_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tibor Molnár
|
|
@@ -209,7 +209,7 @@ metadata:
|
|
|
209
209
|
source_code_uri: https://github.com/tibortc/ksef_client
|
|
210
210
|
changelog_uri: https://github.com/tibortc/ksef_client/blob/main/CHANGELOG.md
|
|
211
211
|
bug_tracker_uri: https://github.com/tibortc/ksef_client/issues
|
|
212
|
-
documentation_uri: https://rubydoc.info/gems/ksef_client/0.1.0
|
|
212
|
+
documentation_uri: https://rubydoc.info/gems/ksef_client/0.1.0
|
|
213
213
|
rdoc_options: []
|
|
214
214
|
require_paths:
|
|
215
215
|
- lib
|