Dancer-Plugin-RPC-RESTISH
view release on metacpan or search on metacpan
example/lib/Example/API/MockDB.pm view on Meta::CPAN
585960616263646566676869707172737475767778
return
$self
->db->{person}{
$id
};
}
=head2 update_person
=for restish POST@person/:id update_person
=cut
sub
update_person {
my
$self
=
shift
;
my
%data
= %{
$_
[0] };
my
$id
=
delete
(
$data
{id});
if
(!
$id
) {
my
$error
= error_response(
error_code
=> -32601,
error_message
=>
"Cannot update without ID..."
,
error_data
=> \
%data
,
);
t/lib/TestProject/ApiCalls.pm view on Meta::CPAN
202122232425262728293031323334353637383940
return
$_db
->{person}{
$id
};
}
=head2 update_person
=for restish PATCH@person/:id update_person
=cut
sub
update_person {
my
$method
=
shift
;
my
%data
= %{
$_
[0]};
if
(!
exists
(
$data
{id})) {
my
$error
= error_response(
error_code
=> 9999,
error_message
=>
"Cannot update without ID"
,
error_data
=> \
%data
,
);
$error
->http_status(400);
# bad request
( run in 0.490 second using v1.01-cache-2.11-cpan-49f99fa48dc )