1. Marcin Kasperski
  2. perl/webservice_bitbucket

Commits

Marcin Kasperski  committed 92e99e7

work

  • Participants
  • Parent commits f0bd43c
  • Branches default

Comments (0)

Files changed (3)

File examples/simple_sample.pl

View file
  • Ignore whitespace
         my $bitbucket = WebService::BitBucket->new(
             auth_user => $self->user,
             auth_password => $self->_password);
+
+        eval {
+            print $bitbucket->_client->user, "\n";
+        }; if($@) {
+            print "Failure: $@\n";
+            
+        }
     }
 
         

File lib/WebService/BitBucket/Base.pm

View file
  • Ignore whitespace
 package WebService::BitBucket::Base;
-use Moo;
+use Moose; # TODO → Moo?
 
 use File::ShareDir;
 use Path::Class;
 use HTTP::Request;
 use LWP::UserAgent;
 use URI;
+use Net::HTTP::Spore;
 
 =attr api_uri
 
 has 'auth_user' => (
     is => 'rw',
     isa => 'Str',
-    required => 0
+    required => 0,
    );
 
 =attr auth_password
 has 'auth_password' => (
     is => 'rw',
     isa => 'Str',
-    required => 0
+    required => 0,
    );
 
 has '_client' => (
     required => 1,
     default => sub {
         #my $where = File::ShareDir::dist_dir('WebService-BitBucket');
-        #my $where = dir(
-        print File::ShareDir::module_dir('WebService::BitBucket'), "\n";
+        #print File::ShareDir::module_dir('WebService::BitBucket'), "\n";
         my $where = File::ShareDir::module_file(
             'WebService::BitBucket', 'bitbucket-spore.json');
         my $client = Net::HTTP::Spore->new_from_spec($where);

File share/bitbucket-spore.json

View file
  • Ignore whitespace
-// https://confluence.atlassian.com/display/BITBUCKET/Using+the+Bitbucket+REST+APIs 
 {
     "base_url" : "http://api.bitbucket.org/1.0",
     "version" : "1.0",
     "methods" : {
-        "public_timeline" : {
+        "user" : {
+            "optional_params" : [],
+            "required_params" : [],
+            "path" : "/user",
+            "method" : "GET"
+        },
+
+        "xrepositories" : {
             "optional_params" : [
                 "trim_user",
                 "include_entities"