Skip to content

Commit b429a30

Browse files
author
=
committed
Adding Downloads and Commit Endpoints
1 parent 0f1ba2f commit b429a30

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

lib/bitbucket_rest_api/repos.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ class Repos < API
1111
:Services => 'services',
1212
:Following => 'following',
1313
:Sources => 'sources',
14-
:Forks => 'forks'
14+
:Forks => 'forks',
15+
:Commits =>'commits',
16+
:Download=>'download'
1517

1618
DEFAULT_REPO_OPTIONS = {
1719
"website" => "",
@@ -67,6 +69,12 @@ def services
6769
def forks
6870
@services ||= ApiFactory.new 'Repos::Forks'
6971
end
72+
def commits
73+
@services ||=ApiFactory.new 'Repos::Commits'
74+
end
75+
def download
76+
@services ||=ApiFactory.new "Repos::Download"
77+
end
7078
# List branches
7179
#
7280
# = Examples
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# encoding: utf-8
2+
3+
module BitBucket
4+
class Repos::Commits < API
5+
6+
def get(user_name, repo_name)
7+
_update_user_repo_params(user_name, repo_name)
8+
_validate_user_repo_params(user, repo) unless user? && repo?
9+
get_request("/repositories/#{user}/#{repo.downcase}/commits")
10+
end
11+
12+
13+
end # Repos::Keys
14+
end # BitBucket
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# encoding: utf-8
2+
3+
module BitBucket
4+
class Repos::Download < API
5+
def get(user_name, repo_name, params={})
6+
_update_user_repo_params(user_name, repo_name)
7+
_validate_user_repo_params(user, repo) unless user? && repo?
8+
normalize! params
9+
assert_required_keys(REQUIRED_KEY_PARAM_NAMES, params)
10+
commit_hash=params[:commit_hash]
11+
#https://bitbucket.org/jhanley85/eternum_canvas_demo/get/fd931f96f12d.zip
12+
"https://bitbucket.org/#{user}/#{repo.downcase}/get/#{commit_hash}.tar.gz"
13+
end
14+
15+
16+
17+
18+
19+
end # Repos::Keys
20+
end # BitBucket

0 commit comments

Comments
 (0)