r51830 - in /trunk/libsocialtext-resting-perl: Changes META.yml debian/changelog lib/Socialtext/Resting.pm t/resting-mocked.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Jan 30 04:50:25 UTC 2010


Author: jawnsy-guest
Date: Sat Jan 30 04:50:19 2010
New Revision: 51830

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=51830
Log:
New upstream release

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

Modified: trunk/libsocialtext-resting-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/Changes?rev=51830&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/Changes (original)
+++ trunk/libsocialtext-resting-perl/Changes Sat Jan 30 04:50:19 2010
@@ -1,3 +1,6 @@
+0.29 - Thu Jan 28 13:16:49 PST 2010
+ - Specify a Content-Length for all PUT requests
+
 0.28 - Fri Aug 28 13:15:23 PDT 2009
  - added put_webhook()
 

Modified: trunk/libsocialtext-resting-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/META.yml?rev=51830&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/META.yml (original)
+++ trunk/libsocialtext-resting-perl/META.yml Sat Jan 30 04:50:19 2010
@@ -1,20 +1,31 @@
-# 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.28
-version_from: lib/Socialtext/Resting.pm
-installdirs:  vendor
+--- #YAML:1.0
+name:               Socialtext-Resting
+version:            0.29
+abstract:           Simple tool to use Socialtext RESTful API
+author:
+    - Chris Dent <chris.dent at socialtext.com>, Kirsten Jones <kirsten.jones at socialtext.com>
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
 requires:
-    App::Options:                  0
-    Class::Field:                  0
-    HTTP::Request:                 0
-    IPC::Run:                      0
-    JSON::XS:                      2.1
-    LWP::UserAgent:                0
-    Pod::Usage:                    0
-    Readonly:                      0
-    Test::Mock::LWP:               0.05
-    URI::Escape:                   1.31
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+    App::Options:     0
+    Class::Field:     0
+    HTTP::Request:    0
+    IPC::Run:         0
+    JSON::XS:         2.1
+    LWP::UserAgent:   0
+    Pod::Usage:       0
+    Readonly:         0
+    Test::Mock::LWP:  0.05
+    URI::Escape:      1.31
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.50
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: trunk/libsocialtext-resting-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/debian/changelog?rev=51830&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/debian/changelog (original)
+++ trunk/libsocialtext-resting-perl/debian/changelog Sat Jan 30 04:50:19 2010
@@ -1,9 +1,13 @@
-libsocialtext-resting-perl (0.28-2) UNRELEASED; urgency=low
+libsocialtext-resting-perl (0.29-1) UNRELEASED; urgency=low
 
+  [ Ryan Niebur ]
   * Update jawnsy's email address
   * Update ryan52's email address
 
- -- Ryan Niebur <ryan at debian.org>  Fri, 25 Sep 2009 00:26:15 -0700
+  [ Jonathan Yu ]
+  * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Fri, 29 Jan 2010 23:59:44 -0500
 
 libsocialtext-resting-perl (0.28-1) unstable; urgency=low
 

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=51830&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/lib/Socialtext/Resting.pm (original)
+++ trunk/libsocialtext-resting-perl/lib/Socialtext/Resting.pm Sat Jan 30 04:50:19 2010
@@ -11,7 +11,7 @@
 
 use Readonly;
 
-our $VERSION = '0.28';
+our $VERSION = '0.29';
 
 =head1 NAME
 
@@ -66,8 +66,10 @@
     user                 => '/data/users/:user_id',
     users                => '/data/users',
     homepage             => $BASE_WS_URI . '/:ws/homepage',
+    people               => $BASE_URI . '/people',
     person               => $BASE_URI . '/people/:pname',
     person_tag           => $BASE_URI . '/people/:pname/tags',
+    profile_photo        => $BASE_URI . '/people/:pname/photo',
     signals              => $BASE_URI . '/signals',
     webhooks             => $BASE_URI . '/webhooks',
 );
@@ -1037,6 +1039,37 @@
     die "$status: $content\n";
 }
 
+=head2 get_people
+
+    $Rester->get_people();
+
+Retrieves all people.
+
+=cut
+
+sub get_people {
+    my ($self, %opts) = @_;
+    return $self->_get_things('people', _query => \%opts);
+}
+
+sub get_profile_photo {
+    my $self = shift;
+    my $pname = shift;
+
+    my $uri = $self->_make_uri( 'profile_photo', { pname => $pname });
+
+    my ( $status, $content, $response ) = $self->_request(
+        uri    => $uri,
+        method => 'GET',
+    );
+
+    if ( $status == 200 ) {
+        return $content;
+    }
+    else {
+        die "$status: $content\n";
+    }
+}
 
 =head2 get_person
 
@@ -1150,6 +1183,12 @@
     $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};
+    if ($p{method} eq 'PUT') {
+        my $content_len = 0;
+        $content_len = do { use bytes; length $p{content} } if $p{content};
+        $request->header( 'Content-Length' => $content_len );
+    }
+
     if (my $cookie = $self->cookie) {
         $request->header('cookie' => $cookie);
     }

Modified: trunk/libsocialtext-resting-perl/t/resting-mocked.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsocialtext-resting-perl/t/resting-mocked.t?rev=51830&op=diff
==============================================================================
--- trunk/libsocialtext-resting-perl/t/resting-mocked.t (original)
+++ trunk/libsocialtext-resting-perl/t/resting-mocked.t Sat Jan 30 04:50:19 2010
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Test::More tests => 135;
+use Test::More tests => 140;
 use Test::Mock::LWP;
 
 BEGIN {
@@ -93,6 +93,7 @@
               $rester_opts{password},
             ],
             [ 'header' => 'Content-Type', 'text/x.socialtext-wiki' ],
+            [ 'header' => 'Content-Length' => 3 ],
             [ 'content' => 'bar' ],
         ],
         resp_calls => [
@@ -117,6 +118,7 @@
               $rester_opts{password},
             ],
             [ 'header' => 'Content-Type', 'text/x.socialtext-wiki' ],
+            [ 'header' => 'Content-Length' => 3 ],
             [ 'content' => 'bar' ],
         ],
         resp_calls => [
@@ -146,6 +148,7 @@
               $rester_opts{password},
             ],
             [ 'header' => 'Content-Type', 'application/json' ],
+            [ 'header' => 'Content-Length' => 17 ],
             [ 'content' => '{"content":"bar"}' ],
         ],
         resp_calls => [
@@ -203,6 +206,7 @@
             [ 'authorization_basic' => $rester_opts{username}, 
               $rester_opts{password},
             ],
+            [ 'header' => 'Content-Length' => 0 ],
         ],
         resp_calls => [
             [ 'code' ],
@@ -251,6 +255,7 @@
             ],
             [ 'header' => 'Content-Type', 'text/x.socialtext-wiki' ],
             [ 'header' => 'If-Match', $Test::Mock::HTTP::Response::Headers{etag} ],
+            [ 'header' => 'Content-Length' => 3 ],
             [ 'content' => 'bar' ],
         ],
         resp_calls => [




More information about the Pkg-perl-cvs-commits mailing list