File Coverage

blib/lib/App/Toodledo/Notebook.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 34 34 100.0


line stmt bran cond sub pod time code
1             package App::Toodledo::Notebook;
2 1     1   3568 use strict;
  1         3  
  1         44  
3 1     1   7 use warnings;
  1         2  
  1         54  
4              
5             our $VERSION = '1.00';
6              
7 1     1   8 use Carp;
  1         4  
  1         79  
8 1     1   6 use Moose;
  1         3  
  1         12  
9 1     1   7659 use MooseX::Method::Signatures;
  1         4  
  1         15  
10 1     1   223 use App::Toodledo::NotebookInternal;
  1         2  
  1         42  
11             with 'MooseX::Log::Log4perl';
12              
13 1     1   7 use Moose::Util::TypeConstraints;
  1         3  
  1         13  
14 1     1   2169 BEGIN { class_type 'App::Toodledo' };
15              
16             extends 'App::Toodledo::InternalWrapper';
17              
18             has object => ( is => 'ro', isa => 'App::Toodledo::NotebookInternal',
19             default => sub { App::Toodledo::NotebookInternal->new },
20             handles => sub { __PACKAGE__->internal_attributes( $_[1] ) } );
21              
22              
23 1     1   62237 method add ( App::Toodledo $todo! ) {
24             my @args = ( name => $self->name );
25             $self->$_ and push @args, ( $_ => $self->$_ )
26             for qw(title folder private added text);
27             my $added_ref = $todo->call_func( notebook => add => { @args } );
28             $added_ref->[0]{id};
29              
30             }
31              
32              
33 1     1   52269 method delete ( App::Toodledo $todo! ) {
34             my $id = $self->id;
35             my $deleted_ref = $todo->call_func( notebook => delete =>
36             { notebooks => [$id] } );
37             $deleted_ref->[0]{id} == $id or $self->log->logdie("Did not get ID back from delete");
38             }
39              
40              
41             1;
42              
43             __END__
44              
45             =head1 NAME
46              
47             App::Toodledo::Notebook - class encapsulating a Toodledo notebook
48              
49             =head1 SYNOPSIS
50              
51             $notebook = App::Toodledo::Notebook->new;
52             $todo = App::Toodledo->new;
53             $todo->add_notebook( $notebook );
54              
55             =head1 DESCRIPTION
56              
57             This class provides accessors for the properties of a Toodledo notebook.
58             The attributes of a notebook are defined in the L<App::Toodledo::NotebookRole>
59             module.
60              
61             =head1 AUTHOR
62              
63             Peter J. Scott, C<< <cpan at psdt.com> >>
64              
65             =head1 SEE ALSO
66              
67             Toodledo: L<http://www.toodledo.com/>.
68              
69             Toodledo API documentation: L<http://www.toodledo.com/info/api_doc.php>.
70              
71             =head1 COPYRIGHT & LICENSE
72              
73             Copyright 2009-2011 Peter J. Scott, all rights reserved.
74              
75             This program is free software; you can redistribute it and/or modify it
76             under the same terms as Perl itself.
77              
78             =cut