File Coverage

blib/lib/WebService/Mattermost/V4/API/Resource/SAML/Certificate.pm
Criterion Covered Total %
statement 3 20 15.0
branch n/a
condition n/a
subroutine 1 8 12.5
pod 6 7 85.7
total 10 35 28.5


line stmt bran cond sub pod time code
1             package WebService::Mattermost::V4::API::Resource::SAML::Certificate;
2              
3             # ABSTRACT: Wrapped API methods for the SAML certificate API endpoints.
4              
5 7     7   49 use Moo;
  7         16  
  7         37  
6              
7             extends 'WebService::Mattermost::V4::API::Resource';
8              
9             ################################################################################
10              
11             sub status {
12 0     0 0       my $self = shift;
13              
14 0               return $self->_get({ endpoint => 'status' });
15             }
16              
17             sub idp_upload {
18 0     0 1       my $self = shift;
19 0               my $filename = shift;
20              
21             # TODO: wrapping helper for filenames (here and Resource::Users)
22              
23 0               return $self->_post({
24                     endpoint => 'idp',
25                     override_data_type => 'form',
26                     parameters => {
27                         certificate => { file => $filename },
28                     },
29                 });
30             }
31              
32             sub idp_remove {
33 0     0 1       my $self = shift;
34              
35 0               return $self->_delete({ endpoint => 'idp' });
36             }
37              
38             sub public_upload {
39 0     0 1       my $self = shift;
40 0               my $filename = shift;
41              
42             # TODO: wrapping helper for filenames (here and Resource::Users)
43              
44 0               return $self->_post({
45                     endpoint => 'public',
46                     override_data_type => 'form',
47                     parameters => {
48                         certificate => { file => $filename },
49                     },
50                 });
51             }
52              
53             sub public_remove {
54 0     0 1       my $self = shift;
55              
56 0               return $self->_delete({ endpoint => 'public' });
57             }
58              
59             sub private_upload {
60 0     0 1       my $self = shift;
61 0               my $filename = shift;
62              
63             # TODO: wrapping helper for filenames (here and Resource::Users)
64              
65 0               return $self->_post({
66                     endpoint => 'private',
67                     override_data_type => 'form',
68                     parameters => {
69                         certificate => { file => $filename },
70                     },
71                 });
72             }
73              
74             sub private_remove {
75 0     0 1       my $self = shift;
76              
77 0               return $self->_delete({ endpoint => 'private' });
78             }
79              
80             ################################################################################
81              
82             1;
83              
84             __END__
85            
86             =pod
87            
88             =encoding UTF-8
89            
90             =head1 NAME
91            
92             WebService::Mattermost::V4::API::Resource::SAML::Certificate - Wrapped API methods for the SAML certificate API endpoints.
93            
94             =head1 VERSION
95            
96             version 0.26
97            
98             =head1 DESCRIPTION
99            
100             =head2 USAGE
101            
102             use WebService::Mattermost;
103            
104             my $mm = WebService::Mattermost->new({
105             authenticate => 1,
106             username => 'me@somewhere.com',
107             password => 'hunter2',
108             base_url => 'https://my.mattermost.server.com/api/v4/',
109             });
110            
111             my $resource = $mm->api->saml->certificate;
112            
113             =head2 METHODS
114            
115             =over 4
116            
117             =item C<idp_upload()>
118            
119             Upload an IDP key.
120            
121             $resource->idp_upload('/path/to/idp.key');
122            
123             =item C<idp_remove()>
124            
125             Remove your associated IDP key.
126            
127             $resource->idp_remove();
128            
129             =item C<public_upload()>
130            
131             Upload a public key.
132            
133             $resource->public_upload('/path/to/public.key');
134            
135             =item C<public_remove()>
136            
137             Remove your associated public key.
138            
139             $resource->public_remove();
140            
141             =item C<private_upload()>
142            
143             Upload a private key.
144            
145             $resource->private_upload('/path/to/private.key');
146            
147             =item C<private_remove()>
148            
149             Remove your associated private key.
150            
151             $resource->private_remove();
152            
153             =back
154            
155             =head1 SEE ALSO
156            
157             =over 4
158            
159             =item L<Official SAML documentation|https://api.mattermost.com/#tag/SAML>
160            
161             =back
162            
163             =head1 AUTHOR
164            
165             Mike Jones <mike@netsplit.org.uk>
166            
167             =head1 COPYRIGHT AND LICENSE
168            
169             This software is Copyright (c) 2020 by Mike Jones.
170            
171             This is free software, licensed under:
172            
173             The MIT (X11) License
174            
175             =cut
176