matrix_sdk 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/matrix_sdk/api.rb +6 -1
- data/lib/matrix_sdk/protocols/cs.rb +24 -2
- data/lib/matrix_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7caf62bbb9e17fc9bde42dcba441902469abd8a9457e80b150861cf598fe75f
|
4
|
+
data.tar.gz: 4b5ab256c15ab0d049e3116eac211c452a7f031fd1fb12ea39a7fe362cf3eb9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c055dabe5d53ca57cd9ca26c7b3d7e1bbe0631f0e118d81bf6b076aff4172c59afd109e32b7c1ab9573a91bc0771f6d1708c17ec1e607a2754b692242b0e3d8
|
7
|
+
data.tar.gz: 3ad9198ca10caca92f0a7efa8a7ac8c4362693e3be9fa140d6e1187d0f22b0fd94517714f7e1777092b9aabe82d53334d7e04c3fbc593fcd7e5917701383b7f9
|
data/CHANGELOG.md
CHANGED
data/lib/matrix_sdk/api.rb
CHANGED
@@ -220,7 +220,12 @@ module MatrixSdk
|
|
220
220
|
raise MatrixConnectionError, "Server still too busy to handle request after #{failures} attempts, try again later" if failures >= 10
|
221
221
|
|
222
222
|
print_http(request)
|
223
|
-
|
223
|
+
begin
|
224
|
+
response = http.request request
|
225
|
+
rescue EOFError => e
|
226
|
+
logger.error 'Socket closed unexpectedly'
|
227
|
+
raise e
|
228
|
+
end
|
224
229
|
print_http(response)
|
225
230
|
data = JSON.parse(response.body, symbolize_names: true) rescue nil
|
226
231
|
|
@@ -4,6 +4,12 @@
|
|
4
4
|
module MatrixSdk::Protocols::CS
|
5
5
|
# Gets the available client API versions
|
6
6
|
# @return [Array]
|
7
|
+
#
|
8
|
+
# @example Getting API versions
|
9
|
+
# api.client_api_versions
|
10
|
+
# # => [ 'r0.1.0', 'r0.2.0', ...
|
11
|
+
# api.client_api_versions.latest
|
12
|
+
# # => 'r0.5.0'
|
7
13
|
def client_api_versions
|
8
14
|
(@client_api_versions ||= request(:get, :client, '/versions')).versions.tap do |vers|
|
9
15
|
vers.instance_eval <<-'CODE', __FILE__, __LINE__ + 1
|
@@ -16,10 +22,17 @@ module MatrixSdk::Protocols::CS
|
|
16
22
|
|
17
23
|
# Gets the list of available unstable client API features
|
18
24
|
# @return [Hash]
|
25
|
+
#
|
26
|
+
# @example Checking for unstable features
|
27
|
+
# api.client_api_unstable_features
|
28
|
+
# # => { :"m.lazy_load_members" => true }
|
29
|
+
# api.client_api_unstable_features.has? 'm.lazy_load_members'
|
30
|
+
# # => true
|
19
31
|
def client_api_unstable_features
|
20
32
|
(@client_api_versions ||= request(:get, :client, '/versions')).unstable_features.tap do |vers|
|
21
33
|
vers.instance_eval <<-'CODE', __FILE__, __LINE__ + 1
|
22
34
|
def has?(feature)
|
35
|
+
feature = feature.to_s.to_sym unless feature.is_a? Symbol
|
23
36
|
fetch(feature, nil)
|
24
37
|
end
|
25
38
|
CODE
|
@@ -1081,10 +1094,14 @@ module MatrixSdk::Protocols::CS
|
|
1081
1094
|
mxcurl = URI.parse(mxcurl.to_s) unless mxcurl.is_a? URI
|
1082
1095
|
raise 'Not a mxc:// URL' unless mxcurl.is_a? URI::MATRIX
|
1083
1096
|
|
1097
|
+
if source
|
1098
|
+
source = "https://#{source}" unless source.include? '://'
|
1099
|
+
source = URI(source.to_s) unless source.is_a?(URI)
|
1100
|
+
end
|
1101
|
+
|
1084
1102
|
source ||= homeserver.dup
|
1085
|
-
source = URI(hs.to_s) unless hs.is_a? URI
|
1086
1103
|
source.tap do |u|
|
1087
|
-
full_path =
|
1104
|
+
full_path = mxcurl.full_path.to_s
|
1088
1105
|
u.path = "/_matrix/media/r0/download/#{full_path}"
|
1089
1106
|
end
|
1090
1107
|
end
|
@@ -1131,6 +1148,11 @@ module MatrixSdk::Protocols::CS
|
|
1131
1148
|
request(:delete, :client_r0, "/directory/room/#{room_alias}", query: query)
|
1132
1149
|
end
|
1133
1150
|
|
1151
|
+
# Gets a list of all the members in a room
|
1152
|
+
# @param [String,MXID] room_id The ID of the room
|
1153
|
+
# @return [Response] A chunked object
|
1154
|
+
# @see https://matrix.org/docs/spec/client_server/r0.4.0#get-matrix-client-r0-rooms-roomid-members
|
1155
|
+
# The Matrix Spec, for more information about the data
|
1134
1156
|
def get_room_members(room_id, **params)
|
1135
1157
|
query = {}
|
1136
1158
|
query[:user_id] = params.delete(:user_id) if protocol?(:AS) && params.key?(:user_id)
|
data/lib/matrix_sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matrix_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Olofsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mocha
|