From 55d5207faf72fe524520c4035de62a9a58b479ef Mon Sep 17 00:00:00 2001 From: Auston Bunsen Date: Thu, 16 Apr 2026 14:42:49 -0400 Subject: [PATCH] Fix card-template-pairs URL, add create_pass_template_pair - Fixed list_pass_template_pairs URL from /pass-template-pairs to /card-template-pairs - Fixed response key from pass_template_pairs to card_template_pairs - Added create_pass_template_pair method - Updated tests and feature matrix to 27 rows Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitignore | 3 +++ README.md | 3 ++- accessgrid/client.py | 24 ++++++++++++++++++++---- tests/test_accessgrid.py | 6 +++--- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 96d4436..aef2faf 100644 --- a/.gitignore +++ b/.gitignore @@ -107,6 +107,9 @@ site/ .pyre/ .pytype/ +# Test scripts +scripts/ + # Distribution / packaging .Python *.pyc diff --git a/README.md b/README.md index 3288d0d..ecc4b49 100644 --- a/README.md +++ b/README.md @@ -411,7 +411,8 @@ MIT License - See LICENSE file for details. | PUT /v1/console/card-templates/{id} | `console.update_template()` | Y | | GET /v1/console/card-templates/{id} | `console.read_template()` | Y | | GET /v1/console/card-templates/{id}/logs | `console.get_logs()` / `console.event_log()` | Y | -| GET /v1/console/pass-template-pairs | `console.list_pass_template_pairs()` | Y | +| GET /v1/console/card-template-pairs | `console.list_pass_template_pairs()` | Y | +| POST /v1/console/card-template-pairs | `console.create_pass_template_pair()` | Y | | POST /v1/console/card-templates/{id}/ios_preflight | `console.ios_preflight()` | Y | | GET /v1/console/ledger-items | `console.ledger_items()` | Y | | GET /v1/console/landing-pages | `console.list_landing_pages()` | Y | diff --git a/accessgrid/client.py b/accessgrid/client.py index 4d20ab1..d7ccf6c 100644 --- a/accessgrid/client.py +++ b/accessgrid/client.py @@ -600,16 +600,32 @@ def list_pass_template_pairs(self, **kwargs) -> Dict[str, Any]: Returns: Dict containing pass_template_pairs list and pagination info """ - response = self._client._get("/v1/console/pass-template-pairs", params=kwargs) + response = self._client._get("/v1/console/card-template-pairs", params=kwargs) - if "pass_template_pairs" in response: - response["pass_template_pairs"] = [ + if "card_template_pairs" in response: + response["card_template_pairs"] = [ PassTemplatePair(self._client, pair) - for pair in response["pass_template_pairs"] + for pair in response["card_template_pairs"] ] return response + def create_pass_template_pair(self, **kwargs) -> PassTemplatePair: + """ + Create a new pass template pair linking an Apple (iOS) + and Google (Android) card template. + + Args: + name: Name for the pair + apple_card_template_id: Apple card template ID + google_card_template_id: Google card template ID + + Returns: + PassTemplatePair object + """ + response = self._client._post("/v1/console/card-template-pairs", kwargs) + return PassTemplatePair(self._client, response) + class AccessGrid: def __init__( diff --git a/tests/test_accessgrid.py b/tests/test_accessgrid.py index a11a494..ec9ca63 100644 --- a/tests/test_accessgrid.py +++ b/tests/test_accessgrid.py @@ -368,7 +368,7 @@ def test_list_pass_template_pairs(self, mock_request, client): mock_resp = Mock() mock_resp.status_code = 200 mock_resp.json.return_value = { - "pass_template_pairs": [ + "card_template_pairs": [ { "id": "pair-1", "name": "Employee Badge", @@ -405,11 +405,11 @@ def test_list_pass_template_pairs(self, mock_request, client): call_args = mock_request.call_args[1] assert call_args["method"] == "GET" - assert call_args["url"] == f"{client.base_url}/v1/console/pass-template-pairs" + assert call_args["url"] == f"{client.base_url}/v1/console/card-template-pairs" assert call_args["params"]["page"] == 1 assert call_args["params"]["per_page"] == 50 - pairs = result["pass_template_pairs"] + pairs = result["card_template_pairs"] assert len(pairs) == 2 # First pair — both platforms