line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Asana::Workspace; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
2302
|
$WWW::Asana::Workspace::AUTHORITY = 'cpan:GETTY'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$WWW::Asana::Workspace::VERSION = '0.003'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: Asana Workspace Class |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
10
|
use MooX; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'WWW::Asana::Role::HasClient'; |
13
|
|
|
|
|
|
|
with 'WWW::Asana::Role::HasResponse'; |
14
|
|
|
|
|
|
|
with 'WWW::Asana::Role::NewFromResponse'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'WWW::Asana::Role::CanReload'; |
17
|
|
|
|
|
|
|
with 'WWW::Asana::Role::CanUpdate'; |
18
|
|
|
|
|
|
|
# CanNotCreate |
19
|
|
|
|
|
|
|
# CanNotDelete |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
0
|
|
sub own_base_args { 'workspaces', shift->id } |
22
|
0
|
|
|
0
|
0
|
|
sub reload_base_args { 'Workspace', 'GET' } |
23
|
|
|
|
|
|
|
sub update_args { |
24
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
25
|
0
|
|
|
|
|
|
'Workspace', 'PUT', $self->own_base_args, { |
26
|
|
|
|
|
|
|
name => $self->name |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
|
939
|
use WWW::Asana::Task; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
1112
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has id => ( |
34
|
|
|
|
|
|
|
is => 'ro', |
35
|
|
|
|
|
|
|
required => 1, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has name => ( |
40
|
|
|
|
|
|
|
is => 'ro', |
41
|
|
|
|
|
|
|
required => 1, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub tasks { |
46
|
0
|
|
|
0
|
1
|
|
my ( $self, $assignee ) = @_; |
47
|
0
|
0
|
0
|
|
|
|
die 'tasks need a WWW::Asana::User or "me" as parameter' unless ref $assignee eq "WWW::Asana::User" or $assignee eq "me"; |
48
|
|
|
|
|
|
|
$self->do('[Task]', 'GET', $self->own_base_args, 'tasks', [ |
49
|
|
|
|
|
|
|
assignee => ref $assignee eq "WWW::Asana::User" ? $assignee->id : $assignee, |
50
|
0
|
0
|
|
0
|
|
|
], sub { my ( %data ) = @_; defined $data{workspace} ? () : ( workspace => $self ) }); |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub projects { |
55
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
56
|
0
|
|
|
0
|
|
|
$self->do('[Project]', 'GET', $self->own_base_args, 'projects', sub { workspace => $self }); |
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub tags { |
61
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
62
|
0
|
|
|
0
|
|
|
$self->do('[Tag]', 'GET', $self->own_base_args, 'tags', sub { workspace => $self }); |
|
0
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub create_tag { |
67
|
0
|
|
|
0
|
1
|
|
my ( $self, $name ) = @_; |
68
|
0
|
0
|
|
|
|
|
if (ref $name eq 'WWW::Asana::Tag') { |
69
|
0
|
0
|
|
|
|
|
die "Given WWW::Asana::Tag has id, and so is already created" if $name->has_id; |
70
|
0
|
|
|
|
|
|
$name = $name->name; |
71
|
|
|
|
|
|
|
} |
72
|
0
|
|
|
|
|
|
$self->do('Tag', 'POST', $self->own_base_args, 'tags', { name => $name }); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub create_task { |
77
|
0
|
|
|
0
|
1
|
|
my ( $self, $attr ) = @_; |
78
|
0
|
0
|
|
|
|
|
die __PACKAGE__."->new_task needs a HashRef as parameter" unless ref $attr eq 'HASH'; |
79
|
0
|
|
|
|
|
|
my %data = %{$attr}; |
|
0
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$data{workspace} = $self; |
81
|
0
|
0
|
|
|
|
|
$data{client} = $self->client if $self->has_client; |
82
|
0
|
|
|
|
|
|
return WWW::Asana::Task->new(%data)->create; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |