Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-12-20 02:22:10 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-12-20 02:22:10 +0300
commit841960f847f04da9c427bcdb19037e2112a90890 (patch)
treeff485924db7614a01d5f3f52f66dd28056097ff8 /lib/mattermost/command.rb
parent34295036e2a9ecf18ca5440a5dd6dbb0c7f05643 (diff)
Fix flow
Diffstat (limited to 'lib/mattermost/command.rb')
-rw-r--r--lib/mattermost/command.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/mattermost/command.rb b/lib/mattermost/command.rb
index 5c6f5861a7f..d1e4bb0eccf 100644
--- a/lib/mattermost/command.rb
+++ b/lib/mattermost/command.rb
@@ -1,16 +1,10 @@
module Mattermost
- class Command
- def self.create(session, params)
- response = session.post("/api/v3/teams/#{params[:team_id]}/commands/create",
+ class Command < Client
+ def create(params)
+ response = json_post("/api/v3/teams/#{params[:team_id]}/commands/create",
body: params.to_json)
- if response.success?
- response.parsed_response['token']
- elsif response.parsed_response.try(:has_key?, 'message')
- raise response.parsed_response['message']
- else
- raise 'Failed to create a new command'
- end
+ response['token']
end
end
end