matrix_sdk 1.2.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/matrix_sdk.rb +9 -0
- data/lib/matrix_sdk/api.rb +1 -0
- data/lib/matrix_sdk/client.rb +1 -0
- data/lib/matrix_sdk/extensions.rb +52 -42
- data/lib/matrix_sdk/protocols/cs.rb +12 -0
- data/lib/matrix_sdk/response.rb +4 -0
- data/lib/matrix_sdk/room.rb +1 -0
- data/lib/matrix_sdk/user.rb +2 -0
- data/lib/matrix_sdk/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44e3f36b32757df6369cafc95f4b6d9b42cff5a8b5152373519556a227aa6be4
|
4
|
+
data.tar.gz: dfdb434855b6ceea028a2f374f239aeec92504f36d52e8400d500193d0642d80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5a57bafba59ce9616041f64172c4e5c117f7a46455612c8ae8c74693c691037e25dc5037be90c3d18600a3b30cdc2827761bfdcd9baea7ef5e5f6e7cbccc4cc
|
7
|
+
data.tar.gz: 99792cb46ab43e6e9d0757c5f2c171da05233d5b8d697ef1ad9d60eb2e2bdb707dca57e35b157687b6ea77ecfb955c579f72289d684699077af1f29de4ce0e54
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 1.4.0 - 2019-09-30
|
2
|
+
|
3
|
+
- Adds the option to change the logger globally or per-object.
|
4
|
+
|
5
|
+
## 1.3.0 - 2019-07-16
|
6
|
+
|
7
|
+
- Improves response handling to add accessors recursively
|
8
|
+
- Removes MatrixSdk extensions from the global scope,
|
9
|
+
if you've been using these in your own code you must now remember to
|
10
|
+
`extend MatrixSdk::Extensions` in order for them to be available.
|
11
|
+
|
1
12
|
## 1.2.1 - 2019-07-02
|
2
13
|
|
3
14
|
- Fixes mxc download URL generation
|
data/lib/matrix_sdk.rb
CHANGED
data/lib/matrix_sdk/api.rb
CHANGED
data/lib/matrix_sdk/client.rb
CHANGED
@@ -20,61 +20,69 @@ unless Object.respond_to? :yield_self
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
23
|
+
module MatrixSdk
|
24
|
+
module Extensions
|
25
|
+
def events(*symbols)
|
26
|
+
module_name = "#{name}Events"
|
27
|
+
|
28
|
+
initializers = []
|
29
|
+
readers = []
|
30
|
+
methods = []
|
31
|
+
|
32
|
+
symbols.each do |sym|
|
33
|
+
name = sym.to_s
|
34
|
+
|
35
|
+
initializers << "
|
36
|
+
@on_#{name} = MatrixSdk::EventHandlerArray.new
|
37
|
+
"
|
38
|
+
readers << ":on_#{name}"
|
39
|
+
methods << "
|
40
|
+
def fire_#{name}(ev, filter = nil)
|
41
|
+
@on_#{name}.fire(ev, filter)
|
42
|
+
when_#{name}(ev) if !ev.handled?
|
43
|
+
end
|
44
|
+
|
45
|
+
def when_#{name}(ev); end
|
46
|
+
"
|
41
47
|
end
|
42
48
|
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
class_eval "
|
50
|
+
module #{module_name}
|
51
|
+
attr_reader #{readers.join ', '}
|
46
52
|
|
47
|
-
|
48
|
-
|
49
|
-
|
53
|
+
def event_initialize
|
54
|
+
#{initializers.join}
|
55
|
+
end
|
50
56
|
|
51
|
-
|
52
|
-
|
53
|
-
end
|
57
|
+
#{methods.join}
|
58
|
+
end
|
54
59
|
|
55
|
-
|
60
|
+
include #{module_name}
|
61
|
+
", __FILE__, __LINE__ - 12
|
56
62
|
end
|
57
63
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
.reject { |f| %i[#{symbols.map { |s| "@#{s}" }.join ' '}].include? f }
|
68
|
-
.map { |f| "\#{f}=\#{reentrant ? instance_variable_get(f) : instance_variable_get(f).inspect}" }.join " " }}>"
|
64
|
+
def ignore_inspect(*symbols)
|
65
|
+
class_eval %*
|
66
|
+
def inspect
|
67
|
+
reentrant = caller_locations.any? { |l| l.absolute_path == __FILE__ && l.label == 'inspect' }
|
68
|
+
"\#{to_s[0..-2]} \#{instance_variables
|
69
|
+
.reject { |f| %i[#{symbols.map { |s| "@#{s}" }.join ' '}].include? f }
|
70
|
+
.map { |f| "\#{f}=\#{reentrant ? instance_variable_get(f) : instance_variable_get(f).inspect}" }.join " " }}>"
|
71
|
+
end
|
72
|
+
*, __FILE__, __LINE__ - 7
|
69
73
|
end
|
70
|
-
|
71
|
-
end
|
74
|
+
end
|
72
75
|
|
73
|
-
module MatrixSdk
|
74
76
|
module Logging
|
75
77
|
def logger
|
78
|
+
return MatrixSdk.logger if MatrixSdk.global_logger?
|
79
|
+
|
76
80
|
@logger ||= ::Logging.logger[self]
|
77
81
|
end
|
82
|
+
|
83
|
+
def logger=(logger)
|
84
|
+
@logger = logger
|
85
|
+
end
|
78
86
|
end
|
79
87
|
|
80
88
|
class EventHandlerArray < Hash
|
@@ -110,6 +118,8 @@ module MatrixSdk
|
|
110
118
|
end
|
111
119
|
|
112
120
|
class Event
|
121
|
+
extend MatrixSdk::Extensions
|
122
|
+
|
113
123
|
attr_writer :handled
|
114
124
|
|
115
125
|
ignore_inspect :sender
|
@@ -1009,6 +1009,10 @@ module MatrixSdk::Protocols::CS
|
|
1009
1009
|
request(:get, :client_r0, "/user/#{user_id}/filter/#{filter_id}", query: query)
|
1010
1010
|
end
|
1011
1011
|
|
1012
|
+
# Creates a filter for future use
|
1013
|
+
#
|
1014
|
+
# @param [String,MXID] user_id The user to create the filter for
|
1015
|
+
# @param [Hash] filter_params The filter to create
|
1012
1016
|
def create_filter(user_id, filter_params, **params)
|
1013
1017
|
query = {}
|
1014
1018
|
query[:user_id] = params.delete(:user_id) if protocol?(:AS) && params.key?(:user_id)
|
@@ -1069,6 +1073,14 @@ module MatrixSdk::Protocols::CS
|
|
1069
1073
|
request(:put, :client_r0, "/profile/#{user_id}/avatar_url", body: content, query: query)
|
1070
1074
|
end
|
1071
1075
|
|
1076
|
+
# Gets the combined profile object of a user.
|
1077
|
+
#
|
1078
|
+
# This includes their display name and avatar
|
1079
|
+
#
|
1080
|
+
# @param [String,MXID] user_id The User ID to read the profile for
|
1081
|
+
# @return [Response] The user profile object
|
1082
|
+
# @see #get_display_name
|
1083
|
+
# @see #get_avatar_url
|
1072
1084
|
def get_profile(user_id, **params)
|
1073
1085
|
query = {}
|
1074
1086
|
query[:user_id] = params.delete(:user_id) if protocol?(:AS) && params.key?(:user_id)
|
data/lib/matrix_sdk/response.rb
CHANGED
data/lib/matrix_sdk/room.rb
CHANGED
data/lib/matrix_sdk/user.rb
CHANGED
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.
|
4
|
+
version: 1.4.0
|
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-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mocha
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.0.
|
130
|
+
rubygems_version: 3.0.6
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: SDK for applications using the Matrix protocol
|