Dancer-Plugin-RPC-RESTISH

 view release on metacpan or  search on metacpan

example/lib/Example/API/MockDB.pm  view on Meta::CPAN

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    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

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    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 )