summaryrefslogtreecommitdiff
path: root/lib/mattermost
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mattermost')
-rw-r--r--lib/mattermost/client.rb4
-rw-r--r--lib/mattermost/command.rb4
-rw-r--r--lib/mattermost/session.rb19
-rw-r--r--lib/mattermost/team.rb4
4 files changed, 16 insertions, 15 deletions
diff --git a/lib/mattermost/client.rb b/lib/mattermost/client.rb
index 293d0c563c5..e6f633f81be 100644
--- a/lib/mattermost/client.rb
+++ b/lib/mattermost/client.rb
@@ -52,12 +52,12 @@ module Mattermost
json_response = JSON.parse(response.body)
unless response.success?
- raise Mattermost::ClientError.new(json_response['message'] || 'Undefined error')
+ raise Mattermost::ClientError.new(json_response["message"] || "Undefined error")
end
json_response
rescue JSON::JSONError
- raise Mattermost::ClientError.new('Cannot parse response')
+ raise Mattermost::ClientError.new("Cannot parse response")
end
end
end
diff --git a/lib/mattermost/command.rb b/lib/mattermost/command.rb
index a02745486d6..866338d07f3 100644
--- a/lib/mattermost/command.rb
+++ b/lib/mattermost/command.rb
@@ -3,10 +3,10 @@
module Mattermost
class Command < Client
def create(params)
- response = session_post('/api/v4/commands',
+ response = session_post("/api/v4/commands",
body: params.to_json)
- response['token']
+ response["token"]
end
end
end
diff --git a/lib/mattermost/session.rb b/lib/mattermost/session.rb
index e2083848a8d..7096e41fcbd 100644
--- a/lib/mattermost/session.rb
+++ b/lib/mattermost/session.rb
@@ -3,7 +3,7 @@
module Mattermost
class NoSessionError < Mattermost::Error
def message
- 'No session could be set up, is Mattermost configured with Single Sign On?'
+ "No session could be set up, is Mattermost configured with Single Sign On?"
end
end
@@ -52,7 +52,8 @@ module Mattermost
# Next methods are needed for Doorkeeper
def pre_auth
@pre_auth ||= Doorkeeper::OAuth::PreAuthorization.new(
- Doorkeeper.configuration, server.client_via_uid, params)
+ Doorkeeper.configuration, server.client_via_uid, params
+ )
end
def authorization
@@ -107,14 +108,14 @@ module Mattermost
raise Mattermost::NoSessionError unless @token
@headers = {
- Authorization: "Bearer #{@token}"
+ Authorization: "Bearer #{@token}",
}
@token
end
def destroy
- post('/api/v4/users/logout')
+ post("/api/v4/users/logout")
end
def oauth_uri
@@ -122,15 +123,15 @@ module Mattermost
@oauth_uri = nil
- response = get('/oauth/gitlab/login', follow_redirects: false, format: 'text/html')
+ response = get("/oauth/gitlab/login", follow_redirects: false, format: "text/html")
return unless (300...400) === response.code
- redirect_uri = response.headers['location']
+ redirect_uri = response.headers["location"]
return unless redirect_uri
oauth_cookie = parse_cookie(response)
@headers = {
- Cookie: oauth_cookie.to_cookie_string
+ Cookie: oauth_cookie.to_cookie_string,
}
@oauth_uri = URI.parse(redirect_uri)
@@ -147,7 +148,7 @@ module Mattermost
response = get(token_uri, follow_redirects: false)
if (200...400) === response.code
- response.headers['token']
+ response.headers["token"]
end
end
@@ -181,7 +182,7 @@ module Mattermost
def parse_cookie(response)
cookie_hash = Gitlab::HTTP::CookieHash.new
- response.get_fields('Set-Cookie').each { |c| cookie_hash.add_cookies(c) }
+ response.get_fields("Set-Cookie").each { |c| cookie_hash.add_cookies(c) }
cookie_hash
end
end
diff --git a/lib/mattermost/team.rb b/lib/mattermost/team.rb
index 58120178f50..12e6cb65ce4 100644
--- a/lib/mattermost/team.rb
+++ b/lib/mattermost/team.rb
@@ -10,10 +10,10 @@ module Mattermost
# 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/v4/teams', body: {
+ session_post("/api/v4/teams", body: {
name: name,
display_name: display_name,
- type: type
+ type: type,
}.to_json)
end