File Coverage

blib/lib/WebService/Mattermost/V4/API/Object/Job.pm
Criterion Covered Total %
statement 6 22 27.2
branch n/a
condition n/a
subroutine 2 9 22.2
pod 0 1 0.0
total 8 32 25.0


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

3: # ABSTRACT: A job item. 4:
5: use Moo;
6: use Types::Standard qw(HashRef Int Maybe Object 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::ID
12: WebService::Mattermost::V4::API::Object::Role::CreatedAt
13: WebService::Mattermost::V4::API::Object::Role::Status
14: );
15:
16: ################################################################################
17:
18: has type => (is => 'ro', isa => Maybe[Str], lazy => 1, builder => 1);
19: has start_at => (is => 'ro', isa => Maybe[Int], lazy => 1, builder => 1);
20: has last_activity_at => (is => 'ro', isa => Maybe[Int], lazy => 1, builder => 1);
21: has progress => (is => 'ro', isa => Maybe[Int], lazy => 1, builder => 1);
22: has data => (is => 'ro', isa => Maybe[HashRef], lazy => 1, builder => 1);
23: has started_at => (is => 'ro', isa => Maybe[Object], lazy => 1, builder => 1);
24:
25: ################################################################################
26:
27: sub BUILD {
28: my $self = shift;
29:
30: $self->api_resource_name('job');
31: $self->set_available_api_methods([ 'cancel' ]);
32:
33: return 1;
34: }
35:
36: ################################################################################
37:
38: sub _build_type {
39: my $self = shift;
40:
41: return $self->raw_data->{type};
42: }
43:
44: sub _build_start_at {
45: my $self = shift;
46:
47: return $self->raw_data->{start_at};
48: }
49:
50: sub _build_last_activity_at {
51: my $self = shift;
52:
53: return $self->raw_data->{last_activity_at};
54: }
55:
56: sub _build_progress {
57: my $self = shift;
58:
59: return $self->raw_data->{progress};
60: }
61:
62: sub _build_data {
63: my $self = shift;
64:
65: return $self->raw_data->{data};
66: }
67:
68: sub _build_started_at {
69: my $self = shift;
70:
71: return $self->_from_epoch($self->start_at);
72: }
73:
74: ################################################################################
75:
76: 1;
77:
78: __END__
79:
80: =pod
81:
82: =encoding UTF-8
83:
84: =head1 NAME
85:
86: WebService::Mattermost::V4::API::Object::Job - A job item.
87:
88: =head1 VERSION
89:
90: version 0.30
91:
92: =head1 DESCRIPTION
93:
94: =head2 METHODS
95:
96: See matching methods in L<WebService::Mattermost::V4::API::Resource::Job>
97: for full documentation.
98:
99: ID parameters are not required:
100:
101: my $response = $mattermost->api->job->get('ID-HERE')->item->cancel();
102:
103: Is the same as:
104:
105: my $response = $mattermost->api->job->cancel('ID-HERE');
106:
107: =over 4
108:
109: =item C<cancel()>
110:
111: =back
112:
113: =head2 ATTRIBUTES
114:
115: =over 4
116:
117: =item C<type>
118:
119: =item C<start_at>
120:
121: =item C<started_at>
122:
123: DateTime.
124:
125: =item C<last_activity_at>
126:
127: =item C<progress>
128:
129: =item C<data>
130:
131: =back
132:
133: =head1 SEE ALSO
134:
135: =over 4
136:
137: =item L<WebService::Mattermost::V4::API::Object::Job>
138:
139: =item L<WebService::Mattermost::V4::API::Object::Jobs>
140:
141: =item L<WebService::Mattermost::V4::API::Object::Role::ID>
142:
143: =item L<WebService::Mattermost::V4::API::Object::Role::CreatedAt>
144:
145: =item L<WebService::Mattermost::V4::API::Object::Role::Status>
146:
147: =back
148:
149: =head1 AUTHOR
150:
151: Mike Jones <mike@netsplit.org.uk>
152:
153: =head1 COPYRIGHT AND LICENSE
154:
155: This software is Copyright (c) 2023 by Mike Jones.
156:
157: This is free software, licensed under:
158:
159: The MIT (X11) License
160:
161: =cut
162: