summaryrefslogtreecommitdiff
path: root/lib/bitbucket/client.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-22 15:53:46 -0300
committerStan Hu <stanhu@gmail.com>2016-11-21 16:47:25 -0800
commit6418c6f88efe9015c8bc2ebd4f7db1a7277a4dc9 (patch)
tree8481da24ef8418130a68fc2d9f82b7ed1ad0f8a5 /lib/bitbucket/client.rb
parente2f7f32a60a7663d12b5dae0320f640150f354e7 (diff)
downloadgitlab-ce-6418c6f88efe9015c8bc2ebd4f7db1a7277a4dc9.tar.gz
Add an endpoint to get the user's repositories
Diffstat (limited to 'lib/bitbucket/client.rb')
-rw-r--r--lib/bitbucket/client.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/bitbucket/client.rb b/lib/bitbucket/client.rb
index c05fc35f36e..39b52ae25a6 100644
--- a/lib/bitbucket/client.rb
+++ b/lib/bitbucket/client.rb
@@ -4,9 +4,19 @@ module Bitbucket
@connection = options.fetch(:connection, Connection.new(options))
end
+
+ def repos
+ relative_path = "/repositories/#{user.username}"
+ paginator = Paginator.new(connection, relative_path, :repo)
+
+ Collection.new(paginator)
+ end
+
def user
- parsed_response = connection.get('/user')
- Representation::User.new(parsed_response)
+ @user ||= begin
+ parsed_response = connection.get('/user')
+ Representation::User.new(parsed_response)
+ end
end
private