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 2     2   11118 use strict;
  2         4  
  2         59  
3 2     2   9 use warnings;
  2         4  
  2         86  
4              
5             our $VERSION = '1.00';
6              
7 2     2   11 use Carp;
  2         4  
  2         121  
8 2     2   10 use Moose;
  2         4  
  2         24  
9 2     2   11820 use MooseX::Method::Signatures;
  2         5  
  2         21  
10 2     2   400 use App::Toodledo::NotebookInternal;
  2         4  
  2         73  
11             with 'MooseX::Log::Log4perl';
12              
13 2     2   11 use Moose::Util::TypeConstraints;
  2         4  
  2         15  
14 2     2   4603 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 2     2   88393 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 2     2   88903 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