[Bps-public-commit] r14741 - in Net-Hiveminder/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Sun Aug 3 19:32:33 EDT 2008
Author: sartak
Date: Sun Aug 3 19:32:33 2008
New Revision: 14741
Modified:
Net-Hiveminder/trunk/ (props changed)
Net-Hiveminder/trunk/lib/Net/Hiveminder.pm
Log:
r54005 at gorgoroth: sartak | 2008-08-03 19:31:03 -0400
Move the POD to the end of the file, after __END__
Modified: Net-Hiveminder/trunk/lib/Net/Hiveminder.pm
==============================================================================
--- Net-Hiveminder/trunk/lib/Net/Hiveminder.pm (original)
+++ Net-Hiveminder/trunk/lib/Net/Hiveminder.pm Sun Aug 3 19:32:33 2008
@@ -3,39 +3,10 @@
use Moose;
extends 'Net::Jifty';
-use Number::RecordLocator;
-my $LOCATOR = Number::RecordLocator->new;
-
-=head1 NAME
-
-Net::Hiveminder - Perl interface to hiveminder.com
-
-=head1 VERSION
-
-Version 0.05 released 17 Mar 08
-
-=cut
-
our $VERSION = '0.05';
-=head1 SYNOPSIS
-
- use Net::Hiveminder;
- my $hm = Net::Hiveminder->new(use_config => 1);
- print $hm->todo;
- $hm->create_task("Boy these pretzels are making me thirsty [due tomorrow]");
-
-=head1 DESCRIPTION
-
-Hiveminder is a collaborate todo list organizer, built with L<Jifty>.
-
-This module uses Hiveminder's REST API to let you manage your tasks any way you
-want to.
-
-This module is built on top of L<Net::Jifty>. Consult that module's
-documentation for the lower-level interface.
-
-=cut
+use Number::RecordLocator;
+my $LOCATOR = Number::RecordLocator->new;
has '+site' => (
default => 'http://hiveminder.com'
@@ -57,32 +28,6 @@
default => ".hm",
);
-=head2 display_tasks [ARGS], TASKS
-
-This will take a list of hash references, C<TASKS>, and convert each to a
-human-readable form.
-
-In scalar context it will return the readable forms of these tasks joined by
-newlines.
-
-Passing options into this is somewhat tricky, because tasks are currently
-regular hashes. You may pass arguments to this method as such:
-
- $hm->display_tasks([arg1 => 'val1', arg2 => 'val2'], @tasks)
-
-The arguments currently respected are:
-
-=over 4
-
-=item linkify_locator
-
-Make the record locator (C<#foo>) into an HTML link, pointing to the task on
-C<site>.
-
-=back
-
-=cut
-
sub display_tasks {
my $self = shift;
my @out;
@@ -153,16 +98,6 @@
return wantarray ? @out : join "\n", @out;
}
-=head2 get_tasks ARGS
-
-Runs a search with C<ARGS> for tasks. There are no defaults here, so this can
-be used for anything.
-
-Returns a list of hash references, each one being a task. Use C<display_tasks>
-if necessary.
-
-=cut
-
sub get_tasks {
my $self = shift;
my @args = @_;
@@ -171,14 +106,6 @@
return @{ $self->act('TaskSearch', @args)->{content}{tasks} };
}
-=head2 todo_tasks [ARGS]
-
-Returns a list of hash references, each one a task. This uses the same query
-that the home page of Hiveminder uses. The optional C<ARGS> will be passed as
-well so you can narrow down your todo list.
-
-=cut
-
sub todo_tasks {
my $self = shift;
my @args = @_;
@@ -199,22 +126,6 @@
);
}
-=head2 todo [ARGS]
-
-Returns a list of tasks in human-readable form. The optional C<ARGS> will be
-passed as well so you can narrow down your todo list.
-
-In scalar context it will return the concatenation of the tasks.
-
-If the first argument is an array reference, it will be passed to
-L</display_tasks> as options.
-
-For example, to display tasks due today (with color):
-
- print scalar $hm->todo([color => 1], due => "today");
-
-=cut
-
sub todo {
my $self = shift;
my $opts = [];
@@ -223,13 +134,6 @@
$self->display_tasks( $opts, $self->todo_tasks(@_) );
}
-=head2 create_task SUMMARY, ARGS
-
-Creates a new task with C<SUMMARY>. You may also specify arguments such as what
-tags the task will have.
-
-=cut
-
sub create_task {
my $self = shift;
my $summary = shift;
@@ -242,12 +146,6 @@
);
}
-=head2 read_task LOCATOR
-
-Load task C<LOCATOR>.
-
-=cut
-
sub read_task {
my $self = shift;
my $loc = shift;
@@ -256,12 +154,6 @@
return $self->read(Task => id => $id);
}
-=head2 update_task LOCATOR, ARGS
-
-Update task C<LOCATOR> with C<ARGS>.
-
-=cut
-
sub update_task {
my $self = shift;
my $loc = shift;
@@ -270,12 +162,6 @@
return $self->update(Task => id => $id, @_);
}
-=head2 delete_task LOCATOR
-
-Delete task C<LOCATOR>.
-
-=cut
-
sub delete_task {
my $self = shift;
my $loc = shift;
@@ -284,26 +170,6 @@
return $self->delete(Task => id => $id);
}
-=head2 bulk_update ARGS
-
-Bulk-updates the given tasks. You can pass tasks in with one or more of the
-following:
-
-=over 4
-
-=item tasks
-
-An array reference of task hashes or locators, or a space-delimited string of
-locators.
-
-=item ids
-
-An array reference or space-delimited string of task IDs.
-
-=back
-
-=cut
-
sub bulk_update {
my $self = shift;
my %args = @_;
@@ -335,12 +201,6 @@
);
}
-=head2 complete_tasks TASKS
-
-Marks the list of tasks or locators as complete.
-
-=cut
-
sub complete_tasks {
my $self = shift;
$self->bulk_update(
@@ -349,28 +209,6 @@
);
}
-=head2 braindump TEXT[, ARGS]
-
-Braindumps C<TEXT>.
-
-Optional arguments:
-
-=over 4
-
-=item tokens => string | arrayref
-
-tokens may be used to provide default attributes to all the braindumped tasks
-(this is part of what the filter feature of Hiveminder's IM bot does).
-
-=item returns => 'ids' | 'tasks'
-
-Return the affected task IDs, or the tasks themselves, instead of a summary of
-the changes made.
-
-=back
-
-=cut
-
sub braindump {
my $self = shift;
my $text = shift;
@@ -404,12 +242,6 @@
return $ret->{message};
}
-=head2 upload_text TEXT
-
-Uploads C<TEXT> to BTDT::Action::UploadTasks.
-
-=cut
-
sub upload_text {
my $self = shift;
my $text = shift;
@@ -418,12 +250,6 @@
->{message};
}
-=head2 upload_file FILENAME
-
-Uploads C<FILENAME> to BTDT::Action::UploadTasks.
-
-=cut
-
sub upload_file {
my $self = shift;
my $file = shift;
@@ -433,17 +259,6 @@
return $self->upload_text($text);
}
-=head2 download_text
-
-Downloads your tasks. This also gets the metadata so that you can edit the text
-and upload it, and it'll make the same changes to your task list.
-
-This does not currently accept query arguments, because Hiveminder expects a
-"/not/owner/me/group/personal" type argument string, when all we can produce is
-"owner_not => 'me', group => 'personal'"
-
-=cut
-
sub download_text {
my $self = shift;
my $query = shift;
@@ -454,16 +269,6 @@
)->{content}{result};
}
-=head2 download_file FILENAME
-
-Downloads your tasks and puts them into C<FILENAME>.
-
-This does not currently accept query arguments, because Hiveminder expects a
-"/not/owner/me/group/personal" type argument string, when all we can produce is
-"owner_not => 'me', group => 'personal'"
-
-=cut
-
sub download_file {
my $self = shift;
my $file = shift;
@@ -475,13 +280,6 @@
close $handle;
}
-=head2 priority (NUMBER | TASK) -> Maybe String
-
-Returns the "word" of a priority. One of: lowest, low, normal, high, highest.
-If the priority is out of range, C<undef> will be returned.
-
-=cut
-
my @priorities = (undef, qw/lowest low normal high highest/);
sub priority {
my $self = shift;
@@ -494,12 +292,6 @@
return $priorities[$priority];
}
-=head2 done LOCATORS
-
-Marks the given tasks as complete.
-
-=cut
-
sub done {
my $self = shift;
@@ -509,12 +301,6 @@
}
}
-=head2 loc2id (LOCATOR|TASK)s -> IDs
-
-Transforms the given record locators (or tasks) to regular IDs.
-
-=cut
-
sub loc2id {
my $self = shift;
@@ -538,12 +324,6 @@
loc2id(@_);
}
-=head2 id2loc IDs -> LOCATORs
-
-Transform the given IDs into record locators.
-
-=cut
-
sub id2loc {
my $self = shift;
@@ -552,12 +332,6 @@
return wantarray ? @locs : $locs[0];
}
-=head2 comments_on TASK -> (String)s
-
-Returns a list of the comments on the given task.
-
-=cut
-
sub comments_on {
my $self = shift;
my $task = $self->loc2id(shift);
@@ -567,15 +341,6 @@
@{ $self->search('TaskEmail', task_id => $task) || [] };
}
-=head2 comment_on TASK, MESSAGE
-
-Add a comment to TASK.
-
-This method requires L<Email::Simple::Creator>, which is an optional dependency
-of Net::Hiveminder. If Creator is unavailable, then this will throw an error.
-
-=cut
-
sub comment_on {
my $self = shift;
my $task = $self->loc2id(shift);
@@ -597,12 +362,6 @@
);
}
-=head2 send_feedback TEXT
-
-Sends the given TEXT as feedback to the Hiveminder team.
-
-=cut
-
sub send_feedback {
my $self = shift;
my $text = shift;
@@ -610,6 +369,202 @@
$self->act('SendFeedback', content => $text);
}
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
+__END__
+
+=head1 NAME
+
+Net::Hiveminder - Perl interface to hiveminder.com
+
+=head1 SYNOPSIS
+
+ use Net::Hiveminder;
+ my $hm = Net::Hiveminder->new(use_config => 1);
+ print $hm->todo;
+ $hm->create_task("Boy these pretzels are making me thirsty [due tomorrow]");
+
+=head1 DESCRIPTION
+
+Hiveminder is a collaborate todo list organizer, built with L<Jifty>.
+
+This module uses Hiveminder's REST API to let you manage your tasks any way you
+want to.
+
+This module is built on top of L<Net::Jifty>. Consult that module's
+documentation for the lower-level interface.
+
+=head2 display_tasks [ARGS], TASKS
+
+This will take a list of hash references, C<TASKS>, and convert each to a
+human-readable form.
+
+In scalar context it will return the readable forms of these tasks joined by
+newlines.
+
+Passing options into this is somewhat tricky, because tasks are currently
+regular hashes. You may pass arguments to this method as such:
+
+ $hm->display_tasks([arg1 => 'val1', arg2 => 'val2'], @tasks)
+
+The arguments currently respected are:
+
+=over 4
+
+=item linkify_locator
+
+Make the record locator (C<#foo>) into an HTML link, pointing to the task on
+C<site>.
+
+=back
+
+=head2 get_tasks ARGS
+
+Runs a search with C<ARGS> for tasks. There are no defaults here, so this can
+be used for anything.
+
+Returns a list of hash references, each one being a task. Use C<display_tasks>
+if necessary.
+
+=head2 todo_tasks [ARGS]
+
+Returns a list of hash references, each one a task. This uses the same query
+that the home page of Hiveminder uses. The optional C<ARGS> will be passed as
+well so you can narrow down your todo list.
+
+=head2 todo [ARGS]
+
+Returns a list of tasks in human-readable form. The optional C<ARGS> will be
+passed as well so you can narrow down your todo list.
+
+In scalar context it will return the concatenation of the tasks.
+
+If the first argument is an array reference, it will be passed to
+L</display_tasks> as options.
+
+For example, to display tasks due today (with color):
+
+ print scalar $hm->todo([color => 1], due => "today");
+
+=head2 create_task SUMMARY, ARGS
+
+Creates a new task with C<SUMMARY>. You may also specify arguments such as what
+tags the task will have.
+
+=head2 read_task LOCATOR
+
+Load task C<LOCATOR>.
+
+=head2 update_task LOCATOR, ARGS
+
+Update task C<LOCATOR> with C<ARGS>.
+
+=head2 delete_task LOCATOR
+
+Delete task C<LOCATOR>.
+
+=head2 bulk_update ARGS
+
+Bulk-updates the given tasks. You can pass tasks in with one or more of the
+following:
+
+=over 4
+
+=item tasks
+
+An array reference of task hashes or locators, or a space-delimited string of
+locators.
+
+=item ids
+
+An array reference or space-delimited string of task IDs.
+
+=back
+
+=head2 complete_tasks TASKS
+
+Marks the list of tasks or locators as complete.
+
+=head2 braindump TEXT[, ARGS]
+
+Braindumps C<TEXT>.
+
+Optional arguments:
+
+=over 4
+
+=item tokens => string | arrayref
+
+tokens may be used to provide default attributes to all the braindumped tasks
+(this is part of what the filter feature of Hiveminder's IM bot does).
+
+=item returns => 'ids' | 'tasks'
+
+Return the affected task IDs, or the tasks themselves, instead of a summary of
+the changes made.
+
+=back
+
+=head2 upload_text TEXT
+
+Uploads C<TEXT> to BTDT::Action::UploadTasks.
+
+=head2 upload_file FILENAME
+
+Uploads C<FILENAME> to BTDT::Action::UploadTasks.
+
+=head2 download_text
+
+Downloads your tasks. This also gets the metadata so that you can edit the text
+and upload it, and it'll make the same changes to your task list.
+
+This does not currently accept query arguments, because Hiveminder expects a
+"/not/owner/me/group/personal" type argument string, when all we can produce is
+"owner_not => 'me', group => 'personal'"
+
+=head2 download_file FILENAME
+
+Downloads your tasks and puts them into C<FILENAME>.
+
+This does not currently accept query arguments, because Hiveminder expects a
+"/not/owner/me/group/personal" type argument string, when all we can produce is
+"owner_not => 'me', group => 'personal'"
+
+=head2 priority (NUMBER | TASK) -> Maybe String
+
+Returns the "word" of a priority. One of: lowest, low, normal, high, highest.
+If the priority is out of range, C<undef> will be returned.
+
+=head2 done LOCATORS
+
+Marks the given tasks as complete.
+
+=head2 loc2id (LOCATOR|TASK)s -> IDs
+
+Transforms the given record locators (or tasks) to regular IDs.
+
+=head2 id2loc IDs -> LOCATORs
+
+Transform the given IDs into record locators.
+
+=head2 comments_on TASK -> (String)s
+
+Returns a list of the comments on the given task.
+
+=head2 comment_on TASK, MESSAGE
+
+Add a comment to TASK.
+
+This method requires L<Email::Simple::Creator>, which is an optional dependency
+of Net::Hiveminder. If Creator is unavailable, then this will throw an error.
+
+=head2 send_feedback TEXT
+
+Sends the given TEXT as feedback to the Hiveminder team.
+
=head1 SEE ALSO
L<Jifty>, L<Net::Jifty>
@@ -633,8 +588,3 @@
=cut
-__PACKAGE__->meta->make_immutable;
-no Moose;
-
-1;
-
More information about the Bps-public-commit
mailing list