| 1 | package Apertur::SDK::Resource::Webhooks; | ||||||||||
| 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 | 1 | ▶ | use URI::Escape qw(uri_escape); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 3 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 10 | 3 | my ($class, %args) = @_; | |||||||||
| 11 | 3 | return bless { http => $args{http} }, $class; | |||||||||
| 12 | } | ||||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | sub list { | ||||||||
|
Subroutine
list: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 15 | 0 | my ($self, $project_id) = @_; | |||||||||
| 16 | 0 | return $self->{http}->request('GET', "/api/v1/projects/$project_id/webhooks"); | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub create { | ||||||||
|
Subroutine
create: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 20 | 0 | my ($self, $project_id, %config) = @_; | |||||||||
| 21 | return $self->{http}->request( | ||||||||||
| 22 | 0 | 'POST', "/api/v1/projects/$project_id/webhooks", | |||||||||
| 23 | body => encode_json(\%config), | ||||||||||
| 24 | ); | ||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub update { | ||||||||
|
Subroutine
update: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 28 | 0 | my ($self, $project_id, $webhook_id, %config) = @_; | |||||||||
| 29 | return $self->{http}->request( | ||||||||||
| 30 | 0 | 'PATCH', "/api/v1/projects/$project_id/webhooks/$webhook_id", | |||||||||
| 31 | body => encode_json(\%config), | ||||||||||
| 32 | ); | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 36 | 0 | my ($self, $project_id, $webhook_id) = @_; | |||||||||
| 37 | return $self->{http}->request( | ||||||||||
| 38 | 0 | 'DELETE', "/api/v1/projects/$project_id/webhooks/$webhook_id", | |||||||||
| 39 | ); | ||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub test { | ||||||||
|
Subroutine
test: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 43 | 0 | my ($self, $project_id, $webhook_id) = @_; | |||||||||
| 44 | return $self->{http}->request( | ||||||||||
| 45 | 0 | 'POST', "/api/v1/projects/$project_id/webhooks/$webhook_id/test", | |||||||||
| 46 | ); | ||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | sub deliveries { | ||||||||
|
Subroutine
deliveries: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 50 | 0 | my ($self, $project_id, $webhook_id, %options) = @_; | |||||||||
| 51 | 0 | my @parts; | |||||||||
| 52 | 0 | for my $key (sort keys %options) { | |||||||||
| 53 | 0 | ▶ | next unless defined $options{$key}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | push @parts, uri_escape($key) . '=' . uri_escape($options{$key}); | |||||||||
| 55 | } | ||||||||||
| 56 | 0 | ▶ | my $qs = @parts ? '?' . join('&', @parts) : ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | return $self->{http}->request( | ||||||||||
| 58 | 0 | 'GET', "/api/v1/projects/$project_id/webhooks/$webhook_id/deliveries$qs", | |||||||||
| 59 | ); | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 0 | ▶ | sub retry_delivery { | ||||||||
|
Subroutine
retry_delivery: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 63 | 0 | my ($self, $project_id, $webhook_id, $delivery_id) = @_; | |||||||||
| 64 | return $self->{http}->request( | ||||||||||
| 65 | 0 | 'POST', | |||||||||
| 66 | "/api/v1/projects/$project_id/webhooks/$webhook_id/deliveries/$delivery_id/retry", | ||||||||||
| 67 | ); | ||||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 1 | 1; | |||||||||
| 71 | |||||||||||
| 72 | __END__ | ||||||||||