File Coverage

blib/lib/WebService/Toggl/Role/API.pm
Criterion Covered Total %
statement 3 4 75.0
branch n/a
condition n/a
subroutine 1 2 50.0
pod n/a
total 4 6 66.6


line stmt bran cond sub pod time code
1             package WebService::Toggl::Role::API;
2              
3 1     1   8000 use Moo::Role;
  1         2  
  1         5  
4              
5             requires 'api_path';
6              
7             has base_url => (is => 'ro', default => '/api/v8');
8              
9             has my_url => (is => 'ro', lazy => 1, builder => 1);
10 0     0     sub _build_my_url { $_[0]->base_url . '/' . $_[0]->api_path }
11              
12              
13              
14             1;
15             __END__
16              
17             =encoding utf-8
18              
19             =head1 NAME
20              
21             WebService::Toggl::API - Base Role for WebService::Toggl::API Items and Sets
22              
23             =head1 DESCRIPTION
24              
25             This role provide behavoir common to all C<WebService::Toggl::API::>
26             objects.
27              
28             =head1 REQUIRES
29              
30             =head2 api_path
31              
32             Consuming classes must provide their endpoint on the API.
33             Ex. The L<WebService::Toggl::API::Project> object's C<api_path> is
34             C<projects>.
35              
36             =head1 ATTRIBUTES
37              
38             =head2 base_url
39              
40             The base of the URL for the Toggl API. Defaults to C</api/v8>.
41              
42             =head2 my_url
43              
44             URL for the current API object.
45              
46             =head1 LICENSE
47              
48             Copyright (C) Fitz Elliott.
49              
50             This library is free software; you can redistribute it and/or modify
51             it under the same terms as Perl itself.
52              
53             =head1 AUTHOR
54              
55             Fitz Elliott E<lt>felliott@fiskur.orgE<gt>
56              
57             =cut