r66838 - in /trunk/libnet-github-perl: Changes MANIFEST META.yml Makefile.PL debian/changelog examples/ lib/Net/GitHub.pm lib/Net/GitHub/V2.pm lib/Net/GitHub/V2/NoRepo.pm lib/Net/GitHub/V2/Organizations.pm

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Sun Jan 2 13:24:04 UTC 2011


Author: carnil
Date: Sun Jan  2 13:23:40 2011
New Revision: 66838

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

Added:
    trunk/libnet-github-perl/examples/
      - copied from r66836, branches/upstream/libnet-github-perl/current/examples/
    trunk/libnet-github-perl/lib/Net/GitHub/V2/Organizations.pm
      - copied unchanged from r66836, branches/upstream/libnet-github-perl/current/lib/Net/GitHub/V2/Organizations.pm
Modified:
    trunk/libnet-github-perl/Changes
    trunk/libnet-github-perl/MANIFEST
    trunk/libnet-github-perl/META.yml
    trunk/libnet-github-perl/Makefile.PL
    trunk/libnet-github-perl/debian/changelog
    trunk/libnet-github-perl/lib/Net/GitHub.pm
    trunk/libnet-github-perl/lib/Net/GitHub/V2.pm
    trunk/libnet-github-perl/lib/Net/GitHub/V2/NoRepo.pm

Modified: trunk/libnet-github-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-github-perl/Changes?rev=66838&op=diff
==============================================================================
--- trunk/libnet-github-perl/Changes (original)
+++ trunk/libnet-github-perl/Changes Sun Jan  2 13:23:40 2011
@@ -1,4 +1,8 @@
 Revision history for Net-GitHub
+
+0.24    2011.01.01
+        Organizations API (fayland)
+        update Auth to 'Basic Auth' (fayland)
 
 0.23    2010.11.04
         Moose has deprected 'excludes', '-excludes' is preferred (datamuc)

Modified: trunk/libnet-github-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-github-perl/MANIFEST?rev=66838&op=diff
==============================================================================
--- trunk/libnet-github-perl/MANIFEST (original)
+++ trunk/libnet-github-perl/MANIFEST Sun Jan  2 13:23:40 2011
@@ -1,4 +1,5 @@
 Changes
+examples/organizations.pl
 inc/Module/AutoInstall.pm
 inc/Module/Install.pm
 inc/Module/Install/AutoInstall.pm
@@ -28,6 +29,7 @@
 lib/Net/GitHub/V2/Network.pm
 lib/Net/GitHub/V2/NoRepo.pm
 lib/Net/GitHub/V2/Object.pm
+lib/Net/GitHub/V2/Organizations.pm
 lib/Net/GitHub/V2/Repositories.pm
 lib/Net/GitHub/V2/Users.pm
 Makefile.PL

Modified: trunk/libnet-github-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-github-perl/META.yml?rev=66838&op=diff
==============================================================================
--- trunk/libnet-github-perl/META.yml (original)
+++ trunk/libnet-github-perl/META.yml Sun Jan  2 13:23:40 2011
@@ -19,6 +19,7 @@
 name: Net-GitHub
 no_index:
   directory:
+    - examples
     - inc
     - t
 requires:
@@ -26,9 +27,10 @@
   Crypt::SSLeay: 0
   HTML::TreeBuilder: 0
   JSON::Any: 0
+  MIME::Base64: 0
   URI::Escape: 0
   WWW::Mechanize::GZip: 0
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://github.com/fayland/perl-net-github/tree/master
-version: 0.23
+version: 0.24

Modified: trunk/libnet-github-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-github-perl/Makefile.PL?rev=66838&op=diff
==============================================================================
--- trunk/libnet-github-perl/Makefile.PL (original)
+++ trunk/libnet-github-perl/Makefile.PL Sun Jan  2 13:23:40 2011
@@ -7,6 +7,7 @@
 
 repository 'http://github.com/fayland/perl-net-github/tree/master';
 
+requires 'MIME::Base64';
 requires 'URI::Escape';
 requires 'Any::Moose';
 requires 'Crypt::SSLeay';

Modified: trunk/libnet-github-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-github-perl/debian/changelog?rev=66838&op=diff
==============================================================================
--- trunk/libnet-github-perl/debian/changelog (original)
+++ trunk/libnet-github-perl/debian/changelog Sun Jan  2 13:23:40 2011
@@ -1,3 +1,10 @@
+libnet-github-perl (0.24-1) UNRELEASED; urgency=low
+
+  * Team upload.
+  * New upstream release
+
+ -- Salvatore Bonaccorso <carnil at debian.org>  Sun, 02 Jan 2011 14:22:05 +0100
+
 libnet-github-perl (0.23-1) unstable; urgency=low
 
   [ Ansgar Burchardt ]

