From 73f3d8c7f082697f7acd41cee766decad1b800cf 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 Signed-off-by: Emmi Takkinen --- 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 37d028a83a..c1d63488f8 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 0000000000..351e6400f0 --- /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 d38e04e820..21c24b872b 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.34.1