Commits

Alan Haggai Alavi committed 646972b

Implemented 'Events'

Comments (0)

Files changed (2)

lib/Net/Bitbucket.pm

     Net::Bitbucket::Internal
     Net::Bitbucket::Changeset
     Net::Bitbucket::Email
+    Net::Bitbucket::Event
 );
 
 use LWP::UserAgent;

lib/Net/Bitbucket/Event.pm

+use strict;
+use warnings;
+
+package Net::Bitbucket::Event;
+
+sub events {
+    my ( $self, $username ) = @_;
+
+    my $url = "/users/$username/events/";
+    return $self->_fetch_response( { 'url' => $url } );
+}
+
+sub events_repo {
+    my $self = shift;
+
+    my ( $username, $repo_slug );
+    if ( ref $_[0] eq 'HASH' ) {
+        my $args = shift;
+        $username = $args->{'username'};
+        $repo_slug = $args->{'repo_slug'};
+    }
+    else {
+        ( $username, $repo_slug ) = @_;
+    }
+
+    my $url = "/repositories/$username/$repo_slug/events/";
+    return $self->_fetch_response( { 'url' => $url } );
+}
+
+1;