| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Apertur::SDK::Resource::Webhooks; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
8
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
41
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
51
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use JSON qw(encode_json); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
7
|
1
|
|
|
1
|
|
157
|
use URI::Escape qw(uri_escape); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
913
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
|
10
|
3
|
|
|
3
|
0
|
5
|
my ($class, %args) = @_; |
|
11
|
3
|
|
|
|
|
15
|
return bless { http => $args{http} }, $class; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub list { |
|
15
|
0
|
|
|
0
|
1
|
|
my ($self, $project_id) = @_; |
|
16
|
0
|
|
|
|
|
|
return $self->{http}->request('GET', "/api/v1/projects/$project_id/webhooks"); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub create { |
|
20
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
sub update { |
|
28
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
sub delete { |
|
36
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
sub test { |
|
43
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
sub deliveries { |
|
50
|
0
|
|
|
0
|
1
|
|
my ($self, $project_id, $webhook_id, %options) = @_; |
|
51
|
0
|
|
|
|
|
|
my @parts; |
|
52
|
0
|
|
|
|
|
|
for my $key (sort keys %options) { |
|
53
|
0
|
0
|
|
|
|
|
next unless defined $options{$key}; |
|
54
|
0
|
|
|
|
|
|
push @parts, uri_escape($key) . '=' . uri_escape($options{$key}); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
0
|
0
|
|
|
|
|
my $qs = @parts ? '?' . join('&', @parts) : ''; |
|
57
|
|
|
|
|
|
|
return $self->{http}->request( |
|
58
|
0
|
|
|
|
|
|
'GET', "/api/v1/projects/$project_id/webhooks/$webhook_id/deliveries$qs", |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub retry_delivery { |
|
63
|
0
|
|
|
0
|
1
|
|
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; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |