diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-03-06 20:02:52 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-03-06 20:02:52 +0000 |
commit | b70d151db99d6d64f3514006c4fa6c8142e1b785 (patch) | |
tree | c6feb891fc752583f7cde7a8e7536ab607490f72 /lib | |
parent | 03b310895b2a41a7cc8331fac6f3e9c9f9687a26 (diff) | |
parent | 2199906dcad070c4599c445317f9fb02899d1d0f (diff) | |
download | gitlab-ce-b70d151db99d6d64f3514006c4fa6c8142e1b785.tar.gz |
Merge branch 'zj-create-mattermost-team' into 'master'
Create Mattermost Team from GitLab
Closes #23964
See merge request !8746
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mattermost/client.rb | 2 | ||||
-rw-r--r-- | lib/mattermost/session.rb | 2 | ||||
-rw-r--r-- | lib/mattermost/team.rb | 11 |
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/mattermost/client.rb b/lib/mattermost/client.rb index ad6df246091..3d60618006c 100644 --- a/lib/mattermost/client.rb +++ b/lib/mattermost/client.rb @@ -26,7 +26,7 @@ module Mattermost def session_get(path, options = {}) with_session do |session| - get(session, path, options) + get(session, path, options) end end diff --git a/lib/mattermost/session.rb b/lib/mattermost/session.rb index 5388966605d..688a79c0441 100644 --- a/lib/mattermost/session.rb +++ b/lib/mattermost/session.rb @@ -153,7 +153,7 @@ module Mattermost yield rescue HTTParty::Error => e raise Mattermost::ConnectionError.new(e.message) - rescue Errno::ECONNREFUSED + rescue Errno::ECONNREFUSED => e raise Mattermost::ConnectionError.new(e.message) end end diff --git a/lib/mattermost/team.rb b/lib/mattermost/team.rb index afc152aa02e..2cdbbdece16 100644 --- a/lib/mattermost/team.rb +++ b/lib/mattermost/team.rb @@ -1,7 +1,18 @@ module Mattermost class Team < Client + # Returns **all** teams for an admin def all session_get('/api/v3/teams/all').values end + + # Creates a team on the linked Mattermost instance, the team admin will be the + # `current_user` passed to the Mattermost::Client instance + def create(name:, display_name:, type:) + session_post('/api/v3/teams/create', body: { + name: name, + display_name: display_name, + type: type + }.to_json) + end end end |