Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
a89aab9c
Commit
a89aab9c
authored
Jan 24, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zj-mattermost-api-update' into 'master'
Small update to the Mattermost API See merge request !8712
parents
01fa19ed
f187cc59
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
lib/mattermost/client.rb
lib/mattermost/client.rb
+16
-6
lib/mattermost/command.rb
lib/mattermost/command.rb
+1
-1
lib/mattermost/team.rb
lib/mattermost/team.rb
+1
-1
No files found.
lib/mattermost/client.rb
View file @
a89aab9c
...
@@ -8,21 +8,31 @@ module Mattermost
...
@@ -8,21 +8,31 @@ module Mattermost
@user
=
user
@user
=
user
end
end
private
def
with_session
(
&
blk
)
def
with_session
(
&
blk
)
Mattermost
::
Session
.
new
(
user
).
with_session
(
&
blk
)
Mattermost
::
Session
.
new
(
user
).
with_session
(
&
blk
)
end
end
def
json_get
(
path
,
options
=
{})
private
# Should be used in a session manually
def
get
(
session
,
path
,
options
=
{})
json_response
session
.
get
(
path
,
options
)
end
# Should be used in a session manually
def
post
(
session
,
path
,
options
=
{})
json_response
session
.
post
(
path
,
options
)
end
def
session_get
(
path
,
options
=
{})
with_session
do
|
session
|
with_session
do
|
session
|
json_response
session
.
get
(
path
,
options
)
get
(
session
,
path
,
options
)
end
end
end
end
def
js
on_post
(
path
,
options
=
{})
def
sessi
on_post
(
path
,
options
=
{})
with_session
do
|
session
|
with_session
do
|
session
|
json_response
session
.
post
(
path
,
options
)
post
(
session
,
path
,
options
)
end
end
end
end
...
...
lib/mattermost/command.rb
View file @
a89aab9c
module
Mattermost
module
Mattermost
class
Command
<
Client
class
Command
<
Client
def
create
(
params
)
def
create
(
params
)
response
=
js
on_post
(
"/api/v3/teams/
#{
params
[
:team_id
]
}
/commands/create"
,
response
=
sessi
on_post
(
"/api/v3/teams/
#{
params
[
:team_id
]
}
/commands/create"
,
body:
params
.
to_json
)
body:
params
.
to_json
)
response
[
'token'
]
response
[
'token'
]
...
...
lib/mattermost/team.rb
View file @
a89aab9c
module
Mattermost
module
Mattermost
class
Team
<
Client
class
Team
<
Client
def
all
def
all
js
on_get
(
'/api/v3/teams/all'
)
sessi
on_get
(
'/api/v3/teams/all'
)
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment