File Coverage

blib/lib/WebService/Toggl/API/Project.pm
Criterion Covered Total %
statement 9 17 52.9
branch n/a
condition n/a
subroutine 3 7 42.8
pod n/a
total 12 24 50.0


line stmt bran cond sub pod time code
1             package WebService::Toggl::API::Project;
2              
3 1     1   1156 use WebService::Toggl::Role::Item as => 'JsonItem';
  1         2  
  1         5  
4              
5 1     1   47 use Moo;
  1         1  
  1         8  
6             with 'WebService::Toggl::Role::API';
7 1     1   335 use namespace::clean;
  1         1  
  1         4  
8              
9             with JsonItem(
10             bools => [ qw(active is_private template billable auto_estimates) ],
11             strings => [ qw(name) ],
12             integers => [ qw(id wid cid template_id color estimated_hours) ],
13             timestamps => [ qw(at created_at) ],
14             floats => [ qw(rate) ],
15             );
16              
17              
18 0     0     sub api_path { 'projects' }
19 0     0     sub api_id { shift->id }
20              
21              
22             sub project_users {
23 0     0     my ($self) = @_;
24 0           my $res = $self->api_get($self->my_url . '/project_users');
25 0           return $self->new_set_from_raw('::ProjectUsers', $res->data);
26             }
27              
28             sub tasks {
29 0     0     my ($self) = @_;
30 0           my $res = $self->api_get($self->my_url . '/tasks');
31 0           return $self->new_set_from_raw('::Tasks', $res->data);
32             }
33              
34              
35             1;
36             __END__
37              
38             {
39             "data": {
40             "id":193838628,
41             "wid":777,
42             "cid":123397,
43             "name":"An awesome project",
44             "billable":false,
45             "is_private":true,
46             "active":true,
47             "at":"2013-03-06T12:15:37+00:00",
48             "template":true
49             "color": "5"
50             }
51             }
52              
53              
54             name: The name of the project (string, required, unique for client and workspace)
55             wid: workspace ID, where the project will be saved (integer, required)
56             cid: client ID (integer, not required)
57             active: whether the project is archived or not (boolean, by default true)
58             is_private: whether project is accessible for only project users or for all workspace users (boolean, default true)
59             template: whether the project can be used as a template (boolean, not required)
60             template_id: id of the template project used on current project's creation
61             billable: whether the project is billable or not (boolean, default true, available only for pro workspaces)
62             auto_estimates: whether the estimated hours is calculated based on task estimations or is fixed manually (boolean, default false, not required, premium functionality)
63             estimated_hours: if auto_estimates is true then the sum of task estimations is returned, otherwise user inserted hours (integer, not required, premium functionality)
64             at: timestamp that is sent in the response for PUT, indicates the time task was last updated (read-only)
65             color: id of the color selected for the project
66             rate: hourly rate of the project (float, not required, premium functionality)
67             created_at: timestamp indicating when the project was created (UTC time), read-only
68