File Coverage

blib/lib/WebService/Toggl/API/TimeEntry.pm
Criterion Covered Total %
statement 12 14 85.7
branch n/a
condition n/a
subroutine 4 6 66.6
pod n/a
total 16 20 80.0


line stmt bran cond sub pod time code
1             package WebService::Toggl::API::TimeEntry;
2              
3 1     1   1034 use Sub::Quote qw(quote_sub);
  1         2  
  1         49  
4 1     1   4 use WebService::Toggl::Role::Item as => 'JsonItem';
  1         1  
  1         5  
5              
6 1     1   27 use Moo;
  1         1  
  1         3  
7             with 'WebService::Toggl::Role::API';
8 1     1   324 use namespace::clean;
  1         2  
  1         5  
9              
10             with JsonItem(
11             bools => [ qw(billable duronly) ],
12             strings => [ qw(start stop description created_with ) ],
13             integers => [ qw(id wid pid tid duration) ],
14             timestamps => [ qw(at) ],
15             floats => [ qw() ],
16             );
17              
18             # ArrayRef
19             has tags => (is => 'ro', lazy => 1, builder => quote_sub(qq| \$_[0]->raw->{$_} |));
20              
21              
22 0     0     sub api_path { 'time_entries' }
23 0     0     sub api_id { shift->id }
24              
25              
26              
27             1;
28             __END__
29             {
30             "data" : {
31             "id":436694100,
32             "wid":777,
33             "pid":193791,
34             "tid":13350500,
35             "billable":false,
36             "start":"2013-02-27T01:24:00+00:00",
37             "stop":"2013-02-27T07:24:00+00:00",
38             "duration":21600,
39             "description":"Some serious work",
40             "tags":["billed"],
41             "at":"2013-02-27T13:49:18+00:00"
42             }
43             }
44              
45              
46             The requests are scoped with the user whose API token is used. Only his/her time entries are updated, retrieved and created.
47              
48             Time entry has the following properties
49              
50             description: (string, strongly suggested to be used)
51             wid: workspace ID (integer, required if pid or tid not supplied)
52             pid: project ID (integer, not required)
53             tid: task ID (integer, not required)
54             billable: (boolean, not required, default false, available for pro workspaces)
55             start: time entry start time (string, required, ISO 8601 date and time)
56             stop: time entry stop time (string, not required, ISO 8601 date and time)
57             duration: time entry duration in seconds. If the time entry is currently running, the duration attribute contains a negative value, denoting the start of the time entry in seconds since epoch (Jan 1 1970). The correct duration can be calculated as current_time + duration, where current_time is the current time in seconds since epoch. (integer, required)
58             created_with: the name of your client app (string, required)
59             tags: a list of tag names (array of strings, not required)
60             duronly: should Toggl show the start and stop time of this time entry? (boolean, not required)
61             at: timestamp that is sent in the response, indicates the time item was last updated