File Coverage

blib/lib/Apertur/SDK/Resource/Destinations.pm
Criterion Covered Total %
statement 11 21 52.3
branch n/a
condition n/a
subroutine 4 9 44.4
pod 5 6 83.3
total 20 36 55.5


line stmt bran cond sub pod time code
1             package Apertur::SDK::Resource::Destinations;
2              
3 1     1   8 use strict;
  1         2  
  1         46  
4 1     1   25 use warnings;
  1         2  
  1         67  
5              
6 1     1   8 use JSON qw(encode_json);
  1         2  
  1         23  
7              
8             sub new {
9 3     3 0 6 my ($class, %args) = @_;
10 3         23 return bless { http => $args{http} }, $class;
11             }
12              
13             sub list {
14 0     0 1   my ($self, $project_id) = @_;
15 0           return $self->{http}->request('GET', "/api/v1/projects/$project_id/destinations");
16             }
17              
18             sub create {
19 0     0 1   my ($self, $project_id, %config) = @_;
20             return $self->{http}->request(
21 0           'POST', "/api/v1/projects/$project_id/destinations",
22             body => encode_json(\%config),
23             );
24             }
25              
26             sub update {
27 0     0 1   my ($self, $project_id, $dest_id, %config) = @_;
28             return $self->{http}->request(
29 0           'PATCH', "/api/v1/projects/$project_id/destinations/$dest_id",
30             body => encode_json(\%config),
31             );
32             }
33              
34             sub delete {
35 0     0 1   my ($self, $project_id, $dest_id) = @_;
36             return $self->{http}->request(
37 0           'DELETE', "/api/v1/projects/$project_id/destinations/$dest_id",
38             );
39             }
40              
41             sub test {
42 0     0 1   my ($self, $project_id, $dest_id) = @_;
43             return $self->{http}->request(
44 0           'POST', "/api/v1/projects/$project_id/destinations/$dest_id/test",
45             );
46             }
47              
48             1;
49              
50             __END__