From 5c465b199f502679bb3ac694c7f258e8f9a68cf7 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 3 Mar 2021 16:51:41 -0300 Subject: [PATCH] Bug 27855: Implement Koha::Patron::Attribute->to_api_mapping This patch introduces a mapping to render extended attributes on the API. As they have an ID, and they will generally be used on the /patrons umbrella, I removed the borrowernumber on the mapping. Another option would be to add the field, but make it optional. It really feels redundant, so I take it out for now. --- Koha/Patron/Attribute.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Koha/Patron/Attribute.pm b/Koha/Patron/Attribute.pm index 5afd6741496..115b7bad466 100644 --- a/Koha/Patron/Attribute.pm +++ b/Koha/Patron/Attribute.pm @@ -112,6 +112,21 @@ sub description { return $self->attribute; } +=head3 to_api_mapping + +This method returns the mapping for representing a Koha::Patron::Attribute object +on the API. + +=cut + +sub to_api_mapping { + return { + id => 'extended_attribute_id', + attribute => 'value', + borrowernumber => undef, + code => 'type' + }; +} =head2 Internal methods -- 2.30.1