r52201 - in /branches/upstream/libsocialtext-resting-perl/current: Changes META.yml lib/Socialtext/Resting.pm t/resting-mocked.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Fri Feb 5 18:37:30 UTC 2010
Author: jawnsy-guest
Date: Fri Feb 5 18:37:20 2010
New Revision: 52201
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52201
Log:
[svn-upgrade] Integrating new upstream version, libsocialtext-resting-perl (0.30)
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-mocked.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=52201&op=diff
==============================================================================
--- branches/upstream/libsocialtext-resting-perl/current/Changes (original)
+++ branches/upstream/libsocialtext-resting-perl/current/Changes Fri Feb 5 18:37:20 2010
@@ -1,3 +1,8 @@
+0.30 - Thu Feb 4 10:19:42 PST 2010
+ - Add group and account ids to post_signal()
+ - Doc that get_signals() accepts query parameters (such as group & account
+ ids)
+
0.29 - Thu Jan 28 13:16:49 PST 2010
- Specify a Content-Length for all PUT requests
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=52201&op=diff
==============================================================================
--- branches/upstream/libsocialtext-resting-perl/current/META.yml (original)
+++ branches/upstream/libsocialtext-resting-perl/current/META.yml Fri Feb 5 18:37:20 2010
@@ -1,31 +1,23 @@
--- #YAML:1.0
-name: Socialtext-Resting
-version: 0.29
-abstract: Simple tool to use Socialtext RESTful API
-author:
+name: Socialtext-Resting
+version: 0.30
+abstract: Simple tool to use Socialtext RESTful API
+license: ~
+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
-no_index:
- directory:
- - t
- - inc
-generated_by: ExtUtils::MakeMaker version 6.50
+generated_by: ExtUtils::MakeMaker version 6.44
+distribution_type: module
+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
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
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=52201&op=diff
==============================================================================
--- branches/upstream/libsocialtext-resting-perl/current/lib/Socialtext/Resting.pm (original)
+++ branches/upstream/libsocialtext-resting-perl/current/lib/Socialtext/Resting.pm Fri Feb 5 18:37:20 2010
@@ -11,7 +11,7 @@
use Readonly;
-our $VERSION = '0.29';
+our $VERSION = '0.30';
=head1 NAME
@@ -1090,9 +1090,13 @@
=head2 get_signals
$Rester->get_signals();
+ $Rester->get_signals(group_id => 42);
+ $Rester->get_signals(account_id => 2);
Retrieves the list of signals.
+Optional arguments are passed as query paramaters.
+
=cut
sub get_signals {
@@ -1105,21 +1109,36 @@
=head2 post_signal
$Rester->post_signal('O HAI');
+ $Rester->post_signal('O HAI', group_id => 42);
+ $Rester->post_signal('O HAI', group_ids => [2,3,4]);
+ $Rester->post_signal('O HAI', account_id => 42);
+ $Rester->post_signal('O HAI', account_ids => [2,3,4]);
Posts a signal.
+Optional C<account_ids> and C<group_ids> arguments for targetting the signal.
+
=cut
sub post_signal {
my $self = shift;
my $text = shift;
+ my %args = @_;
+
+ my %sig = ( signal => $text );
+
+ for my $k (qw(account_id group_id)) {
+ my @ids = @{ $args{$k.'s'} || [] };
+ push @ids, $args{$k} if $args{$k}; # must be non-zero
+ $sig{$k.'s'} = \@ids if @ids;
+ }
my $uri = $self->_make_uri('signals');
my ( $status, $content, $response ) = $self->_request(
uri => $uri,
method => 'POST',
type => "application/json",
- content => encode_json( { signal => $text } ),
+ content => encode_json( \%sig ),
);
my $location = $response->header('location');
@@ -1215,12 +1234,17 @@
=head1 AUTHORS / MAINTAINERS
-Chris Dent, C<< <chris.dent at socialtext.com> >>
-Kirsten Jones C<< <kirsten.jones at socialtext.com> >>
Luke Closs C<< <luke.closs at socialtext.com> >>
+
Shawn Devlin C<< <shawn.devlin at socialtext.com> >>
-=head2 OTHER CONTRIBUTORS
+Jeremy Stashewsky C<< <jeremy.stashewsky at socialtext.com> >>
+
+=head2 CONTRIBUTORS
+
+Chris Dent
+
+Kirsten Jones
Michele Berg - get_revisions()
Modified: branches/upstream/libsocialtext-resting-perl/current/t/resting-mocked.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsocialtext-resting-perl/current/t/resting-mocked.t?rev=52201&op=diff
==============================================================================
--- branches/upstream/libsocialtext-resting-perl/current/t/resting-mocked.t (original)
+++ branches/upstream/libsocialtext-resting-perl/current/t/resting-mocked.t Fri Feb 5 18:37:20 2010
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 140;
+use Test::More tests => 160;
use Test::Mock::LWP;
BEGIN {
@@ -336,6 +336,29 @@
);
}
+Get_signals_w_args: {
+ my $rester = new_strutter();
+ $Mock_resp->set_always('content', "This\nThat");
+ $rester->get_signals(account_id => 2);
+ result_ok(
+ no_workspace => 1,
+ uri => 'signals?account_id=2',
+ ua_calls => [
+ [ 'simple_request' => $Mock_req ],
+ ],
+ req_calls => [
+ [ 'authorization_basic' => $rester_opts{username},
+ $rester_opts{password},
+ ],
+ [ 'header' => 'Accept', 'text/plain' ],
+ ],
+ resp_calls => [
+ [ 'code' ],
+ [ 'content' ],
+ ],
+ );
+}
+
Post_signal: {
my $rester = new_strutter();
$Mock_resp->set_always('code', 204);
@@ -354,6 +377,34 @@
],
[ 'header' => 'Content-Type', 'application/json' ],
[ 'content' => '{"signal":"O HAI"}' ],
+ ],
+ resp_calls => [
+ [ 'code' ],
+ [ 'content' ],
+ [ 'header' => 'location' ],
+ ],
+ );
+}
+
+Post_signal_to_group: {
+ my $rester = new_strutter();
+ $Mock_resp->set_always('code', 204);
+ local $Test::Mock::HTTP::Response::Headers{location} = 'waa';
+ $rester->post_signal('O HAI', group_id => 42, account_ids => [2,3,4]);
+ result_ok(
+ no_workspace => 1,
+ uri => 'signals',
+ method => 'POST',
+ ua_calls => [
+ [ 'simple_request' => $Mock_req ],
+ ],
+ req_calls => [
+ [ 'authorization_basic' => $rester_opts{username},
+ $rester_opts{password},
+ ],
+ [ 'header' => 'Content-Type', 'application/json' ],
+ [ 'content' =>
+ '{"signal":"O HAI","group_ids":[42],"account_ids":[2,3,4]}' ],
],
resp_calls => [
[ 'code' ],
More information about the Pkg-perl-cvs-commits
mailing list