Asana/Workspace.pm

filter: Statementstmt 38.6% 17 / 44 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 21.4% 3 / 14 Podpod 62.5% 5 / 8 totaltotal 29.4% 25 / 85 CC 9 SCAR 21.1
CC
9
Cov
28%
tasks
20.0
create_tag
12.0
create_task
12.0
CRAP 8.2
« Asana/Task.pm ↑ Summary Asana/Role/HasFollowers.pm »
1 package WWW::Asana::Workspace;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $WWW::Asana::Workspace::AUTHORITY = 'cpan:GETTY';
4 }
5 {
6 1 $WWW::Asana::Workspace::VERSION = '0.003';
7 }
8 # ABSTRACT: Asana Workspace Class
9  
10 1 ▶use MooX;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 with 'WWW::Asana::Role::HasClient';
13 1 with 'WWW::Asana::Role::HasResponse';
14 1 with 'WWW::Asana::Role::NewFromResponse';
15  
16 1 with 'WWW::Asana::Role::CanReload';
17 1 with 'WWW::Asana::Role::CanUpdate';
18 # CanNotCreate
19 # CanNotDelete
20  
21 0 ▶sub own_base_args { 'workspaces', shift->id }
Subroutine own_base_args: not called CC=1 SCAR=6.9
Pod undocumented
22 0 ▶sub reload_base_args { 'Workspace', 'GET' }
Subroutine reload_base_args: not called CC=1 SCAR=6.9
Pod undocumented
23 0 ▶sub update_args {
Subroutine update_args: not called CC=1 SCAR=6.9
Pod undocumented
24 0 my ( $self ) = @_;
25 0 'Workspace', 'PUT', $self->own_base_args, {
26 name => $self->name
27 }
28 }
29  
30 1 ▶use WWW::Asana::Task;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32  
33 1 has id => (
34 is => 'ro',
35 required => 1,
36 );
37  
38  
39 1 has name => (
40 is => 'ro',
41 required => 1,
42 );
43  
44  
45 0 ▶sub tasks {
Subroutine tasks: not called CC=4 SCAR=30.0
Pod documented
46 0 my ( $self, $assignee ) = @_;
47 0 ▶ die 'tasks need a WWW::Asana::User or "me" as parameter' unless ref $assignee eq "WWW::Asana::User" or $assignee eq "me";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $assignee eq "WWW::Asana::User" or $assignee eq "me" 0 0 0
Condition0%0/3
ref $assignee eq "WWW::Asana::User" or $assignee eq "me"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $assignee eq "WWW::Asana::User" or $assignee eq "me"
ref $assignee eq "WWW::Asana::User" $assignee eq "me"
Truth table0%0/3
A or B
A= ref $assignee eq "WWW::Asana::User"B= $assignee eq "me"
ABresult
1X1
011
000
48 $self->do('[Task]', 'GET', $self->own_base_args, 'tasks', [
49 assignee => ref $assignee eq "WWW::Asana::User" ? $assignee->id : $assignee,
50 0 ▶ ], sub { my ( %data ) = @_; defined $data{workspace} ? () : ( workspace => $self ) });
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 2 branches
BranchTrueFalseTotal
ref $assignee eq 'WWW::Asana::User' ? : 0 0 0
defined $data{'workspace'} ? : 0 0 0
51 }
52  
53  
54 0 ▶sub projects {
Subroutine projects: not called CC=1 SCAR=6.9
Pod documented
55 0 my ( $self ) = @_;
56 0 ▶ $self->do('[Project]', 'GET', $self->own_base_args, 'projects', sub { workspace => $self });
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 }
58  
59  
60 0 ▶sub tags {
Subroutine tags: not called CC=1 SCAR=6.9
Pod documented
61 0 my ( $self ) = @_;
62 0 ▶ $self->do('[Tag]', 'GET', $self->own_base_args, 'tags', sub { workspace => $self });
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 }
64  
65  
66 0 ▶sub create_tag {
Subroutine create_tag: not called CC=3 SCAR=24.8
Pod documented
67 0 my ( $self, $name ) = @_;
68 0 ▶ if (ref $name eq 'WWW::Asana::Tag') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $name eq "WWW::Asana::Tag") 0 0 0
69 0 ▶ die "Given WWW::Asana::Tag has id, and so is already created" if $name->has_id;
Branch: 1 branch
BranchTrueFalseTotal
if $name->has_id 0 0 0
70 0 $name = $name->name;
71 }
72 0 $self->do('Tag', 'POST', $self->own_base_args, 'tags', { name => $name });
73 }
74  
75  
76 0 ▶sub create_task {
Subroutine create_task: not called CC=3 SCAR=24.8
Pod documented
77 0 my ( $self, $attr ) = @_;
78 0 ▶ die __PACKAGE__."->new_task needs a HashRef as parameter" unless ref $attr eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $attr eq "HASH" 0 0 0
79 0 my %data = %{$attr};
80 0 $data{workspace} = $self;
81 0 ▶ $data{client} = $self->client if $self->has_client;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_client 0 0 0
82 0 return WWW::Asana::Task->new(%data)->create;
83 }
84  
85 1 1;
86  
87 __END__
« Asana/Task.pm ↑ Summary Asana/Role/HasFollowers.pm »