File Coverage

blib/lib/App/Toodledo/Location.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             package App::Toodledo::Location;
2 2     2   5679 use strict;
  2         4  
  2         53  
3 2     2   12 use warnings;
  2         4  
  2         76  
4              
5             our $VERSION = '1.00';
6              
7 2     2   10 use Carp;
  2         4  
  2         110  
8 2     2   11 use Moose;
  2         4  
  2         12  
9 2     2   11066 use MooseX::Method::Signatures;
  2         4  
  2         17  
10 2     2   618 use App::Toodledo::LocationInternal;
  2         6  
  2         59  
11              
12 2     2   12 use Moose::Util::TypeConstraints;
  2         4  
  2         15  
13 2     2   3695 BEGIN { class_type 'App::Toodledo' };
14              
15             extends 'App::Toodledo::InternalWrapper';
16              
17             has object => ( is => 'ro', isa => 'App::Toodledo::LocationInternal',
18             default => sub { App::Toodledo::LocationInternal->new },
19             handles => sub { __PACKAGE__->internal_attributes( $_[1] ) } );
20              
21              
22 2     2   83386 method add ( App::Toodledo $todo! ) {
23             my @args = ( name => $self->name );
24             $self->$_ and push @args, ( $_ => $self->$_ ) for qw(description lat lon);
25             my $added_ref = $todo->call_func( location => add => { @args } );
26             $added_ref->[0]{id};
27             }
28              
29              
30             1;
31              
32             __END__
33              
34             =head1 NAME
35              
36             App::Toodledo::Location - class encapsulating a Toodledo location
37              
38             =head1 SYNOPSIS
39              
40             $location = App::Toodledo::Location->new;
41             $location->name( 'Sydney' )
42             $todo = App::Toodledo->new;
43             $todo->add_location( $location );
44              
45             =head1 DESCRIPTION
46              
47             This class provides accessors for the properties of a Toodledo location.
48             The attributes of a location are defined in the L<App::Toodledo::LocationRole>
49             module.
50              
51             =head1 AUTHOR
52              
53             Peter J. Scott, C<< <cpan at psdt.com> >>
54              
55             =head1 SEE ALSO
56              
57             Toodledo: L<http://www.toodledo.com/>.
58              
59             Toodledo API documentation: L<http://www.toodledo.com/info/api_doc.php>.
60              
61             =head1 COPYRIGHT & LICENSE
62              
63             Copyright 2009-2011 Peter J. Scott, all rights reserved.
64              
65             This program is free software; you can redistribute it and/or modify it
66             under the same terms as Perl itself.
67              
68             =cut