File Coverage

blib/lib/WWW/Asana/Project.pm
Criterion Covered Total %
statement 4 12 33.3
branch 0 4 0.0
condition n/a
subroutine 2 7 28.5
pod 0 5 0.0
total 6 28 21.4


line stmt bran cond sub pod time code
1             package WWW::Asana::Project;
2             BEGIN {
3 1     1   3051 $WWW::Asana::Project::AUTHORITY = 'cpan:GETTY';
4             }
5             {
6             $WWW::Asana::Project::VERSION = '0.003';
7             }
8             # ABSTRACT: Asana Project Class
9              
10 1     1   13 use MooX;
  1         3  
  1         9  
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::HasFollowers';
17             with 'WWW::Asana::Role::HasStories';
18              
19             with 'WWW::Asana::Role::CanReload';
20             with 'WWW::Asana::Role::CanUpdate';
21              
22 0     0 0   sub own_base_args { 'projects', shift->id }
23              
24 0     0 0   sub reload_base_args { 'Project', 'GET' }
25             sub update_args {
26 0     0 0   my ( $self ) = @_;
27 0           'Project', 'PUT', $self->own_base_args, $self->value_args;
28             }
29             sub create_args {
30 0     0 0   my ( $self ) = @_;
31 0           'Project', 'POST', 'projects', $self->value_args;
32             }
33             sub value_args {
34 0     0 0   my ( $self ) = @_;
35             return {
36 0 0         workspace => $self->workspace->id,
    0          
37             $self->has_name ? ( name => $self->name ) : (),
38             $self->has_notes ? ( notes => $self->notes ) : (),
39             };
40             }
41              
42             has id => (
43             is => 'ro',
44             predicate => 1,
45             );
46              
47             has name => (
48             is => 'ro',
49             predicate => 1,
50             );
51              
52             has notes => (
53             is => 'ro',
54             predicate => 1,
55             );
56              
57             has archived => (
58             is => 'ro',
59             predicate => 1,
60             );
61              
62             has created_at => (
63             is => 'ro',
64             isa => sub {
65             die "created_at must be a DateTime" unless ref $_[0] eq 'DateTime';
66             },
67             predicate => 1,
68             );
69              
70             has modified_at => (
71             is => 'ro',
72             isa => sub {
73             die "modified_at must be a DateTime" unless ref $_[0] eq 'DateTime';
74             },
75             predicate => 1,
76             );
77              
78             has workspace => (
79             is => 'ro',
80             isa => sub {
81             die "workspace must be a WWW::Asana::Workspace" unless ref $_[0] eq 'WWW::Asana::Workspace';
82             },
83             predicate => 1,
84             );
85              
86             1;
87              
88             __END__