r43230 - in /branches/upstream/libsocialtext-resting-perl/current: Changes META.yml lib/Socialtext/Resting.pm t/resting.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sat Aug 29 13:06:32 UTC 2009
Author: jawnsy-guest
Date: Sat Aug 29 13:06:26 2009
New Revision: 43230
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=43230
Log:
[svn-upgrade] Integrating new upstream version, libsocialtext-resting-perl (0.28)
Modified:
branches/upstream/libsocialtext-resting-perl/current/Changes
branches/upstream/libsocialtext-resting-perl/current/META.yml
branches/upstream/libsocialtext-resting-perl/current/lib/Socialtext/Resting.pm
branches/upstream/libsocialtext-resting-perl/current/t/resting.t
Modified: branches/upstream/libsocialtext-resting-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocialtext-resting-perl/current/Changes?rev=43230&op=diff
==============================================================================
--- branches/upstream/libsocialtext-resting-perl/current/Changes (original)
+++ branches/upstream/libsocialtext-resting-perl/current/Changes Sat Aug 29 13:06:26 2009
@@ -1,3 +1,6 @@
+0.28 - Fri Aug 28 13:15:23 PDT 2009
+ - added put_webhook()
+
0.27 - Fri Apr 17 15:39:18 PDT 2009
- Fixed problem due to a change to the REST server response for some
redirects.
Modified: branches/upstream/libsocialtext-resting-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocialtext-resting-perl/current/META.yml?rev=43230&op=diff
==============================================================================
--- branches/upstream/libsocialtext-resting-perl/current/META.yml (original)
+++ branches/upstream/libsocialtext-resting-perl/current/META.yml Sat Aug 29 13:06:26 2009
@@ -1,9 +1,9 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Socialtext-Resting
-version: 0.27
+version: 0.28
version_from: lib/Socialtext/Resting.pm
-installdirs: site
+installdirs: vendor
requires:
App::Options: 0
Class::Field: 0
Modified: branches/upstream/libsocialtext-resting-perl/current/lib/Socialtext/Resting.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocialtext-resting-perl/current/lib/Socialtext/Resting.pm?rev=43230&op=diff
==============================================================================
--- branches/upstream/libsocialtext-resting-perl/current/lib/Socialtext/Resting.pm (original)
+++ branches/upstream/libsocialtext-resting-perl/current/lib/Socialtext/Resting.pm Sat Aug 29 13:06:26 2009
@@ -11,7 +11,7 @@
use Readonly;
-our $VERSION = '0.27';
+our $VERSION = '0.28';
=head1 NAME
@@ -48,6 +48,7 @@
pages => $BASE_WS_URI . '/:ws/pages',
pagetag => $BASE_WS_URI . '/:ws/pages/:pname/tags/:tag',
pagetags => $BASE_WS_URI . '/:ws/pages/:pname/tags',
+ pagetaghistory => $BASE_WS_URI . '/:ws/pages/:pname/taghistory',
pagecomments => $BASE_WS_URI . '/:ws/pages/:pname/comments',
pageattachment => $BASE_WS_URI
. '/:ws/pages/:pname/attachments/:attachment_id',
@@ -68,11 +69,13 @@
person => $BASE_URI . '/people/:pname',
person_tag => $BASE_URI . '/people/:pname/tags',
signals => $BASE_URI . '/signals',
+ webhooks => $BASE_URI . '/webhooks',
);
field 'workspace';
field 'username';
field 'password';
+field 'user_cookie';
field 'server';
field 'verbose';
field 'accept';
@@ -95,8 +98,15 @@
server => $opts{server},
);
+ or
+
+ my $Rester = Socialtext::Resting->new(
+ user_cookie => $opts{user_cookie},
+ server => $opts{server},
+ );
+
Creates a Socialtext::Resting object for the specified
-server/user/password combination.
+server/user/password, or server/cookie combination.
=cut
@@ -585,6 +595,22 @@
my $pname = shift;
return $self->_get_things( 'revisions', pname => $pname );
+}
+
+=head2 get_taghistory
+
+ $Rester->workspace('wikiname');
+ $Rester->get_taghistory($page)
+
+Get a history, by revision, of all tags for a page.
+
+=cut
+
+sub get_taghistory {
+ my $self = shift;
+ my $pname = shift;
+
+ return $self->_get_things( 'pagetaghistory', pname => $pname );
}
sub _extend_uri {
@@ -1074,6 +1100,37 @@
}
}
+=head2 put_webhook
+
+ $Rester->put_webhook( %args )
+
+Creates a webhook. Args will be encoded as JSON and put up.
+
+=cut
+
+sub put_webhook {
+ my $self = shift;
+ my %args = @_;
+
+ my $uri = $self->_make_uri('webhooks');
+ my ( $status, $content, $response ) = $self->_request(
+ uri => $uri,
+ method => 'PUT',
+ type => "application/json",
+ content => encode_json( \%args ),
+ );
+
+ my $location = $response->header('location');
+ $location = URI::Escape::uri_unescape($1);
+
+ if ( $status == 204 || $status == 201 ) {
+ return $location;
+ }
+ else {
+ die "$status: $content\n";
+ }
+}
+
sub _request {
my $self = shift;
my %p = @_;
@@ -1085,7 +1142,11 @@
warn "uri: $uri\n" if $self->verbose;
my $request = HTTP::Request->new( $p{method}, $uri );
- $request->authorization_basic( $self->username, $self->password );
+ if ( $self->user_cookie ) {
+ $request->header( 'Cookie' => 'NLW-user=' . $self->user_cookie );
+ } else {
+ $request->authorization_basic( $self->username, $self->password );
+ }
$request->header( 'Accept' => $p{accept} ) if $p{accept};
$request->header( 'Content-Type' => $p{type} ) if $p{type};
$request->header( 'If-Match' => $p{if_match} ) if $p{if_match};
Modified: branches/upstream/libsocialtext-resting-perl/current/t/resting.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocialtext-resting-perl/current/t/resting.t?rev=43230&op=diff
==============================================================================
--- branches/upstream/libsocialtext-resting-perl/current/t/resting.t (original)
+++ branches/upstream/libsocialtext-resting-perl/current/t/resting.t Sat Aug 29 13:06:26 2009
@@ -5,7 +5,7 @@
use strict;
use warnings;
-plan tests => 17;
+plan tests => 18;
# Put the page
my $strut_user = 'rest-tester at socialtext.com';
@@ -74,6 +74,16 @@
$wksp = $r->get_workspace();
is $wksp->{name}, 'st-rest-test';
}
+
+ Get_TagHistory: {
+ my $r = new_strutter();
+ $r->put_pagetag("Test page", "Tag 1");
+ $r->put_pagetag("Test page", "Tag 2");
+
+ my $history = $r->get_taghistory('Test page');
+ like($history, qr/Tags:.*Tag 1/, 'Has tag history');
+ }
+
}
Name_to_id: {
More information about the Pkg-perl-cvs-commits
mailing list