line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::WebService::Tracks::Project; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
9791
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
6
|
use parent 'AnyEvent::WebService::Tracks::Resource'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
63
|
use Carp qw(croak); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
59
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->readonly(qw/completed_at created_at id updated_at/); |
14
|
|
|
|
|
|
|
__PACKAGE__->accessor(qw/description name position/); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# here, but not actually accessible: default_context_id state |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub resource_path { |
19
|
0
|
|
|
0
|
1
|
|
return 'projects'; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub xml_root { |
23
|
0
|
|
|
0
|
1
|
|
return 'project'; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub is_complete { |
27
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return $self->{'state'} eq 'completed' |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub is_active { |
33
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $self->{'state'} eq 'active'; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub is_hidden { |
39
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return $self->{'state'} eq 'hidden'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub default_context { |
45
|
0
|
|
|
0
|
1
|
|
my ( $self, $cb_or_ctx ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if(ref($cb_or_ctx) eq 'CODE') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $id = $self->{'default_context_id'}; |
49
|
0
|
0
|
|
|
|
|
if(defined $id) { |
50
|
0
|
|
|
|
|
|
$self->{'parent'}->fetch_single('contexts', $id, |
51
|
|
|
|
|
|
|
'AnyEvent::WebService::Tracks::Context', $cb_or_ctx); |
52
|
|
|
|
|
|
|
} else { |
53
|
0
|
|
|
|
|
|
$cb_or_ctx->(undef); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} elsif(ref($cb_or_ctx) eq 'AnyEvent::WebService::Tracks::Context') { |
56
|
0
|
|
|
|
|
|
$self->{'default_context_id'} = $cb_or_ctx->id; |
57
|
0
|
|
|
|
|
|
$self->{'_dirty'}{'default_context_id'} = 1; |
58
|
|
|
|
|
|
|
} elsif(! defined($cb_or_ctx)) { |
59
|
0
|
|
|
|
|
|
$self->{'default_context_id'} = undef; |
60
|
0
|
|
|
|
|
|
$self->{'_dirty'}{'default_context_id'} = 1; |
61
|
|
|
|
|
|
|
} else { |
62
|
0
|
|
|
|
|
|
croak "AnyEvent::WebService::Tracks::Project::default_context accepts either a CODE reference or an AnyEvent::WebService::Tracks::Context"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub complete { |
67
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$self->{'state'} = 'completed'; |
70
|
0
|
|
|
|
|
|
$self->{'_dirty'}{'state'} = 1; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub activate { |
74
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
$self->{'state'} = 'active'; |
77
|
0
|
|
|
|
|
|
$self->{'_dirty'}{'state'} = 1; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub hide { |
81
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$self->{'state'} = 'hidden'; |
84
|
0
|
|
|
|
|
|
$self->{'_dirty'}{'state'} = 1; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub todos { |
88
|
0
|
|
|
0
|
1
|
|
my ( $self, $cb ) = @_; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $id = $self->id; |
91
|
0
|
|
|
|
|
|
$self->{'parent'}->fetch_multiple("projects/$id/todos", |
92
|
|
|
|
|
|
|
'AnyEvent::WebService::Tracks::Todo', $cb); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |