line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::Mondo::Webhook; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::Mondo::Webhook |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
A class for a Mondo webhook, extends L<Business::Mondo::Resource> |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
10
|
|
|
10
|
|
41
|
use strict; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
248
|
|
14
|
10
|
|
|
10
|
|
33
|
use warnings; |
|
10
|
|
|
|
|
12
|
|
|
10
|
|
|
|
|
217
|
|
15
|
|
|
|
|
|
|
|
16
|
10
|
|
|
10
|
|
32
|
use Moo; |
|
10
|
|
|
|
|
10
|
|
|
10
|
|
|
|
|
47
|
|
17
|
|
|
|
|
|
|
extends 'Business::Mondo::Resource'; |
18
|
|
|
|
|
|
|
|
19
|
10
|
|
|
10
|
|
2184
|
use Types::Standard qw/ :all /; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
58
|
|
20
|
10
|
|
|
10
|
|
245776
|
use Business::Mondo::Exception; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
1966
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
The Webhook class has the following attributes (with their type). |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
id (Str) |
27
|
|
|
|
|
|
|
callback_url (Str) |
28
|
|
|
|
|
|
|
account (Business::Mondo::Account) |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Note that when a Str is passed to ->account this will be coerced |
31
|
|
|
|
|
|
|
to a Business::Mondo::Account object. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has [ qw/ id callback_url / ] => ( |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
isa => Str, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has account => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
isa => InstanceOf['Business::Mondo::Account'], |
43
|
|
|
|
|
|
|
coerce => sub { |
44
|
|
|
|
|
|
|
my ( $args ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
if ( ! ref( $args ) ) { |
47
|
|
|
|
|
|
|
require Business::Mondo::Account; |
48
|
|
|
|
|
|
|
$args = Business::Mondo::Account->new( |
49
|
|
|
|
|
|
|
id => $args, |
50
|
|
|
|
|
|
|
client => $Business::Mondo::Resource::client, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return $args; |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 Operations on an webhook |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 delete |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Deletes a webhook |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
$webhook->delete |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub delete { |
69
|
1
|
|
|
1
|
1
|
2
|
my ( $self ) = @_; |
70
|
1
|
|
|
|
|
21
|
return $self->client->api_delete( $self->url ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub get { |
74
|
1
|
|
|
1
|
1
|
821
|
Business::Mondo::Exception->throw({ |
75
|
|
|
|
|
|
|
message => "Mondo API does not currently support getting webhook data", |
76
|
|
|
|
|
|
|
}); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SEE ALSO |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L<Business::Mondo> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L<Business::Mondo::Resource> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Lee Johnson - C<leejo@cpan.org> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 LICENSE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
92
|
|
|
|
|
|
|
the same terms as Perl itself. If you would like to contribute documentation, |
93
|
|
|
|
|
|
|
features, bug fixes, or anything else then please raise an issue / pull request: |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
https://github.com/leejo/business-mondo |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# vim: ts=4:sw=4:et |