File Coverage

blib/lib/WebService/Mattermost/V4/API/Object/Plugin.pm
Criterion Covered Total %
statement 6 10 60.0
branch n/a
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 14 57.1


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

3: # ABSTRACT: A plugin item. 4:
5: use Moo;
6: use Types::Standard qw(Bool HashRef Maybe Str);
7:
8: extends 'WebService::Mattermost::V4::API::Object';
9: with qw(
10: WebService::Mattermost::V4::API::Object::Role::APIMethods
11: WebService::Mattermost::V4::API::Object::Role::Description
12: WebService::Mattermost::V4::API::Object::Role::Name
13: WebService::Mattermost::V4::API::Object::Role::ID
14: );
15:
16: ################################################################################
17:
18: has backend => (is => 'ro', isa => Maybe[HashRef]);
19: has prepackaged => (is => 'ro', isa => Maybe[Bool]);
20: has settings_schema => (is => 'ro', isa => Maybe[HashRef]);
21: has version => (is => 'ro', isa => Maybe[Str]);
22: has webapp => (is => 'ro', isa => Maybe[HashRef]);
23:
24: ################################################################################
25:
26: around BUILDARGS => sub {
27: my $orig = shift;
28: my $self = shift;
29: my $args = shift;
30:
31: # Convert JSON::PP::Boolean into regular boolean
32: $args->{prepackaged} = $args->{prepackaged} ? 1 : 0;
33:
34: return $self->$orig($args);
35: };
36:
37: sub BUILD {
38: my $self = shift;
39:
40: $self->api_resource_name('plugin');
41: $self->set_available_api_methods([ qw(remove activate deactivate) ]);
42:
43: return 1;
44: }
45:
46: ################################################################################
47:
48: 1;
49:
50: __END__
51:
52: =pod
53:
54: =encoding UTF-8
55:
56: =head1 NAME
57:
58: WebService::Mattermost::V4::API::Object::Plugin - A plugin item.
59:
60: =head1 VERSION
61:
62: version 0.28
63:
64: =head1 DESCRIPTION
65:
66: An active or inactive plugin.
67:
68: =head2 METHODS
69:
70: See matching methods in L<WebService::Mattermost::V4::API::Resource::Plugin>
71: for full documentation.
72:
73: ID parameters are not required:
74:
75: my @responses = map { $_->deactivate } @{$mattermost->api->plugins->all->item->active};
76:
77: Is the same as:
78:
79: my @responses = map { $mattermost->api->plugin->deactivate($_) } qw(PLUGIN-IDS-HERE);
80:
81: =over 4
82:
83: =item C<remove()>
84:
85: =item C<activate()>
86:
87: =item C<deactivate()>
88:
89: =back
90:
91: =head2 ATTRIBUTES
92:
93: =over 4
94:
95: =item C<backend>
96:
97: =item C<prepackaged>
98:
99: =item C<settings_schema>
100:
101: =item C<version>
102:
103: =item C<webapp>
104:
105: =back
106:
107: =head1 SEE ALSO
108:
109: =over 4
110:
111: =item L<WebService::Mattermost::V4::API::Resource::Plugin>
112:
113: =item L<WebService::Mattermost::V4::API::Resource::Plugins>
114:
115: =item L<WebService::Mattermost::V4::API::Object::Role::Description>
116:
117: =item L<WebService::Mattermost::V4::API::Object::Role::Name>
118:
119: =item L<WebService::Mattermost::V4::API::Object::Role::ID>
120:
121: =back
122:
123: =head1 AUTHOR
124:
125: Mike Jones <mike@netsplit.org.uk>
126:
127: =head1 COPYRIGHT AND LICENSE
128:
129: This software is Copyright (c) 2020 by Mike Jones.
130:
131: This is free software, licensed under:
132:
133: The MIT (X11) License
134:
135: =cut
136: