r70703 - in /branches/upstream/libnet-github-perl/current: Changes MANIFEST META.yml lib/Net/GitHub.pm lib/Net/GitHub/V2/Issues.pm t/v2/

ghedo-guest at users.alioth.debian.org ghedo-guest at users.alioth.debian.org
Sun Mar 6 16:14:33 UTC 2011


Author: ghedo-guest
Date: Sun Mar  6 16:14:25 2011
New Revision: 70703

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=70703
Log:
[svn-upgrade] new version libnet-github-perl (0.28)

Removed:
    branches/upstream/libnet-github-perl/current/t/v2/
Modified:
    branches/upstream/libnet-github-perl/current/Changes
    branches/upstream/libnet-github-perl/current/MANIFEST
    branches/upstream/libnet-github-perl/current/META.yml
    branches/upstream/libnet-github-perl/current/lib/Net/GitHub.pm
    branches/upstream/libnet-github-perl/current/lib/Net/GitHub/V2/Issues.pm

Modified: branches/upstream/libnet-github-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-github-perl/current/Changes?rev=70703&op=diff
==============================================================================
--- branches/upstream/libnet-github-perl/current/Changes (original)
+++ branches/upstream/libnet-github-perl/current/Changes Sun Mar  6 16:14:25 2011
@@ -1,4 +1,7 @@
 Revision history for Net-GitHub
+
+0.28    2011.03.06
+        use official GitHub API request instead of screen-scraping for 'comments' issues by spang (Christine Spang)
 
 0.27    2011.02.17
         requires HTTP::Request::Common; (RT 65787 by JQUELIN)

Modified: branches/upstream/libnet-github-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-github-perl/current/MANIFEST?rev=70703&op=diff
==============================================================================
--- branches/upstream/libnet-github-perl/current/MANIFEST (original)
+++ branches/upstream/libnet-github-perl/current/MANIFEST Sun Mar  6 16:14:25 2011
@@ -52,6 +52,3 @@
 t/v1/mockdata/search.json
 t/v1/mockdata/single_commit.json
 t/v1/mockdata/user.json
-t/v2/70-issues-comments.t
-t/v2/mockdata/70-issues-comments.html
-t/v2/mockdata/70-issues-comments_zero.html

Modified: branches/upstream/libnet-github-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-github-perl/current/META.yml?rev=70703&op=diff
==============================================================================
--- branches/upstream/libnet-github-perl/current/META.yml (original)
+++ branches/upstream/libnet-github-perl/current/META.yml Sun Mar  6 16:14:25 2011
@@ -34,4 +34,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://github.com/fayland/perl-net-github/tree/master
-version: 0.27
+version: 0.28

Modified: branches/upstream/libnet-github-perl/current/lib/Net/GitHub.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-github-perl/current/lib/Net/GitHub.pm?rev=70703&op=diff
==============================================================================
--- branches/upstream/libnet-github-perl/current/lib/Net/GitHub.pm (original)
+++ branches/upstream/libnet-github-perl/current/lib/Net/GitHub.pm Sun Mar  6 16:14:25 2011
@@ -2,7 +2,7 @@
 
 use Any::Moose;
 
-our $VERSION = '0.27';
+our $VERSION = '0.28';
 our $AUTHORITY = 'cpan:FAYLAND';
 
 sub new {

Modified: branches/upstream/libnet-github-perl/current/lib/Net/GitHub/V2/Issues.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-github-perl/current/lib/Net/GitHub/V2/Issues.pm?rev=70703&op=diff
==============================================================================
--- branches/upstream/libnet-github-perl/current/lib/Net/GitHub/V2/Issues.pm (original)
+++ branches/upstream/libnet-github-perl/current/lib/Net/GitHub/V2/Issues.pm Sun Mar  6 16:14:25 2011
@@ -2,7 +2,7 @@
 
 use Any::Moose;
 
-our $VERSION = '0.18';
+our $VERSION = '0.28';
 our $AUTHORITY = 'cpan:FAYLAND';
 
 with 'Net::GitHub::V2::HasRepo';
@@ -115,43 +115,11 @@
     my ( $self, $id ) = @_;
     my $owner   = $self->owner;
     my $repo    = $self->repo;
-    my $content = $self->get("http://github.com/$owner/$repo/issues#issue/$id");
-    require HTML::TreeBuilder;
-    my $tree = HTML::TreeBuilder->new;
-    $tree->parse_content($content);
-    $tree->elementify;
-    $tree = $tree->look_down( id => "issue_$id" );
-    return [] unless $tree;
-    my $comments_region = $tree->look_down( class => "comments commentstyle" );
-    if ($comments_region) {
-        my @comments_tree =
-          $comments_region->look_down( class => 'comment wikistyle' );
-        my @comments;
-        for my $c (@comments_tree) {
-            my ($id) = $c->attr('id') =~ /comment_(\d+)/;
-            my $meta    = $c->look_down( class => 'meta' );
-            my $author  = $meta->find_by_tag_name('b')->as_text;
-            my $date =
-              $meta->look_down( class => 'date' )
-              ->look_down( class => 'relatize' )->attr('title');
-            # hack $date to make it consistent with official api
-            $date =~ s!-!/!g;
-            $date .= ' -0700';
-
-            my $content = $c->look_down( class => 'body' )->as_text;
-            push @comments,
-              {
-                id      => $id,
-                author  => $author,
-                date    => $date,
-                content => $content,
-              };
-        }
-        return \@comments;
-    }
-    else {
-        return [];
-    }
+
+    my $url = "issues/comments/$owner/$repo/$id";
+    my $result = $self->get_json_to_obj( $url, 'comments');
+
+    return $result;
 }
 
 no Any::Moose;
@@ -257,18 +225,17 @@
 
 =item comments
 
-note: this is not the official api of github, in fact,
-      it's done by scrapping.
-
     my $comments = $issue->comments( $number );
 
 return an arrayref containing a list of comments, each comment is a hashref like
 
     {
-        id      => 12345,
-        author  => 'foo',
-        date    => '2009/06/08 18:28:42 -0700',
-        content => 'blalba',
+        id           => 12345,
+        gravatar_id  => 12345,
+        user         => 'foo',
+        created_at   => '2009/06/08 18:28:42 -0700',
+        modified_at  => '2009/06/08 18:28:42 -0700',
+        body         => 'blalba',
     }
 
 if no comments, return []




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