App-Toodledo
view release on metacpan or search on metacpan
lib/App/Toodledo/Task.pm view on Meta::CPAN
return $edited_ref->[0]{id};
}
}
method delete ( App::Toodledo $todo! ) {
my $id = $self->id;
my $deleted_ref = $todo->call_func( tasks => delete => { tasks => [$id] } );
$deleted_ref->[0]{id} == $id or $self->log->logdie("Did not get ID back from delete");
}
1;
__END__
=head1 NAME
App::Toodledo::Task - class encapsulating a Toodledo task
=head1 SYNOPSIS
$task = App::Toodledo::Task->new;
$task->title( 'Put the cat out' );
=head1 DESCRIPTION
This class provides accessors for the properties of a Toodledo task.
The attributes of a task are defined in the L<App::Toodledo::TaskRole>
module.
=head1 METHODS
=head2 @tags = $task->tags( [@tags] )
Return the tags of the task as a list (splits the attribute on comma).
If a list is provided, set the tags to that list.
=head2 $task->has_tag( $tag )
Return true if the tag C<$tag> is in the list returned by C<tags()>.
=head2 $task->add_tag( $tag )
Add the given tag. No-op if the task already has that tag.
=head2 $task->remove_tag( $tag )
Remove the given tag. No-op if the task doesn't have that tag.
=head2 $task->edit( @tasks )
This is the method called by:
App::Toodledo::edit( $task )
You can pass multiple tasks to it:
$todo->edit( @tasks )
and they will all be updated.
The current maximum number of tasks you can send to Toodledo for
editing is 50. B<This method does not check for that.> (They
might raise the limit in the future.) Bounds checking is the caller's
responsibility.
=head2 $task->status_str, $task->priority_str
Each of these methods operates on the string defined at
http://api.toodledo.com/2/tasks/index.php, not the integer.
The string will be turned into the integer going into Toodledo
and the integer will get turned into the string coming out.
Examples:
$task->priority_str( 'Top' )
$task->status_str eq 'Hold' and ...
Each method can be used in a App::Toodledo::select call.
=head2 $task->folder_name, $task->context_name, $task->location_name, $task->goal_name
Each of these methods returns and optionally sets the given attribute via
its name rather than the indirect ID that is stored in the task. An
exception is thrown if no object with that name exists when setting it.
Examples:
$task->folder_name( $todo, 'Later' );
$task->context_name( $todo ) eq 'Home' and ...
If the value is null, returns the empty string rather than the Toodledo
display value of "No <Whatever>".
NOTE: An App::Toodledo object must be passed as the first parameter
so it can look up the mapping of objects to names.
=head1 CAVEAT
This is a very basic implementation of Toodledo tasks. It is missing
much that would be helpful with dealing with repeating tasks. Patches
welcome.
=head1 AUTHOR
Peter J. Scott, C<< <cpan at psdt.com> >>
=head1 SEE ALSO
Toodledo: L<http://www.toodledo.com/>.
Toodledo API documentation: L<http://www.toodledo.com/info/api_doc.php>.
=head1 COPYRIGHT & LICENSE
Copyright 2009-2011 Peter J. Scott, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
( run in 1.525 second using v1.01-cache-2.11-cpan-364913b4093 )