File Coverage

blib/lib/WebService/SlimTimer/Task.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 36 36 100.0


line stmt bran cond sub pod time code
1             # PODNAME: WebService::SlimTimer::Task
2             #
3             # ABSTRACT: Represents a single SlimTimer task.
4              
5 3     3   234498 use MooseX::Declare;
  3         3607876  
  3         54  
6              
7             class WebService::SlimTimer::Task
8 3     3   103419 {
  3     3   9  
  3     3   117  
  3     3   62018  
  3         8  
  3         33  
  3         19765  
  3         10  
  3         40  
  3         365  
9              
10              
11 3     3   153 use strict;
  3         5  
  3         94  
12 3     3   17 use warnings;
  3         5  
  3         114  
13              
14 3     3   18 use MooseX::Types::Moose qw(Int Num Str);
  3         5  
  3         41  
15 3     3   19627 use WebService::SlimTimer::Types qw(TimeStamp OptionalTimeStamp);
  3         9124  
  3         25  
16              
17             has id => ( is => 'ro', isa => Int, required => 1 );
18             has name => ( is => 'ro', isa => Str, required => 1 );
19             has created_at => ( is => 'ro', isa => TimeStamp, required => 1, coerce => 1 );
20             has updated_at => ( is => 'ro', isa => TimeStamp, required => 1, coerce => 1 );
21             has hours => ( is => 'ro', isa => Num, required => 1 );
22             has completed_on => ( is => 'ro', isa => OptionalTimeStamp, coerce => 1 );
23              
24             # TODO: Add more fields:
25             # - role: comma-separated list of (owner, coworker, reporter)
26             # - tags: comma-separated list of arbitrary words
27             # - owners: list of persons (name + user_id + email)
28             # - reports: list of persons
29             # - coworkers: list of persons
30              
31 3     3   16207 }
32              
33             __END__
34             =pod
35              
36             =head1 NAME
37              
38             WebService::SlimTimer::Task - Represents a single SlimTimer task.
39              
40             =head1 VERSION
41              
42             version 0.005
43              
44             =head1 SYNOPSIS
45              
46             The objects of this class repesent a SlimTimer task. These objects are not
47             created directly but rather retrieved from L<WebService::SlimTimer> using its
48             C<list_tasks()> or C<get_task()> methods.
49              
50             # Print the time spent on each task.
51             my @tasks = $st->list_tasks();
52             for my $task (@tasks) {
53             printf "%-30s %9.2f\n", $task->name, $task->hours
54             }
55              
56             =head1 ATTRIBUTES
57              
58             =head2 id
59              
60             Numeric task id. The id never changes after the task creation and can be
61             cached locally.
62              
63             =head2 name
64              
65             The task name as an arbitrary string. Notice that it is possible, although
66             confusing, to have more than one task with the same name, use C<id> to
67             uniquely identify the task.
68              
69             =head2 created_at
70              
71             The time when the task was created.
72              
73             =head2 updated_at
74              
75             The time when the task was last updated.
76              
77             =head2 hours
78              
79             Total hours spent on this task as recorded on the server. This is a floating
80             point number.
81              
82             =head2 completed_on
83              
84             Boolean flag indicating whether the task was completed. The tasks created with
85             L<WebService::SlimTimer/create_task> are not initially completed, use
86             L<WebService::SlimTimer/complete_task> to mark them as completed.
87              
88             =head1 SEE ALSO
89              
90             L<WebService::SlimTimer>
91              
92             =head1 AUTHOR
93              
94             Vadim Zeitlin <vz-cpan@zeitlins.org>
95              
96             =head1 COPYRIGHT AND LICENSE
97              
98             This software is copyright (c) 2011 by Vadim Zeitlin.
99              
100             This is free software; you can redistribute it and/or modify it under
101             the same terms as the Perl 5 programming language system itself.
102              
103             =cut
104