| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WebService::Toggl::API::Client; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 10061 | use WebService::Toggl::Role::Item as => 'JsonItem'; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 8 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 1 |  |  | 1 |  | 534 | use Moo; | 
|  | 1 |  |  |  |  | 2409 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 6 |  |  |  |  |  |  | with 'WebService::Toggl::Role::API'; | 
| 7 | 1 |  |  | 1 |  | 1778 | use namespace::clean; | 
|  | 1 |  |  |  |  | 8684 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | with JsonItem( | 
| 10 |  |  |  |  |  |  | bools => [ qw() ], | 
| 11 |  |  |  |  |  |  | strings => [ qw(name notes at) ], | 
| 12 |  |  |  |  |  |  | integers => [ qw(id wid) ] | 
| 13 |  |  |  |  |  |  | ); | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 0 |  |  | 0 |  |  | sub api_path { 'clients' } | 
| 17 | 0 |  |  | 0 |  |  | sub api_id   { shift->id } | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | sub projects { | 
| 21 | 0 |  |  | 0 |  |  | my ($self, $args) = @_; | 
| 22 | 0 |  | 0 |  |  |  | $args ||= {}; | 
| 23 |  |  |  |  |  |  | # todo: validate $args->{active} is [true,false,both] | 
| 24 | 0 |  |  |  |  |  | my $res = $self->api_get($self->my_url . '/projects', $args); | 
| 25 | 0 |  |  |  |  |  | return $self->new_set_from_raw('::Projects', $res->data); | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | 1; | 
| 30 |  |  |  |  |  |  | __END__ | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | =encoding utf-8 | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | =head1 NAME | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | WebService::Toggl::API::Client - Toggl's Client object | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | use WebService::Toggl; | 
| 42 |  |  |  |  |  |  | my $toggl = WebService::Toggl->new({api_key => 'foo'}); | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | This module is a wrapper object around the Toggl detailed report | 
| 47 |  |  |  |  |  |  | L<described here|https://github.com/toggl/toggl_api_docs/blob/master/reports/detailed.md>. | 
| 48 |  |  |  |  |  |  | It returns all of the time entries that match the request criteria. | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =head1 REQUEST ATTRIBUTES | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | Request attributes common to all reports are detailed in the | 
| 53 |  |  |  |  |  |  | L<::Role::Request|WebService::Toggl::Role::Report#REQUEST-ATTRIBUTES> pod. | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | =head2 page | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | Detailed reports are paged.  This attribute sets the requested page. | 
| 58 |  |  |  |  |  |  | If left empty, Toggl will return the first page by default. | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | =head1 RESPONSE ATTRIBUTES | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | Response attributes common to all reports are detailed in the | 
| 63 |  |  |  |  |  |  | L<::Role::Request|WebService::Toggl::Role::Report#RESPONSE-ATTRIBUTES> pod. | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =head2 per_page | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | How many time entries are being returned per page. Current default is | 
| 68 |  |  |  |  |  |  | 50.  This is not settable. | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | =head2 total_count | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | The total number of records found.  This will be the greater of the | 
| 73 |  |  |  |  |  |  | actual number of entries returned and the C<per_page> parameter. | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =head1 REPORT DATA | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | The C<data()> attribute of a C<::Report::Details> object is an | 
| 78 |  |  |  |  |  |  | arrayref of time entry hashrefs.  For the contents of this structure, see the | 
| 79 |  |  |  |  |  |  | L<Toggl API docs|https://github.com/toggl/toggl_api_docs/blob/master/reports/detailed.md>. | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =head1 LICENSE | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | Copyright (C) Fitz Elliott. | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify | 
| 87 |  |  |  |  |  |  | it under the same terms as Perl itself. | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =head1 AUTHOR | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | Fitz Elliott E<lt>felliott@fiskur.orgE<gt> | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | =cut | 
| 94 |  |  |  |  |  |  |  |