NAME

WebService::Idonethis - WebScraping pseudo-API for iDoneThis

VERSION

version 0.23

SYNOPSIS

use WebService::Idonethis;

my $idt = WebService::Idonethis->new(
    user => 'someuser',
    pass => 'somepass',
);

my $dones = $idt->get_day("2012-01-01");

foreach my $item (@$dones) {
    say "* $item->{text}";
}

# Get items done today

my $dones = $idt->get_today;

# Submit a new done item.

$idt->set_done(text => "Drank ALL the coffee!");

DESCRIPTION

This is an extremely bare-bones wrapper around the idonethis.com website that allows retrieving of what was done on a particular day. It's only been tested with personal calendars. Patches are extremely welcome.

This code was motivated by idonethis.com's most excellent (but now defunct) memory service, which would send reminders as to what one was doing a year ago by email.

The idonethis-memories command included in this distribution is a simple proof-of-concept that reimplements this service, and is suitable for running as a cron job.

The idone command included with this distribution allows you to submit new done items from the command line.

Patches are extremely welcome. https://github.com/pjf/idonethis-perl

METHODS

get_day

my $dones = $idt->get_day("2012-01-01");

Gets the data for a given day. An array will be returned which is a conversation from the JSON data structure used by idonethis. The structure at the time of writing looks like this:

The 'text' field (and currently only the 'text' field) will have HTML entities converted before it is returned (eg, '>' becomes '>').

[
    {
        owner => 'some_user',
        avatar_url => '/site_media/blahblah/foo.png',
        modified => '2012-01-01T15:22:33.12345',
        calendar => {
            short_name => 'some_short_name', # usually owner name
            name => 'personal',
            type => 'PERSONAL',
        },
        created => '2012-01-01T15:22:33.12345',
        done_date => '2012-01-01',
        text => 'Wrote code to frobinate the foobar',
        nicest_name => 'some_user',
        type => 'dailydone',
        id => 12345
    },
    ...
]

get_today

my $dones = $idt->get_today;

This is a convenience method that calls "get_day" using the current (localtime) date as an argument.

get_range

my $done = $idt->get_range('2012-01-01', '2012-01-31');

Gets everything done in a range of dates. Returns in the same format at "get_day" above.

set_done

$idt->set_done( text => "Installed WebService::Idonethis" );
$idt->set_done( date => '2013-01-01', text => "Drank coffee." );

Submits a done item to idonethis.com. The date field is optional, but the text field is mandatory. The current date (localtime) will be used if no date is specified.

Returns nothing on success. Throws an exception on failure.

FILES

Sessions are cached in your XDG cache directory as 'webservice-idonethis-perl'.

BUGS

If a suitable cache location cannot be created on the filesystem, this class dies with an error. See https://github.com/pjf/idonethis-perl/issues/7 for more details.

Other bugs may be present that are not listed in this documentation. See https://github.com/pjf/idonethis-perl/issues for a full list, or to submit your own.

SEE ALSO

http://privacygeek.blogspot.com.au/2013/02/reimplementing-idonethis-memory-service.html

AUTHOR

Paul Fenwick <pjf@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Paul Fenwick.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.