File Coverage

blib/lib/WebService/Mattermost/V4/API/Object/Plugins.pm
Criterion Covered Total %
statement 9 24 37.5
branch 0 4 0.0
condition n/a
subroutine 3 6 50.0
pod n/a
total 12 34 35.2


line stmt bran cond sub pod time code
1             package WebService::Mattermost::V4::API::Object::Plugins;
2              
3             # ABSTRACT: Many plugin items.
4              
5 7     7   48 use Moo;
  7         17  
  7         41  
6 7     7   2685 use Types::Standard qw(ArrayRef Maybe);
  7         16  
  7         46  
7              
8 7     7   7364 use WebService::Mattermost::V4::API::Object::Plugin;
  7         22  
  7         1968  
9              
10             extends 'WebService::Mattermost::V4::API::Object';
11              
12             ################################################################################
13              
14             has [ qw(active inactive) ] => (is => 'ro', isa => Maybe[ArrayRef], lazy => 1, builder => 1);
15              
16             ################################################################################
17              
18             sub _map_plugin_objs {
19 0     0         my $self = shift;
20 0               my $type = shift;
21              
22                 return [
23                     map {
24 0                       my $args = $_;
25              
26 0                       $args->{base_url} = $self->base_url;
27 0                       $args->{auth_token} = $self->auth_token;
28 0                       $args->{raw_data} = {};
29              
30 0                       WebService::Mattermost::V4::API::Object::Plugin->new($_)
31 0                   } @{$self->raw_data->{$type}}
  0            
32                 ];
33             }
34              
35             ################################################################################
36              
37             sub _build_active {
38 0     0         my $self = shift;
39              
40 0 0             return unless $self->raw_data->{active};
41 0               return $self->_map_plugin_objs('active');
42             }
43              
44             sub _build_inactive {
45 0     0         my $self = shift;
46              
47 0 0             return unless $self->raw_data->{inactive};
48 0               return $self->_map_plugin_objs('inactive');
49             }
50              
51             ################################################################################
52              
53             1;
54              
55             __END__
56            
57             =pod
58            
59             =encoding UTF-8
60            
61             =head1 NAME
62            
63             WebService::Mattermost::V4::API::Object::Plugins - Many plugin items.
64            
65             =head1 VERSION
66            
67             version 0.26
68            
69             =head1 DESCRIPTION
70            
71             Contains active and inactive plugins.
72            
73             =head2 ATTRIBUTES
74            
75             =over 4
76            
77             =item * C<active>
78            
79             A list of enabled plugins.
80            
81             =item * C<inactive>
82            
83             A list of disabled plugins.
84            
85             =back
86            
87             =head1 SEE ALSO
88            
89             =over 4
90            
91             =item * L<WebService::Mattermost::V4::API::Object::Plugin>
92            
93             The "plugins" referred to in C<active> and C<inactive>.
94            
95             =back
96            
97             =head1 AUTHOR
98            
99             Mike Jones <mike@netsplit.org.uk>
100            
101             =head1 COPYRIGHT AND LICENSE
102            
103             This software is Copyright (c) 2020 by Mike Jones.
104            
105             This is free software, licensed under:
106            
107             The MIT (X11) License
108            
109             =cut
110