| 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
| |||||||||||
| 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__ | ||||||||||