diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-12-19 14:14:09 +0100 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-12-19 21:44:15 +0100 |
commit | d21535602b30316646772b1cd74d7069254076df (patch) | |
tree | d5e7533b44d646e8aaee153ce7b0f51e9467faa7 /lib/mattermost/command.rb | |
parent | 4213bd56dea1d6cdbfa8baed8faa7e3ab86e61ab (diff) | |
download | gitlab-ce-d21535602b30316646772b1cd74d7069254076df.tar.gz |
Minor adjustments API Mattermost
[ci skip]
Diffstat (limited to 'lib/mattermost/command.rb')
-rw-r--r-- | lib/mattermost/command.rb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/mattermost/command.rb b/lib/mattermost/command.rb index 9c37d0b0d79..afbf2ce3349 100644 --- a/lib/mattermost/command.rb +++ b/lib/mattermost/command.rb @@ -1,14 +1,13 @@ module Mattermost - class Command < Session - def self.create(team_id, trigger: 'gitlab', url:, icon_url:) + class Command + def self.create(session, team_id, command) + response = session.post("/api/v3/teams/#{team_id}/commands/create", body: command.to_json).parsed_response - post_command(command)['token'] - end - - private - - def post_command(command) - post( "/teams/#{team_id}/commands/create", body: command.to_json).parsed_response + if response.has_key?('message') + response + else + response['token'] + end end end end |