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.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2021-03-03 16:51:41 -03:00 committed by Jonathan Druart
parent d77a1226df
commit f790ca45ab
1 changed files with 15 additions and 0 deletions

View File

@ -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