diff --git a/Koha/Club/Hold.pm b/Koha/Club/Hold.pm index 9ca8f40456..b8b78fb293 100644 --- a/Koha/Club/Hold.pm +++ b/Koha/Club/Hold.pm @@ -40,7 +40,7 @@ Represents a hold made for every member of club =head1 API -=head2 Class Methods +=head2 Class methods =cut @@ -125,7 +125,26 @@ sub add { } -=head3 type + +=head3 to_api_mapping + +This method returns the mapping for representing a Koha::Club::Hold object +on the API. + +=cut + +sub to_api_mapping { + return { + id => 'club_hold_id', + club_id => 'club_id', + biblio_id => 'biblio_id', + item_id => 'item_id' + }; +} + +=head2 Internal methods + +=head3 _type =cut @@ -139,4 +158,4 @@ Agustin Moyano =cut -1; \ No newline at end of file +1; diff --git a/Koha/REST/V1/Clubs/Holds.pm b/Koha/REST/V1/Clubs/Holds.pm index 5d25bd3c5f..6b061dca66 100644 --- a/Koha/REST/V1/Clubs/Holds.pm +++ b/Koha/REST/V1/Clubs/Holds.pm @@ -119,9 +119,10 @@ sub add { item_type => $item_type }); - my $mapping = _to_api($club_hold->unblessed); - - return $c->render( status => 201, openapi => $mapping ); + return $c->render( + status => 201, + openapi => $club_hold->to_api + ); } catch { if ( blessed $_ and $_->isa('Koha::Exceptions::Object') ) {