Skip to content

Use passTemplate wire key + add Pass.patch (partial update)#6

Merged
flomio merged 3 commits into
masterfrom
passtemplate-wire-key
Jun 7, 2026
Merged

Use passTemplate wire key + add Pass.patch (partial update)#6
flomio merged 3 commits into
masterfrom
passtemplate-wire-key

Conversation

@flomio
Copy link
Copy Markdown
Owner

@flomio flomio commented Jun 6, 2026

What

Switch to the passTemplate wire key, matching the API contract that is standardizing on passTemplate (away from the legacy passType).

Changes

  • model/Pass.java
    • Request builder now sends the passTemplate param.
    • Response model field/@JsonProperty is passTemplate; accessor renamed getPassType()getPassTemplate(); toString() updated.
  • README.md updated to getPassTemplate().

Untouched on purpose:

  • PassTemplate.passTypeId / pass_type_id — that is the Apple/Google pass type identifier, a different field.
  • Method parameter names and URL path segments (passType) — only the wire key and public accessor change.

Compatibility

The API accepts both passTemplate and passType on input and echoes back whichever key the caller sends, so sending passTemplate returns passTemplate.

PassNinja added 2 commits June 6, 2026 17:14
Send passTemplate request param and deserialize the passTemplate
response field on Pass; expose it via getPassTemplate(). Aligns the
client with the API contract standardizing on passTemplate.
Leaves PassTemplate.passTypeId (Apple/Google id) untouched.
Adds a static patch() for partial updates so a single field can be
changed without a full payload (put stays a full replace). Java's
HttpURLConnection cannot send PATCH, so patch posts with the server's
_method=PATCH override.
@flomio flomio changed the title Use passTemplate wire key for pass create Use passTemplate wire key + add Pass.patch (partial update) Jun 6, 2026
@flomio
Copy link
Copy Markdown
Owner Author

flomio commented Jun 6, 2026

Updated: adds Pass.patch(...) for partial updates (put stays full-replace). Note: HttpURLConnection can't issue PATCH, so patch POSTs with the server's ?_method=PATCH override (the method-override middleware rewrites POST→PATCH). No new RequestMethod enum value needed.

Tests hit api.passninja.com directly, so they errored without live
creds/network. Add a JDK HttpServer mock (no new dependency) and a
passninja.apiBaseUrl system-property override so the suite runs
offline and deterministically.
@flomio
Copy link
Copy Markdown
Owner Author

flomio commented Jun 7, 2026

Also fixed the test suite: it made real calls to api.passninja.com (erroring without live creds/network). Added a JDK HttpServer mock (no new dependency) and a passninja.apiBaseUrl system-property override in the transport so tests run offline. mvn test now passes (9 run, 0 failures, 0 errors, 2 disabled).

@flomio flomio merged commit 5f56485 into master Jun 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant