matrix_sdk 2.6.0 → 2.7.0

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: 50821866efab2cbd39daf23bc9ff3bd7864bca5638f76c766a8ba26ab91c7423
4
- data.tar.gz: 2601cf5141e824b322f5310e09b72d42059162e1ac87da11243167d2604f1801
3
+ metadata.gz: 7db96470aa545490e2dc289243a1c133a708548e334748fee72cfa1bdba68543
4
+ data.tar.gz: 863bf01f82c86e9a6329bb505c727a872bf2f2b7b5dd8f51fbc633d74675d8b6
5
5
  SHA512:
6
- metadata.gz: 7bb45dfcb6696b75ed0be95b92fbb3f569b258d4d0456a3cd8ea16fd22d5e3d5050607e6229bfa0e32b84fc0248e554db8f93d48cd970b2ff95475cf0bcfba85
7
- data.tar.gz: 58d8524e9d83ef570ca19a41f28758fc129c1a3988ea3522a994e58eaa93c4807850b63a2171423dd69a948738e69468542d56d882ecf98c60e6f8607928b6d1
6
+ metadata.gz: f529e7679bd36fcad10184795d78f5dd0a72b0a496fe5f3a10d976d3a33e033cf2367ffb01b68bca3e0844ed91f496921a28e2ef7b20a5bd9589c21bb28a321e
7
+ data.tar.gz: e32d7dcbff2eac544e25f5c7598ac5f743e60dab8eac6394d1054a118882b0efdb3a69dca8ac93d1fae6ed6cf5912d6576156c3dcc9541c0b8b37bc6f9507600
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 2.7.0 - 2022-08-12
2
+
3
+ - Adds a bot subsystem + DSL
4
+ - [An example](examples/bot_api.rb) can be found in the examples folder
5
+ - Adds additional useful helpers for Room and User
6
+ - Fixes Client.new_for_domain
7
+ - Improves the handling of MXIDs as strings
8
+ - Improves handling of caches for rooms
9
+ - Improves Client shutdown when using Client#start_listener_thread
10
+ - Improves account data handling, with caches on both Client and Room level
11
+
1
12
  ## 2.6.0 - 2022-07-15
2
13
 
3
14
  - Adds some multi-thread usage support to the API (create your API/client with `threadsafe: :multithread/true/false`)
data/README.md CHANGED
@@ -26,7 +26,7 @@ api.request :get, :federation_v1, '/version'
26
26
  ```
27
27
 
28
28
  ```ruby
29
- # Client wrapper
29
+ # Client wrapper with login
30
30
  require 'matrix_sdk'
31
31
 
32
32
  client = MatrixSdk::Client.new 'https://example.com'
@@ -43,7 +43,7 @@ hq.send_text "This is an example message - don't actually do this ;)"
43
43
  ```
44
44
 
45
45
  ```ruby
46
- # Client wrapper
46
+ # Client wrapper with token
47
47
  require 'matrix_sdk'
48
48
 
49
49
  client = MatrixSdk::Client.new 'https://example.com'
@@ -58,6 +58,19 @@ client.rooms.count
58
58
  # => 5
59
59
  ```
60
60
 
61
+ ```ruby
62
+ #!/bin/env ruby
63
+ # Bot DSL
64
+ require 'matrix_sdk/bot'
65
+
66
+ command :plug do
67
+ room.send_text <<~PLUG
68
+ The Ruby SDK is a fine method for writing applications communicating over the Matrix protocol.
69
+ It can easily be integrated with Rails, and it supports most client/bot use-cases.
70
+ PLUG
71
+ end
72
+ ```
73
+
61
74
  ## Contributing
62
75
 
63
76
  Bug reports and pull requests are welcome on GitHub at https://github.com/ananace/ruby-matrix-sdk
@@ -67,6 +67,7 @@ module MatrixSdk
67
67
  @global_headers.merge!(params.fetch(:global_headers)) if params.key? :global_headers
68
68
  @synapse = params.fetch(:synapse, true)
69
69
  @http = nil
70
+ @inflight = []
70
71
 
71
72
  self.threadsafe = params.fetch(:threadsafe, :multithread)
72
73
 
@@ -301,6 +302,7 @@ module MatrixSdk
301
302
 
302
303
  loc_http = http
303
304
  perform_request = proc do
305
+ @inflight << loc_http
304
306
  dur_start = Time.now
305
307
  response = loc_http.request req_obj
306
308
  dur_end = Time.now
@@ -308,6 +310,8 @@ module MatrixSdk
308
310
  rescue EOFError
309
311
  logger.error 'Socket closed unexpectedly'
310
312
  raise
313
+ ensure
314
+ @inflight.delete loc_http
311
315
  end
312
316
 
313
317
  if @threadsafe == true
@@ -356,6 +360,10 @@ module MatrixSdk
356
360
  ret
357
361
  end
358
362
 
363
+ def stop_inflight
364
+ @inflight.each(&:finish)
365
+ end
366
+
359
367
  private
360
368
 
361
369
  def construct_request(method:, url:, **options)