r43232 - in /trunk/libsocialtext-resting-perl: Changes META.yml debian/changelog debian/control debian/copyright 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:11:35 UTC 2009


Author: jawnsy-guest
Date: Sat Aug 29 13:11:29 2009
New Revision: 43232

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=43232
Log:
* New upstream release
  + New feature: put_webhook() added
* Standards-Version 3.8.3
* Add myself to Uploaders and Copyright
* Add URL for SocialText

Modified:
    trunk/libsocialtext-resting-perl/Changes
    trunk/libsocialtext-resting-perl/META.yml
    trunk/libsocialtext-resting-perl/debian/changelog
    trunk/libsocialtext-resting-perl/debian/control
    trunk/libsocialtext-resting-perl/debian/copyright
    trunk/libsocialtext-resting-perl/lib/Socialtext/Resting.pm
    trunk/libsocialtext-resting-perl/t/resting.t

Modified: trunk/libsocialtext-resting-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/Changes?rev=43232&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/Changes (original)
+++ trunk/libsocialtext-resting-perl/Changes Sat Aug 29 13:11:29 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: trunk/libsocialtext-resting-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/META.yml?rev=43232&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/META.yml (original)
+++ trunk/libsocialtext-resting-perl/META.yml Sat Aug 29 13:11:29 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: trunk/libsocialtext-resting-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/debian/changelog?rev=43232&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/debian/changelog (original)
+++ trunk/libsocialtext-resting-perl/debian/changelog Sat Aug 29 13:11:29 2009
@@ -1,4 +1,11 @@
-libsocialtext-resting-perl (0.27-4) UNRELEASED; urgency=low
+libsocialtext-resting-perl (0.28-1) UNRELEASED; urgency=low
+
+  [ Jonathan Yu ]
+  * New upstream release
+    + New feature: put_webhook() added
+  * Standards-Version 3.8.3
+  * Add myself to Uploaders and Copyright
+  * Add URL for SocialText
 
   [ Salvatore Bonaccorso ]
   * debian/control: Changed: Replace versioned (build-)dependency on
@@ -8,7 +15,7 @@
   [ Christoph Berg ]
   * Remove myself from Uploaders.
 
- -- Christoph Berg <myon at debian.org>  Tue, 25 Aug 2009 21:50:51 +0200
+ -- Jonathan Yu <frequency at cpan.org>  Sat, 29 Aug 2009 05:05:50 -0400
 
 libsocialtext-resting-perl (0.27-3) unstable; urgency=low
 

Modified: trunk/libsocialtext-resting-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/debian/control?rev=43232&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/debian/control (original)
+++ trunk/libsocialtext-resting-perl/debian/control Sat Aug 29 13:11:29 2009
@@ -7,8 +7,8 @@
  liburi-perl (>= 1.31), libwww-perl, perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Ryan Niebur <ryanryan52 at gmail.com>,
- gregor herrmann <gregoa at debian.org>
-Standards-Version: 3.8.2
+ gregor herrmann <gregoa at debian.org>, Jonathan Yu <frequency at cpan.org>
+Standards-Version: 3.8.3
 Homepage: http://search.cpan.org/dist/Socialtext-Resting/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libsocialtext-resting-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libsocialtext-resting-perl/

Modified: trunk/libsocialtext-resting-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/debian/copyright?rev=43232&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/debian/copyright (original)
+++ trunk/libsocialtext-resting-perl/debian/copyright Sat Aug 29 13:11:29 2009
@@ -5,14 +5,15 @@
 Upstream-Name: Socialtext-Resting
 
 Files: *
-Copyright: 2006 Socialtext
+Copyright: 2006, Socialtext <http://www.socialtext.com/>
 License-Alias: Perl
 License: Artistic | GPL-1+
 
 Files: debian/*
-Copyright: 2007, 2009, Christoph Berg <myon at debian.org>
+Copyright: 2009, Jonathan Yu <frequency at cpan.org>
  2009, Ryan Niebur <ryanryan52 at gmail.com>
  2009, gregor herrmann <gregoa at debian.org>
+ 2007, 2009, Christoph Berg <myon at debian.org>
 License: Artistic | GPL-1+
 
 License: Artistic

Modified: trunk/libsocialtext-resting-perl/lib/Socialtext/Resting.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/lib/Socialtext/Resting.pm?rev=43232&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/lib/Socialtext/Resting.pm (original)
+++ trunk/libsocialtext-resting-perl/lib/Socialtext/Resting.pm Sat Aug 29 13:11:29 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: trunk/libsocialtext-resting-perl/t/resting.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/t/resting.t?rev=43232&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/t/resting.t (original)
+++ trunk/libsocialtext-resting-perl/t/resting.t Sat Aug 29 13:11:29 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