Modified: trunk/libnet-github-perl/lib/Net/GitHub.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-github-perl/lib/Net/GitHub.pm?rev=66838&op=diff
==============================================================================
--- trunk/libnet-github-perl/lib/Net/GitHub.pm (original)
+++ trunk/libnet-github-perl/lib/Net/GitHub.pm Sun Jan  2 13:23:40 2011
@@ -2,7 +2,7 @@
 
 use Any::Moose;
 
-our $VERSION = '0.23';
+our $VERSION = '0.24';
 our $AUTHORITY = 'cpan:FAYLAND';
 
 sub new {
@@ -86,6 +86,10 @@
     # L<Net::GitHub::V2::Network>
     $github->network_meta;
     $github->network_data_chunk( $net_hash );
+    
+    # L<Net::GitHub::V2::Organizations>
+    $github->organization->organizations('github');
+    $github->organization->teams('PerlChina');
 
 =head1 Git URL
 

Modified: trunk/libnet-github-perl/lib/Net/GitHub/V2.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-github-perl/lib/Net/GitHub/V2.pm?rev=66838&op=diff
==============================================================================
--- trunk/libnet-github-perl/lib/Net/GitHub/V2.pm (original)
+++ trunk/libnet-github-perl/lib/Net/GitHub/V2.pm Sun Jan  2 13:23:40 2011
@@ -11,6 +11,7 @@
 use Net::GitHub::V2::Issues;
 use Net::GitHub::V2::Object;
 use Net::GitHub::V2::Network;
+use Net::GitHub::V2::Organizations;
 
 with 'Net::GitHub::V2::HasRepo';
 
@@ -80,6 +81,16 @@
     handles => ['network_meta', 'network_data_chunk']
 );
 
+has 'organization' => (
+    is => 'rw',
+    isa => 'Net::GitHub::V2::Organizations',
+    lazy => 1,
+    default => sub {
+        my $self = shift;
+        return Net::GitHub::V2::Organizations->new( $self->args_to_pass );
+    },
+);
+
 no Any::Moose;
 __PACKAGE__->meta->make_immutable;
 
@@ -166,6 +177,13 @@
 
 L<Net::GitHub::V2::Network>
 
+=head2 organization
+
+    my $organization = $github->organization->organizations('github');
+    my $teams = $github->organization->teams('PerlChina');
+
+L<Net::GitHub::V2::Organizations>    
+
 =head1 SEE ALSO
 
 L<Any::Moose>

Modified: trunk/libnet-github-perl/lib/Net/GitHub/V2/NoRepo.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-github-perl/lib/Net/GitHub/V2/NoRepo.pm?rev=66838&op=diff
==============================================================================
--- trunk/libnet-github-perl/lib/Net/GitHub/V2/NoRepo.pm (original)
+++ trunk/libnet-github-perl/lib/Net/GitHub/V2/NoRepo.pm Sun Jan  2 13:23:40 2011
@@ -2,11 +2,13 @@
 
 use Any::Moose 'Role';
 
-our $VERSION = '0.17';
+our $VERSION = '0.24';
 our $AUTHORITY = 'cpan:FAYLAND';
 
 use JSON::Any;
 use WWW::Mechanize::GZip;
+use MIME::Base64;
+use HTTP::Request::Common;
 use Carp qw/croak/;
 
 # repo stuff
@@ -88,8 +90,25 @@
 };
 
 sub get_json_to_obj_authed {
+    push @_, 'POST';
+    _get_json_to_obj_authed(@_);
+}
+
+sub get_json_to_obj_authed_PUT {
+    push @_, 'PUT';
+    _get_json_to_obj_authed(@_);
+}
+
+sub get_json_to_obj_authed_DELETE {
+    push @_, 'DELETE';
+    _get_json_to_obj_authed(@_);
+}
+
+sub _get_json_to_obj_authed {
     my $self = shift;
     my $pending_url = shift;
+    
+    my $request_method = pop @_; # can be DELETE or PUT
 
     croak 'login and token are required' unless ( $self->has_login and $self->has_token );
 
@@ -102,16 +121,16 @@
         $key = pop @_;
     }
 
-    require HTTP::Request::Common;
-    my $res = $self->ua->request(
-        HTTP::Request::Common::POST( $url, [
-            'login' => $self->login,
-            'token' => $self->token,
-            @_,
-        ] ),
-    );
+    my $req = $request_method eq 'DELETE' ? HTTP::Request::Common::DELETE( $url, [ @_ ] ) :
+              $request_method eq 'PUT'    ? HTTP::Request::Common::PUT( $url, [ @_ ] ) :
+                                            HTTP::Request::Common::POST( $url, [ @_ ] );
+    
+    # "schacon/token:6ef8395fecf207165f1a82178ae1b984"
+    my $auth_basic = $self->login . '/token:' . $self->token;
+    $req->header('Authorization', 'Basic ' . encode_base64($auth_basic));
+    
+    my $res = $self->ua->request($req);
     return { error => '404 Not Found' } if $res->code == 404;
-    return { error => $res->as_string() } unless ( $res->is_success );
 
     my $json = $res->content();
     my $data = $self->json->jsonToObj($json);




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