Marcin Kasperski avatar Marcin Kasperski committed 92e99e7

work

Comments (0)

Files changed (3)

examples/simple_sample.pl

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

lib/WebService/BitBucket/Base.pm

 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);

share/bitbucket-spore.json

-// 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"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.