matrix_dbus 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/matrix-dbus +2 -2
- data/lib/matrix_dbus/dbus.rb +16 -7
- data/lib/matrix_dbus/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ebf2f32f1469b4f1b51d9b95b40c8c1c0f5baeb
|
4
|
+
data.tar.gz: 3654864c75694264fe3bab451643aab2aed45e8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 890775cca95492ea0ef54aa1a8eb93ad2db5f0e29679773c0b3452ade8203dcc14901bb78436f8a5f52ebddb5acfeb42627ba4e99aed72f84871ef9f0b8d2cb7
|
7
|
+
data.tar.gz: 7c550514c6452dc32c79e9bb82d747963f342d23a0ec9d7ba1f7b7b912f0d1a364ffa179c4b7dfce9a02562b49537644cdfdf93fa878c69e4e6b4b2181f117f7
|
data/exe/matrix-dbus
CHANGED
@@ -4,12 +4,12 @@ require 'matrix_dbus'
|
|
4
4
|
Thread.abort_on_exception = true
|
5
5
|
|
6
6
|
def send_if_exist(obj, name, json)
|
7
|
-
obj.method(name).call
|
7
|
+
obj.method(name).call JSON.pretty_generate json unless json.empty?
|
8
8
|
end
|
9
9
|
|
10
10
|
def matrix2dbus(c, obj)
|
11
11
|
j = c.json
|
12
|
-
obj.all j
|
12
|
+
obj.all JSON.pretty_generate j
|
13
13
|
|
14
14
|
%i[account_data to_device presence].each do |name|
|
15
15
|
send_if_exist obj, name, j[name.to_s]['events']
|
data/lib/matrix_dbus/dbus.rb
CHANGED
@@ -14,33 +14,42 @@ module MatrixDBus
|
|
14
14
|
|
15
15
|
dbus_interface 'org.dastudio.matrix' do
|
16
16
|
%i[post put].each do |way|
|
17
|
-
dbus_method way, 'in url:s, in args:s' do |url, args|
|
17
|
+
dbus_method way, 'in url:s, in args:s, out res:s' do |url, args|
|
18
|
+
args = '{}' if args == ''
|
18
19
|
args = JSON.parse args
|
19
20
|
url = URI(url)
|
20
21
|
url.query = URI.encode_www_form access_token: @matrix.access_token
|
22
|
+
url = url.to_s
|
21
23
|
begin
|
22
|
-
@matrix.network.method(way).call
|
24
|
+
[@matrix.network.method(way).call(url, args).to_json]
|
23
25
|
rescue RestClient::Exception => e
|
26
|
+
puts e
|
24
27
|
puts e.response.body
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
29
32
|
%i[get delete].each do |way|
|
30
|
-
dbus_method way, 'in url:s, in args:s' do |url, args|
|
33
|
+
dbus_method way, 'in url:s, in args:s, out res:s' do |url, args|
|
34
|
+
args = '{}' if args == ''
|
31
35
|
args = JSON.parse args
|
32
36
|
args[:access_token] = @matrix.access_token
|
33
37
|
begin
|
34
|
-
@matrix.network.method(way).call
|
38
|
+
[@matrix.network.method(way).call(url, args).to_json]
|
35
39
|
rescue RestClient::Exception => e
|
40
|
+
puts e
|
36
41
|
puts e.response.body
|
37
42
|
end
|
38
43
|
end
|
39
44
|
end
|
40
45
|
|
41
|
-
dbus_method :post_raw, 'in url:s, in body:s' do |url, body|
|
42
|
-
|
43
|
-
|
46
|
+
dbus_method :post_raw, 'in url:s, in body:s, out res:s' do |url, body|
|
47
|
+
begin
|
48
|
+
[@matrix.network.post_raw(url, Base64.decode64(body)).to_json]
|
49
|
+
rescue RestClient::Exception => e
|
50
|
+
puts e
|
51
|
+
puts e.response.body
|
52
|
+
end
|
44
53
|
end
|
45
54
|
|
46
55
|
%i[
|
data/lib/matrix_dbus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matrix_dbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 71e6fd52
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|