diff options
| author | Sean McGivern <sean@mcgivern.me.uk> | 2018-05-30 08:58:53 +0000 |
|---|---|---|
| committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-05-30 08:58:53 +0000 |
| commit | b2d8d161a060f9e257845ae5813395761132cb13 (patch) | |
| tree | e24c7ed30cfd63890422297557245abc1dae5161 /lib | |
| parent | 63d7408125ddbe366bfe468fa4a2f9637acf930b (diff) | |
| parent | ef5e13c946446441d767e9aa3834afff29277f96 (diff) | |
| download | gitlab-ce-b2d8d161a060f9e257845ae5813395761132cb13.tar.gz | |
Merge branch 'mattermost-api-v4' into 'master'
Updated Mattermost integration to use Mattermost API v4
Closes #41631
See merge request gitlab-org/gitlab-ce!19043
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mattermost/command.rb | 2 | ||||
| -rw-r--r-- | lib/mattermost/session.rb | 4 | ||||
| -rw-r--r-- | lib/mattermost/team.rb | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/mattermost/command.rb b/lib/mattermost/command.rb index 33e450d7f0a..704813dfdf0 100644 --- a/lib/mattermost/command.rb +++ b/lib/mattermost/command.rb @@ -1,7 +1,7 @@ module Mattermost class Command < Client def create(params) - response = session_post("/api/v3/teams/#{params[:team_id]}/commands/create", + response = session_post('/api/v4/commands', body: params.to_json) response['token'] diff --git a/lib/mattermost/session.rb b/lib/mattermost/session.rb index 85f78e44f32..2aa7a2f64d8 100644 --- a/lib/mattermost/session.rb +++ b/lib/mattermost/session.rb @@ -112,7 +112,7 @@ module Mattermost end def destroy - post('/api/v3/users/logout') + post('/api/v4/users/logout') end def oauth_uri @@ -120,7 +120,7 @@ module Mattermost @oauth_uri = nil - response = get("/api/v3/oauth/gitlab/login", follow_redirects: false) + response = get('/oauth/gitlab/login', follow_redirects: false, format: 'text/html') return unless (300...400) === response.code redirect_uri = response.headers['location'] diff --git a/lib/mattermost/team.rb b/lib/mattermost/team.rb index 75513a9ba04..95c2f6f9d6b 100644 --- a/lib/mattermost/team.rb +++ b/lib/mattermost/team.rb @@ -1,14 +1,14 @@ module Mattermost class Team < Client - # Returns **all** teams for an admin + # Returns all teams that the current user is a member of def all - session_get('/api/v3/teams/all').values + session_get("/api/v4/users/me/teams") 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: { + session_post('/api/v4/teams', body: { name: name, display_name: display_name, type: type |
