File Coverage

blib/lib/WebService/Mattermost/V4/API/Resource/Job.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package WebService::Mattermost::V4::API::Resource::Job;
2              
3             # ABSTRACT: Wrapped API methods for the job API endpoints.
4              
5 7     7   64 use Moo;
  7         18  
  7         38  
6              
7             extends 'WebService::Mattermost::V4::API::Resource';
8              
9             ################################################################################
10              
11             around [ qw(get cancel) ] => sub {
12                 my $orig = shift;
13                 my $self = shift;
14                 my $id = shift;
15              
16                 return $self->_validate_id($orig, $id, @_);
17             };
18              
19             sub get {
20                 my $self = shift;
21                 my $id = shift;
22              
23                 return $self->_single_view_get({
24                     view => 'Job',
25                     endpoint => '%s',
26                     ids => [ $id ],
27                 });
28             }
29              
30             sub cancel {
31                 my $self = shift;
32                 my $id = shift;
33              
34                 return $self->_single_view_post({
35                     view => 'Job',
36                     endpoint => '%s/cancel',
37                     ids => [ $id ],
38                 });
39             }
40              
41             ################################################################################
42              
43             1;
44              
45             __END__
46            
47             =pod
48            
49             =encoding UTF-8
50            
51             =head1 NAME
52            
53             WebService::Mattermost::V4::API::Resource::Job - Wrapped API methods for the job API endpoints.
54            
55             =head1 VERSION
56            
57             version 0.26
58            
59             =head1 DESCRIPTION
60            
61             =head2 USAGE
62            
63             use WebService::Mattermost;
64            
65             my $mm = WebService::Mattermost->new({
66             authenticate => 1,
67             username => 'me@somewhere.com',
68             password => 'hunter2',
69             base_url => 'https://my.mattermost.server.com/api/v4/',
70             });
71            
72             my $resource = $mm->api->teams->job;
73            
74             =head2 METHODS
75            
76             =over 4
77            
78             =item C<get()>
79            
80             L<Get a job|https://api.mattermost.com/#tag/jobs%2Fpaths%2F~1jobs~1%7Bjob_id%7D%2Fget>
81            
82             my $response = $resource->get('JOB-ID-HERE');
83            
84             =item C<cancel()>
85            
86             L<Cancel a job|https://api.mattermost.com/#tag/jobs%2Fpaths%2F~1jobs~1%7Bjob_id%7D~1cancel%2Fpost>
87            
88             my $response = $resource->cancel('JOB-ID-HERE');
89            
90             =back
91            
92             =head1 SEE ALSO
93            
94             =over 4
95            
96             =item L<Official Jobs documentation|https://api.mattermost.com/#tag/jobs>
97            
98             =back
99            
100             =head1 AUTHOR
101            
102             Mike Jones <mike@netsplit.org.uk>
103            
104             =head1 COPYRIGHT AND LICENSE
105            
106             This software is Copyright (c) 2020 by Mike Jones.
107            
108             This is free software, licensed under:
109            
110             The MIT (X11) License
111            
112             =cut
113