matrix_sdk 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 540f933e3c288eb2cfb590fdc95ba37b44b7e507754885a0a2f02c0227977ab8
4
- data.tar.gz: 6ebee0cb09293d01ce214cbc718d811954d3e6265c683dce008f4538bfa7d278
3
+ metadata.gz: d7caf62bbb9e17fc9bde42dcba441902469abd8a9457e80b150861cf598fe75f
4
+ data.tar.gz: 4b5ab256c15ab0d049e3116eac211c452a7f031fd1fb12ea39a7fe362cf3eb9e
5
5
  SHA512:
6
- metadata.gz: '08783bd47d2b55dfeda55bb1301d934f3314f7e642bfa6518d0233e9d29087328658729aa5288c146dbbf0c5c3ddf263bc4c1cb6c85789ff32a95e7397248f3b'
7
- data.tar.gz: e06303208ca67b7ae2494ae11561c0a59eb1d02d6b9cfa634b0208f1161358cebdecbe44f505019358e928cd424aaa9d5dd6eaaf009192eed138c43f324e17d0
6
+ metadata.gz: 3c055dabe5d53ca57cd9ca26c7b3d7e1bbe0631f0e118d81bf6b076aff4172c59afd109e32b7c1ab9573a91bc0771f6d1708c17ec1e607a2754b692242b0e3d8
7
+ data.tar.gz: 3ad9198ca10caca92f0a7efa8a7ac8c4362693e3be9fa140d6e1187d0f22b0fd94517714f7e1777092b9aabe82d53334d7e04c3fbc593fcd7e5917701383b7f9
@@ -1,3 +1,7 @@
1
+ ## 1.2.1 - 2019-07-02
2
+
3
+ - Fixes mxc download URL generation
4
+
1
5
  ## 1.2.0 - 2019-06-28
2
6
 
3
7
  - Adds getters and setters for more specced room state
@@ -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
- response = http.request request
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 = ERB::Util.url_encode mxcurl.full_path.to_s
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MatrixSdk
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1'
5
5
  end
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.0
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-06-28 00:00:00.000000000 Z
11
+ date: 2019-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mocha