| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WebService::Toggl::API::Workspace; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 1069 | use WebService::Toggl::Role::Item as => 'JsonItem'; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 1 |  |  | 1 |  | 35 | use Moo; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 6 |  |  |  |  |  |  | with 'WebService::Toggl::Role::API'; | 
| 7 | 1 |  |  | 1 |  | 319 | use namespace::clean; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | with JsonItem( | 
| 10 |  |  |  |  |  |  | bools => [ qw( | 
| 11 |  |  |  |  |  |  | admin only_admins_may_create_projects | 
| 12 |  |  |  |  |  |  | only_admins_see_billable_rates | 
| 13 |  |  |  |  |  |  | only_admins_see_team_dashboard | 
| 14 |  |  |  |  |  |  | premium projects_billable_by_default | 
| 15 |  |  |  |  |  |  | ) ], | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | strings => [ qw( | 
| 18 |  |  |  |  |  |  | api_token default_currency ical_url logo_url name | 
| 19 |  |  |  |  |  |  | ) ], | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | integers => [ qw(id rounding rounding_minutes) ], | 
| 22 |  |  |  |  |  |  | floats   => [ qw(default_hourly_rate) ], | 
| 23 |  |  |  |  |  |  | timestamps => [ qw(at) ], | 
| 24 |  |  |  |  |  |  | ); | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 0 |  |  | 0 |  |  | sub api_path { 'workspaces' } | 
| 27 | 0 |  |  | 0 |  |  | sub api_id   { shift->id } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | sub summary_report { | 
| 30 | 0 |  |  | 0 |  |  | my $self = shift; | 
| 31 | 0 |  |  |  |  |  | return $self->new_report( | 
| 32 | 0 |  |  |  |  |  | '::Summary', {workspace_id => $self->id, %{ $_[0] },} | 
| 33 |  |  |  |  |  |  | ); | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | sub users { | 
| 37 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 38 | 0 |  |  |  |  |  | my $res = $self->api_get($self->my_url . '/users'); | 
| 39 | 0 |  |  |  |  |  | $self->new_set_from_raw('::Users', $res->data); | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | sub clients { | 
| 43 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 44 | 0 |  |  |  |  |  | my $response = $self->api_get($self->my_url . '/clients'); | 
| 45 | 0 |  |  |  |  |  | return $self->new_set_from_raw('::Clients', $response->data); | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | # requires: admin | 
| 49 |  |  |  |  |  |  | # params: | 
| 50 |  |  |  |  |  |  | #   active: possible values true/false/both | 
| 51 |  |  |  |  |  |  | #   actual_hours: true|false | 
| 52 |  |  |  |  |  |  | #   only_templates: true|false | 
| 53 |  |  |  |  |  |  | sub projects { | 
| 54 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 55 | 0 |  |  |  |  |  | my $response = $self->api_get($self->my_url . '/projects'); | 
| 56 | 0 |  |  |  |  |  | return $self->new_set_from_raw('::Projects', $response->data); | 
| 57 |  |  |  |  |  |  | } | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | # requires: admin | 
| 60 |  |  |  |  |  |  | # params: | 
| 61 |  |  |  |  |  |  | #   active: possible values true/false/both | 
| 62 |  |  |  |  |  |  | sub tasks { | 
| 63 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 64 | 0 |  |  |  |  |  | my $response = $self->api_get($self->my_url . '/tasks'); | 
| 65 | 0 |  |  |  |  |  | return $self->new_set_from_raw('::Tasks', $response->data); | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | sub tags { | 
| 69 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 70 | 0 |  |  |  |  |  | my $response = $self->api_get($self->my_url . '/tags'); | 
| 71 | 0 |  |  |  |  |  | return $self->new_set_from_raw('::Tags', $response->data); | 
| 72 |  |  |  |  |  |  | } | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | sub workspace_users { | 
| 75 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 76 | 0 |  |  |  |  |  | my $res = $self->api_get($self->my_url . '/workspace_users'); | 
| 77 | 0 |  |  |  |  |  | $self->new_set_from_raw('::WorkspaceUsers', $res->data); | 
| 78 |  |  |  |  |  |  | } | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | 1; | 
| 82 |  |  |  |  |  |  | __END__ | 
| 83 |  |  |  |  |  |  | { | 
| 84 |  |  |  |  |  |  | "data" : { | 
| 85 |  |  |  |  |  |  | "admin" : false, | 
| 86 |  |  |  |  |  |  | "api_token" : "a7ca77c9e1b3ea3dc8123075cbb0fae9", | 
| 87 |  |  |  |  |  |  | "at" : "2014-05-22T13:38:33+00:00", | 
| 88 |  |  |  |  |  |  | "default_currency" : "USD", | 
| 89 |  |  |  |  |  |  | "ical_url" : "/ical/workspace_user/c7cbada99f8abf4b4d815912ab960519", | 
| 90 |  |  |  |  |  |  | "id" : 252748, | 
| 91 |  |  |  |  |  |  | "logo_url" : "https://assets.toggl.com/logos/252748/1130762d267c58b1d62b85c9ca641a4b.jpg", | 
| 92 |  |  |  |  |  |  | "name" : "HemoShear workspace", | 
| 93 |  |  |  |  |  |  | "only_admins_may_create_projects" : true, | 
| 94 |  |  |  |  |  |  | "only_admins_see_billable_rates" : true, | 
| 95 |  |  |  |  |  |  | "only_admins_see_team_dashboard" : false, | 
| 96 |  |  |  |  |  |  | "premium" : true, | 
| 97 |  |  |  |  |  |  | "projects_billable_by_default" : true, | 
| 98 |  |  |  |  |  |  | "rounding" : 1 | 
| 99 |  |  |  |  |  |  | "rounding_minutes" : 1, | 
| 100 |  |  |  |  |  |  | } | 
| 101 |  |  |  |  |  |  | } |