blob: 7d4710bb94d9ab7e9c33eb8689d4c25252933999 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
module Mattermost
class Command < Session
def self.create(team_id, trigger: 'gitlab', url:, icon_url:)
command = {
auto_complete: true,
auto_complete_desc: 'List all available commands',
auto_complete_hint: '[help]',
description: 'Perform common operations on GitLab',
display_name: 'GitLab Slash Commands',
method: 'P',
user_name: 'GitLab',
trigger: trigger,
url: url,
icon_url: icon_url
}
post_command(command)['token']
end
private
def post_command(command)
post( "/teams/#{team_id}/commands/create", body: command.to_json).parsed_response
end
end
end
|