Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix Ruby SDK
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Olofsson
Matrix Ruby SDK
Commits
20fdec7c
Verified
Commit
20fdec7c
authored
5 years ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
Add missing docs for Api#request
parent
b9581107
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/matrix_sdk/api.rb
+22
-0
22 additions, 0 deletions
lib/matrix_sdk/api.rb
with
22 additions
and
0 deletions
lib/matrix_sdk/api.rb
+
22
−
0
View file @
20fdec7c
...
@@ -201,6 +201,28 @@ module MatrixSdk
...
@@ -201,6 +201,28 @@ module MatrixSdk
@proxy_uri
=
proxy_uri
@proxy_uri
=
proxy_uri
end
end
# Perform a raw Matrix API request
#
# @example Simple API query
# api.request(:get, :client_r0, '/account/whoami')
# # => { :user_id => "@alice:matrix.org" }
#
# @example Advanced API request
# api.request(:post,
# :media_r0,
# '/upload',
# body_stream: open('./file'),
# headers: { 'content-type' => 'image/png' })
# # => { :content_uri => "mxc://example.com/AQwafuaFswefuhsfAFAgsw" }
#
# @param method [Symbol] The method to use, can be any of the ones under Net::HTTP
# @param api [Symbol] The API symbol to use, :client_r0 is the current CS one
# @param path [String] The API path to call, this is the part that comes after the API definition in the spec
# @param options [Hash] Additional options to pass along to the request
# @option options [Hash] :query Query parameters to set on the URL
# @option options [Hash,String] :body The body to attach to the request, will be JSON-encoded if sent as a hash
# @option options [IO] :body_stream A body stream to attach to the request
# @option options [Hash] :headers Additional headers to set on the request
def
request
(
method
,
api
,
path
,
**
options
)
def
request
(
method
,
api
,
path
,
**
options
)
url
=
homeserver
.
dup
.
tap
do
|
u
|
url
=
homeserver
.
dup
.
tap
do
|
u
|
u
.
path
=
api_to_path
(
api
)
+
path
u
.
path
=
api_to_path
(
api
)
+
path
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment