SDK/Resource/Keys.pm

filter: Statementstmt 50.0% 12 / 24 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 83.3% 5 / 6 totaltotal 51.2% 21 / 41 CC 2 SCAR 8.8
CC
2
Cov
46%
set_destinations
6.0
list
2.0
create
2.0
CRAP 2.4
« SDK.pm ↑ Summary SDK/Error.pm »
1 package Apertur::SDK::Resource::Keys;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use JSON qw(encode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
9 3 my ($class, %args) = @_;
10 3 return bless { http => $args{http} }, $class;
11 }
12  
13 0 ▶sub list {
Subroutine list: not called CC=1 SCAR=6.9
Pod documented
14 0 my ($self, $project_id) = @_;
15 0 return $self->{http}->request('GET', "/api/v1/projects/$project_id/keys");
16 }
17  
18 0 ▶sub create {
Subroutine create: not called CC=1 SCAR=6.9
Pod documented
19 0 my ($self, $project_id, %options) = @_;
20 return $self->{http}->request(
21 0 'POST', "/api/v1/projects/$project_id/keys",
22 body => encode_json(\%options),
23 );
24 }
25  
26 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
Pod documented
27 0 my ($self, $project_id, $key_id, %options) = @_;
28 return $self->{http}->request(
29 0 'PATCH', "/api/v1/projects/$project_id/keys/$key_id",
30 body => encode_json(\%options),
31 );
32 }
33  
34 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
35 0 my ($self, $project_id, $key_id) = @_;
36 return $self->{http}->request(
37 0 'DELETE', "/api/v1/projects/$project_id/keys/$key_id",
38 );
39 }
40  
41 0 ▶sub set_destinations {
Subroutine set_destinations: not called CC=2 SCAR=17.9
Pod documented
42 0 my ($self, $key_id, $destination_ids, $long_polling) = @_;
43  
44 0 my %payload = (destination_ids => $destination_ids);
45 0 ▶ $payload{long_polling_enabled} = $long_polling
Branch: 1 branch
BranchTrueFalseTotal
if defined $long_polling 0 0 0
46 if defined $long_polling;
47  
48 return $self->{http}->request(
49 0 'PUT', "/api/v1/keys/$key_id/destinations",
50 body => encode_json(\%payload),
51 );
52 }
53  
54 1 1;
55  
56 __END__
« SDK.pm ↑ Summary SDK/Error.pm »