BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
f187cc59
Commit
f187cc59
authored
Jan 23, 2017
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small update to the Mattermost API
These changes make it possible to wrap multiple API requests in one session.
parent
b60de9c0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
client.rb
lib/mattermost/client.rb
+16
-6
command.rb
lib/mattermost/command.rb
+1
-1
team.rb
lib/mattermost/team.rb
+1
-1
No files found.
lib/mattermost/client.rb
View file @
f187cc59
...
...
@@ -8,21 +8,31 @@ module Mattermost
@user
=
user
end
private
def
with_session
(
&
blk
)
Mattermost
::
Session
.
new
(
user
).
with_session
(
&
blk
)
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
|
json_response
session
.
get
(
path
,
options
)
get
(
session
,
path
,
options
)
end
end
def
js
on_post
(
path
,
options
=
{})
def
sessi
on_post
(
path
,
options
=
{})
with_session
do
|
session
|
json_response
session
.
post
(
path
,
options
)
post
(
session
,
path
,
options
)
end
end
...
...
lib/mattermost/command.rb
View file @
f187cc59
module
Mattermost
class
Command
<
Client
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
)
response
[
'token'
]
...
...
lib/mattermost/team.rb
View file @
f187cc59
module
Mattermost
class
Team
<
Client
def
all
js
on_get
(
'/api/v3/teams/all'
)
sessi
on_get
(
'/api/v3/teams/all'
)
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