From 554954045e0859c2977064304fe2bf2bb8cc8f13 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 5 May 2025 08:26:16 -0300 Subject: [PATCH] Bug 39830: Add order claim object definition This patch adds the required mapping in `Koha::Acquisition::Order::Claim` and adds it's definition to the API spec. To test: 1. Apply the patches 2. Verify the mapping makes sense and conforms to the current style and API coding guidelines. 3. Run: $ ktd --shell k$ prove xt/api.t => SUCCESS: Tests pass 4. Sign off :-D --- Koha/Acquisition/Order/Claim.pm | 14 ++++++++++++++ api/v1/swagger/definitions/order_claim.yaml | 14 ++++++++++++++ api/v1/swagger/swagger.yaml | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 api/v1/swagger/definitions/order_claim.yaml diff --git a/Koha/Acquisition/Order/Claim.pm b/Koha/Acquisition/Order/Claim.pm index 37d028a83ad..c1d63488f85 100644 --- a/Koha/Acquisition/Order/Claim.pm +++ b/Koha/Acquisition/Order/Claim.pm @@ -29,8 +29,22 @@ Koha::Acquisition::Order::Claim - Koha Claim Object class =head2 Class methods + +=head3 to_api_mapping + +This method returns the mapping for representing a Koha::Patron object +on the API. + =cut +sub to_api_mapping { + return { + id => 'order_claim_id', + ordernumber => 'order_id', + claimed_on => 'date_claimed', + }; +} + =head2 Internal methods =head3 _type diff --git a/api/v1/swagger/definitions/order_claim.yaml b/api/v1/swagger/definitions/order_claim.yaml new file mode 100644 index 00000000000..351e6400f0e --- /dev/null +++ b/api/v1/swagger/definitions/order_claim.yaml @@ -0,0 +1,14 @@ +--- +type: object +properties: + order_claim_id: + type: integer + description: Internally assigned order claim identifier + order_id: + type: integer + description: Internally assigned order identifier + date_claimed: + type: string + format: date + description: Date the claim was recorded +additionalProperties: false diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml index d38e04e8201..21c24b872bf 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -140,6 +140,8 @@ definitions: $ref: ./definitions/merge_biblios.yaml order: $ref: ./definitions/order.yaml + order_claim: + $ref: ./definitions/order_claim.yaml patron: $ref: ./definitions/patron.yaml patron_account_credit: -- 2.49.0