Skip to content

Commit 3a55570

Browse files
committed
Merge pull request #31 from peterkovacs/master
Add Invitations to client.
2 parents c7af028 + 0a808ec commit 3a55570

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

lib/bitbucket_rest_api.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def lookup_constant(const_name)
7676
#:Error => 'error',
7777
:Issues => 'issues',
7878
:User => 'user',
79-
:Users => 'users'
79+
:Users => 'users',
80+
:Invitations => 'invitations'
8081

8182
#:Teams => 'teams',
8283
#:PullRequests => 'pull_requests',

lib/bitbucket_rest_api/client.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@ def user_api(options = {})
5151
@user_api ||= ApiFactory.new 'User', options
5252
end
5353

54+
def invitations(options = {})
55+
@invitations ||= ApiFactory.new "Invitations", options
56+
end
5457
end # Client
5558
end # BitBucket
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# encoding: utf-8
2+
3+
module BitBucket
4+
class Invitations < API
5+
def invite(user_name, repo_name, emailaddress, perm)
6+
_update_user_repo_params(user_name, repo_name)
7+
_validate_user_repo_params(user, repo) unless user? && repo?
8+
_validate_presence_of emailaddress
9+
perm ||= "write"
10+
11+
post_request("/invitations/#{user}/#{repo.downcase}/#{emailaddress}",
12+
permission: perm)
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)