Skip to content

Commit d13b554

Browse files
committed
Add Invitations to client.
1 parent c7af028 commit d13b554

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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,9 @@ 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
57+
5458
end # Client
5559
end # BitBucket
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 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}", permission: perm )
12+
end
13+
end
14+
end

0 commit comments

Comments
 (0)