File Coverage

blib/lib/WebService/Mattermost/V4/API/Resource/Webhook.pm
Criterion Covered Total %
statement 15 19 78.9
branch n/a
condition n/a
subroutine 5 7 71.4
pod n/a
total 20 26 76.9


line stmt bran cond sub pod time code
1             package WebService::Mattermost::V4::API::Resource::Webhook;
2:

3: # ABSTRACT: Wrapped API methods for the webhook API endpoints. 4:
5: use Moo;
6: use Types::Standard 'InstanceOf';
7:
8: use WebService::Mattermost::Helper::Alias 'v4';
9: use WebService::Mattermost::V4::API::Resource::Webhook::Incoming;
10: use WebService::Mattermost::V4::API::Resource::Webhook::Outgoing;
11:
12: extends 'WebService::Mattermost::V4::API::Resource';
13:
14: ################################################################################
15:
16: has incoming => (is => 'ro', isa => InstanceOf[v4 'Webhook::Incoming'], lazy => 1, builder => 1);
17: has outgoing => (is => 'ro', isa => InstanceOf[v4 'Webhook::Incoming'], lazy => 1, builder => 1);
18:
19: ################################################################################
20:
21: sub _build_incoming {
22: my $self = shift;
23:
24: return $self->new_related_resource('webhooks', 'Webhook::Incoming');
25: }
26:
27: sub _build_outgoing {
28: my $self = shift;
29:
30: return $self->new_related_resource('webhooks', 'Webhook::Outgoing');
31: }
32:
33: ################################################################################
34:
35: 1;
36:
37: __END__
38:
39: =pod
40:
41: =encoding UTF-8
42:
43: =head1 NAME
44:
45: WebService::Mattermost::V4::API::Resource::Webhook - Wrapped API methods for the webhook API endpoints.
46:
47: =head1 VERSION
48:
49: version 0.28
50:
51: =head1 DESCRIPTION
52:
53: =head2 USAGE
54:
55: use WebService::Mattermost;
56:
57: my $mm = WebService::Mattermost->new({
58: authenticate => 1,
59: username => 'me@somewhere.com',
60: password => 'hunter2',
61: base_url => 'https://my.mattermost.server.com/api/v4/',
62: });
63:
64: my $resource = $mm->api->webhooks;
65:
66: =head2 ATTRIBUTES
67:
68: =over 4
69:
70: =item C<incoming>
71:
72: Contains methods for incoming webhooks. See
73: L<WebService::Mattermost::V4::API::Resource::Webhook::Incoming>.
74:
75: my $incoming = $resource->incoming;
76:
77: =item C<outgoing>
78:
79: Contains methods for outgoing webhooks. See
80: L<WebService::Mattermost::V4::API::Resource::Webhook::Outgoing>.
81:
82: my $outgoing = $resource->outgoing;
83:
84: =back
85:
86: =head1 AUTHOR
87:
88: Mike Jones <mike@netsplit.org.uk>
89:
90: =head1 COPYRIGHT AND LICENSE
91:
92: This software is Copyright (c) 2020 by Mike Jones.
93:
94: This is free software, licensed under:
95:
96: The MIT (X11) License
97:
98: =cut
99: