matrix_dbus 0.3.1 → 1.0.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 +4 -4
- data/lib/matrix_dbus/network.rb +6 -6
- data/lib/matrix_dbus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be28175a6c49d37d25cd9718c6ef74d6e79b5321
|
4
|
+
data.tar.gz: 3b89ba6a7be1f4aefbc5e630364af57b774419aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 381d61801c7ba0e06853d3c0a338b3cf14afc5e6267080b0711010c2d3c1f094368951af8d094875a94e8839ddacbf663b66eed015278e0c6ec9117b5ba30062
|
7
|
+
data.tar.gz: e19887e518b3ecf90db293e70f3e7d8fd116bcb2cd75e0a1c8edd2d028f87deec5f283454dbc74cd06df08110d384119de735a79c16defe485445392fc92f062
|
data/lib/matrix_dbus/network.rb
CHANGED
@@ -10,7 +10,7 @@ module MatrixDBus
|
|
10
10
|
# type: Symbol or String, 'get', 'form' or 'json;
|
11
11
|
# host: String: API address, like 'http://localhost:5700'
|
12
12
|
def initialize(host, error) # => Hash<Symble, Lambda>
|
13
|
-
@host = host
|
13
|
+
@host = host.to_s
|
14
14
|
@error = error
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ module MatrixDBus
|
|
19
19
|
# uri: String
|
20
20
|
# params (optional): Hash, url query
|
21
21
|
def get(uri, params = nil) # => Hash
|
22
|
-
uri = URI(@host + uri)
|
22
|
+
uri = URI(@host + uri.to_s)
|
23
23
|
uri.query = URI.encode_www_form params if params
|
24
24
|
puts 'GET URL:', uri if $DEBUG
|
25
25
|
error RestClient.get(uri.to_s)
|
@@ -34,7 +34,7 @@ module MatrixDBus
|
|
34
34
|
# uri: String
|
35
35
|
# body: Hash, post body
|
36
36
|
def post(uri, body)
|
37
|
-
uri = @host + uri
|
37
|
+
uri = @host + uri.to_s
|
38
38
|
puts 'POST URL:', uri if $DEBUG
|
39
39
|
error RestClient.post(uri.to_s, body.to_json, content_type: :json)
|
40
40
|
rescue RestClient::Exceptions::OpenTimeout
|
@@ -48,7 +48,7 @@ module MatrixDBus
|
|
48
48
|
# uri: String
|
49
49
|
# body: Anything
|
50
50
|
def post_raw(uri, body)
|
51
|
-
uri =
|
51
|
+
uri = @host + uri.to_s
|
52
52
|
puts 'POST URL:', uri if $DEBUG
|
53
53
|
error RestClient.post(uri.to_s, body)
|
54
54
|
rescue RestClient::Exceptions::OpenTimeout
|
@@ -62,7 +62,7 @@ module MatrixDBus
|
|
62
62
|
# uri: String
|
63
63
|
# body: Hash, put body
|
64
64
|
def put(uri, body)
|
65
|
-
uri = @host + uri
|
65
|
+
uri = @host + uri.to_s
|
66
66
|
puts 'PUT URL:', uri.to_s if $DEBUG
|
67
67
|
error RestClient.put(uri.to_s, body.to_json, content_type: :json)
|
68
68
|
rescue RestClient::Exceptions::OpenTimeout
|
@@ -76,7 +76,7 @@ module MatrixDBus
|
|
76
76
|
# uri: String
|
77
77
|
# params (optional): Hash, url query
|
78
78
|
def delete(uri, params = nil) # => Hash
|
79
|
-
uri = URI(@host + uri)
|
79
|
+
uri = URI(@host + uri.to_s)
|
80
80
|
puts 'DELETE URL:', uri if $DEBUG
|
81
81
|
uri.query = String.encode_www_form params if params
|
82
82
|
error RestClient.delete(uri.to_s)
|
data/lib/matrix_dbus/version.rb
CHANGED