Mattermost/V4/API/Resource/Plugin.pm

filter: Statementstmt 63.6% 7 / 11 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 1 / 2 Podpod n/a totaltotal 44.4% 8 / 18 CC 2 SCAR 14.7
CC
2
Cov
50%
__ANON__
6.0
BEGIN
1.0
CRAP 4.3
« Mattermost/V4/API/Object/Thread.pm ↑ Summary Mattermost/V4/API/Object/User.pm »
1 package WebService::Mattermost::V4::API::Resource::Plugin;
2  
3 # ABSTRACT: Wrapped API methods for the plugin API endpoints.
4  
5 12 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 12 extends 'WebService::Mattermost::V4::API::Resource';
8 12 with qw(
9 WebService::Mattermost::V4::API::Resource::Role::Single
10 );
11  
12 ################################################################################
13  
14 around [ qw(activate deactivate remove) ] => sub {
15 0 ▶ my $orig = shift;
Subroutine __ANON__: not called CC=2 SCAR=17.9
16 0 my $self = shift;
17 0 ▶ my $id = shift || $self->id;
Condition0%0/3
shift() || $self->id
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || $self->id
shift() $self->id
Truth table0%0/3
A || B
A= shift()B= $self->id
ABresult
1X1
011
000
18  
19 0 return $self->validate_id($orig, $id, @_);
20 12 };
21  
22 sub remove {
23 my $self = shift;
24 my $id = shift;
25  
26 return $self->_single_view_delete({
27 endpoint => '%s',
28 ids => [ $id ],
29 view => 'Status',
30 });
31 }
32  
33 sub activate {
34 my $self = shift;
35 my $id = shift;
36  
37 return $self->_single_view_post({
38 endpoint => '%s/activate',
39 ids => [ $id ],
40 view => 'Status',
41 });
42 }
43  
44 sub deactivate {
45 my $self = shift;
46 my $id = shift;
47  
48 return $self->_single_view_post({
49 endpoint => '%s/deactivate',
50 ids => [ $id ],
51 view => 'Status',
52 });
53 }
54  
55 ################################################################################
56  
57 12 1;
58  
59 __END__
60  
61 =pod
62  
63 =encoding UTF-8
64  
65 =head1 NAME
66  
67 WebService::Mattermost::V4::API::Resource::Plugin - Wrapped API methods for the plugin API endpoints.
68  
69 =head1 VERSION
70  
71 version 0.28
72  
73 =head1 DESCRIPTION
74  
75 =head2 USAGE
76  
77 use WebService::Mattermost;
78  
79 my $mm = WebService::Mattermost->new({
80 authenticate => 1,
81 username => 'me@somewhere.com',
82 password => 'hunter2',
83 base_url => 'https://my.mattermost.server.com/api/v4/',
84 });
85  
86 my $resource = $mm->api->plugin;
87  
88 Optionally, you can set a global plugin ID and not pass that argument to every
89 method:
90  
91 $resource->id('PLUGIN-ID-HERE');
92  
93 This would make the C<deactivate()> call look like:
94  
95 my $response = $resource->deactivate();
96  
97 =head2 METHODS
98  
99 =over 4
100  
101 =item C<remove()>
102  
103 L<Remove plugin|https://api.mattermost.com/#tag/plugins%2Fpaths%2F~1plugins~1%7Bplugin_id%7D%2Fdelete>
104  
105 my $response = $resource->remove('PLUGIN-ID-HERE');
106  
107 =item C<activate()>
108  
109 L<Activate plugin|https://api.mattermost.com/#tag/plugins%2Fpaths%2F~1plugins~1%7Bplugin_id%7D~1activate%2Fpost>
110  
111 my $response = $resource->activate('PLUGIN-ID-HERE');
112  
113 =item C<deactivate()>
114  
115 L<Deactivate plugin|https://api.mattermost.com/#tag/plugins%2Fpaths%2F~1plugins~1%7Bplugin_id%7D~1deactivate%2Fpost>
116  
117 my $response = $resource->deactivate('PLUGIN-ID-HERE');
118  
119 =back
120  
121 =head1 AUTHOR
122  
123 Mike Jones <mike@netsplit.org.uk>
124  
125 =head1 COPYRIGHT AND LICENSE
126  
127 This software is Copyright (c) 2020 by Mike Jones.
128  
129 This is free software, licensed under:
130  
131 The MIT (X11) License
132  
133 =cut
« Mattermost/V4/API/Object/Thread.pm ↑ Summary Mattermost/V4/API/Object/User.pm »