summaryrefslogtreecommitdiff
path: root/lib/mattermost/client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mattermost/client.rb')
-rw-r--r--lib/mattermost/client.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/mattermost/client.rb b/lib/mattermost/client.rb
index ec2903b7ec6..e55c0d6ac49 100644
--- a/lib/mattermost/client.rb
+++ b/lib/mattermost/client.rb
@@ -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 json_post(path, options = {})
+ def session_post(path, options = {})
with_session do |session|
- json_response session.post(path, options)
+ post(session, path, options)
end
end