File Coverage

blib/lib/PONAPI/DAO/Request/Update.pm
Criterion Covered Total %
statement 12 12 100.0
branch 3 4 75.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 18 20 90.0


line stmt bran cond sub pod time code
1             # ABSTRACT: DAO request - update
2             package PONAPI::DAO::Request::Update;
3              
4 8     8   65 use Moose;
  8         24  
  8         70  
5              
6             extends 'PONAPI::DAO::Request';
7              
8             with 'PONAPI::DAO::Request::Role::UpdateLike',
9             'PONAPI::DAO::Request::Role::HasData',
10             'PONAPI::DAO::Request::Role::HasDataMethods',
11             'PONAPI::DAO::Request::Role::HasID';
12              
13             has '+update_nothing_status' => (
14             # http://jsonapi.org/format/#crud-updating-responses-404
15             default => sub { 404 },
16             );
17              
18             sub execute {
19 25     25 0 69 my $self = shift;
20              
21 25 100       718 if ( $self->is_valid ) {
22 17         458 my @ret = $self->repository->update( %{ $self } );
  17         120  
23              
24 13 50       849 $self->_add_success_meta(@ret)
25             if $self->_verify_update_response(@ret);
26             }
27              
28 20         723 return $self->response();
29             }
30              
31             __PACKAGE__->meta->make_immutable;
32 8     8   57150 no Moose; 1;
  8         21  
  8         72  
33              
34             __END__
35              
36             =pod
37              
38             =encoding UTF-8
39              
40             =head1 NAME
41              
42             PONAPI::DAO::Request::Update - DAO request - update
43              
44             =head1 VERSION
45              
46             version 0.003003
47              
48             =head1 AUTHORS
49              
50             =over 4
51              
52             =item *
53              
54             Mickey Nasriachi <mickey@cpan.org>
55              
56             =item *
57              
58             Stevan Little <stevan@cpan.org>
59              
60             =item *
61              
62             Brian Fraser <hugmeir@cpan.org>
63              
64             =back
65              
66             =head1 COPYRIGHT AND LICENSE
67              
68             This software is copyright (c) 2019 by Mickey Nasriachi, Stevan Little, Brian Fraser.
69              
70             This is free software; you can redistribute it and/or modify it under
71             the same terms as the Perl 5 programming language system itself.
72              
73             =cut