File Coverage

blib/lib/WebService/Toggl/API/User.pm
Criterion Covered Total %
statement 12 19 63.1
branch n/a
condition 0 4 0.0
subroutine 4 11 36.3
pod n/a
total 16 34 47.0


line stmt bran cond sub pod time code
1             package WebService::Toggl::API::User;
2              
3 1     1   378 use Sub::Quote qw(quote_sub);
  1         2  
  1         51  
4 1     1   4 use WebService::Toggl::Role::Item as => 'JsonItem';
  1         0  
  1         8  
5              
6 1     1   33 use Moo;
  1         1  
  1         4  
7             with 'WebService::Toggl::Role::API';
8 1     1   320 use namespace::clean;
  1         1  
  1         5  
9              
10             with JsonItem(
11             bools => [ qw(
12             share_experiment send_timer_notifications show_offer
13             timeline_enabled sidebar_piechart manual_mode
14             used_next send_weekly_report timeline_experiment
15             store_start_and_stop_time send_product_emails
16             should_upgrade record_timeline openid_enabled
17             render_timeline case_studies_experiment achievements_enabled
18             ) ],
19              
20             strings => [ qw(
21             openid_email jquery_timeofday_format fullname
22             timeofday_format last_blog_entry timezone duration_format
23             image_url created_at email api_token jquery_date_format
24             language date_format at
25             ) ],
26              
27             integers => [ qw(default_wid retention beginning_of_week id) ]
28             );
29              
30             has $_ => (is => 'ro', lazy => 1, builder => quote_sub(qq| \$_[0]->raw->{$_} |))
31             for (qw(new_blog_post invitation achievements));
32              
33              
34 0     0     sub api_path { 'users' }
35 0     0     sub api_id { shift->id }
36              
37              
38 0     0     sub time_entries { $_[0]->new_set_from_raw('::TimeEntries', $_[0]->raw->{time_entries}) }
39 0     0     sub projects { $_[0]->new_set_from_raw('::Projects', $_[0]->raw->{projects}) }
40 0   0 0     sub tags { $_[0]->new_set_from_raw('::Tags', ($_[0]->raw->{tags} || [])) }
41 0     0     sub workspaces { $_[0]->new_set_from_raw('::Workspaces', $_[0]->raw->{workspaces}) }
42 0   0 0     sub clients { $_[0]->new_set_from_raw('::Clients', $_[0]->raw->{clients} || []) }
43              
44              
45             1;
46             __END__
47              
48             "invitation" : {},
49              
50             "achievements" : [
51             2,
52             10,
53             11,
54             12
55             ],
56              
57             "new_blog_post" : {
58             "pub_date" : "2014-06-17T10:07:45Z",
59             "url" : "http://blog.toggl.com/2014/06/top-3-time-management-mistakes-identified-togglers/?utm_source=rss&utm_medium=rss&utm_campaign=top-3-time-management-mistakes-identified-togglers",
60             "title" : "Top 3 Time Management Mistakes Identified By Togglers",
61             "category" : "Uncategorized"
62             },