summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-12 01:39:44 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-12 01:39:44 -0400
commite9f4e69ad0e27a24b429d5a9a0d6f51e0e2fdab2 (patch)
tree6e684f88a06c5f7744ea1a5a6dbef9874cb08b77
parent8af7f775ca5f056d2f357c16c23bf364f87495a4 (diff)
downloadwww-pinboard-e9f4e69ad0e27a24b429d5a9a0d6f51e0e2fdab2.tar.gz
www-pinboard-e9f4e69ad0e27a24b429d5a9a0d6f51e0e2fdab2.zip
docs
-rw-r--r--bin/pinboard_export2
-rw-r--r--lib/WWW/Pinboard.pm97
2 files changed, 99 insertions, 0 deletions
diff --git a/bin/pinboard_export b/bin/pinboard_export
index 5876809..990915f 100644
--- a/bin/pinboard_export
+++ b/bin/pinboard_export
@@ -1,6 +1,8 @@
#!perl
use strict;
use warnings;
+# PODNAME: pinboard_export
+# ABSTRACT: data exporter for pinboard
use DBI;
use Getopt::Long qw(:config pass_through);
diff --git a/lib/WWW/Pinboard.pm b/lib/WWW/Pinboard.pm
index edcbb9c..585924d 100644
--- a/lib/WWW/Pinboard.pm
+++ b/lib/WWW/Pinboard.pm
@@ -1,16 +1,54 @@
package WWW::Pinboard;
use Moose;
+# ABSTRACT: https://pinboard.in/ API client
use HTTP::Tiny;
use JSON::PP;
use URI;
+=head1 SYNOPSIS
+
+ my $latest_post_sync_time = ...;
+ my $api = WWW::Pinboard->new(token => $token);
+ my $last_updated = $api->update->{update_time};
+ if ($last_updated ge $latest_post_sync_time) {
+ my @posts = @{ $api->all(fromdt => $latest_post_sync_time) };
+ for my $post (@posts) {
+ ...;
+ }
+ }
+
+=head1 DESCRIPTION
+
+This module is a basic client for the L<https://pinboard.in/> API. It currently
+provides methods for each API method in the C<posts/> namespace (patches
+welcome to add support for more methods). Each method takes a hash of
+arguments, which correspond to the parameters documented in the API
+documentation at L<https://pinboard.in/api/>. They can also take an additional
+parameter C<progress>, which will be passed to the C<data_callback> parameter
+of the call to C<get> on the L<HTTP::Tiny> object.
+
+=cut
+
+=attr token
+
+Pinboard API token. You can access your API token at
+L<https://pinboard.in/settings/password>.
+
+=cut
+
has token => (
is => 'ro',
isa => 'Str',
required => 1,
);
+=attr endpoint
+
+URL of the API endpoint. Defaults to C<https://api.pinboard.in/v1/>.
+
+=cut
+
has _endpoint => (
is => 'ro',
isa => 'Str',
@@ -44,6 +82,24 @@ has json => (
default => sub { JSON::PP->new },
);
+=method update
+
+=method add
+
+=method delete
+
+=method get
+
+=method recent
+
+=method dates
+
+=method all
+
+=method suggest
+
+=cut
+
for my $method (qw(update add delete get recent dates all suggest)) {
__PACKAGE__->meta->add_method($method => sub {
my $self = shift;
@@ -67,4 +123,45 @@ for my $method (qw(update add delete get recent dates all suggest)) {
__PACKAGE__->meta->make_immutable;
no Moose;
+=head1 BUGS
+
+No known bugs.
+
+Please report any bugs to GitHub Issues at
+L<https://github.com/doy/www-pinboard/issues>.
+
+=head1 SEE ALSO
+
+L<https://pinboard.in/>
+
+=head1 SUPPORT
+
+You can find this documentation for this module with the perldoc command.
+
+ perldoc WWW::Pinboard
+
+You can also look for information at:
+
+=over 4
+
+=item * MetaCPAN
+
+L<https://metacpan.org/release/WWW-Pinboard>
+
+=item * Github
+
+L<https://github.com/doy/www-pinboard>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Pinboard>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/WWW-Pinboard>
+
+=back
+
+=cut
+
1;