File Coverage

blib/lib/Whelk/Wrapper/Simple.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 3 33.3
total 21 23 91.3


line stmt bran cond sub pod time code
1             package Whelk::Wrapper::Simple;
2             $Whelk::Wrapper::Simple::VERSION = '1.04';
3 15     15   9632 use Kelp::Base 'Whelk::Wrapper';
  15         39  
  15         96  
4 15     15   3791 use Kelp::Exception;
  15         137  
  15         295  
5              
6             sub wrap_server_error
7             {
8 32     32 0 82 my ($self, $data) = @_;
9              
10 32         164 return {error => $data};
11             }
12              
13             sub wrap_success
14             {
15 38     38 0 102 my ($self, $data) = @_;
16              
17 38         133 return $data;
18             }
19              
20             sub build_response_schemas
21             {
22 76     76 1 140 my ($self, $endpoint) = @_;
23 76         166 my $schema = $endpoint->response;
24 76         452 my $schemas = $endpoint->response_schemas;
25              
26 76         206 $schemas->{$endpoint->response_code} = $schema;
27              
28 76         1108 $schemas->{'5XX'} = $schemas->{'4XX'} = Whelk::Schema->get_or_build(
29             api_error_simple => {
30             type => 'object',
31             properties => {
32             error => {
33             type => 'string',
34             },
35             },
36             }
37             );
38             }
39              
40             1;
41