openhab-scripting 5.51.1 → 5.52.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/openhab/core/actions/http.rb +31 -15
- data/lib/openhab/core/actions/voice.rb +9 -4
- data/lib/openhab/dsl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 44b392f4d106e9bc092ddf981e4597e6fd68c4d4eaca45120f6409712ec877ad
|
|
4
|
+
data.tar.gz: cd319b4063c404b98d922878c5aaa75c8e5278be43ed05dc52d7e03d80d64e24
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c0d8fabc27ea76a5aa3d9f9062f7371a61f20017535192ac410e57ac13c1c5a03b50970fdb61a6bdb7d6729572282765d55cec7475920037a23b761511dbf51
|
|
7
|
+
data.tar.gz: a49a9d2f4827353397c126c30a89e9ffb00a50693ec3ca9d0b20bf9e7c05de972190e5bb60e0672f492553a63fa13622694c678006041c61a9038ce2ea6cf4f6
|
|
@@ -28,10 +28,7 @@ module OpenHAB
|
|
|
28
28
|
# @return [nil] if an error occurred
|
|
29
29
|
#
|
|
30
30
|
def send_http_get_request(url, headers: {}, timeout: nil)
|
|
31
|
-
timeout
|
|
32
|
-
timeout = timeout.to_millis if timeout.is_a?(Duration)
|
|
33
|
-
|
|
34
|
-
sendHttpGetRequest(url, headers.transform_keys(&:to_s), timeout)
|
|
31
|
+
request(:sendHttpGetRequest, url, headers:, timeout:, default_timeout: 5_000)
|
|
35
32
|
end
|
|
36
33
|
alias_method :get, :send_http_get_request
|
|
37
34
|
|
|
@@ -48,10 +45,7 @@ module OpenHAB
|
|
|
48
45
|
# @return [nil] if an error occurred
|
|
49
46
|
#
|
|
50
47
|
def send_http_put_request(url, content_type = nil, content = nil, headers: {}, timeout: nil)
|
|
51
|
-
|
|
52
|
-
timeout = timeout.to_millis if timeout.is_a?(Duration)
|
|
53
|
-
|
|
54
|
-
sendHttpPutRequest(url, content_type, content, headers.transform_keys(&:to_s), timeout)
|
|
48
|
+
request(:sendHttpPutRequest, url, content_type, content, headers:, timeout:)
|
|
55
49
|
end
|
|
56
50
|
alias_method :put, :send_http_put_request
|
|
57
51
|
|
|
@@ -68,13 +62,29 @@ module OpenHAB
|
|
|
68
62
|
# @return [nil] if an error occurred
|
|
69
63
|
#
|
|
70
64
|
def send_http_post_request(url, content_type = nil, content = nil, headers: {}, timeout: nil)
|
|
71
|
-
|
|
72
|
-
timeout = timeout.to_millis if timeout.is_a?(Duration)
|
|
73
|
-
|
|
74
|
-
sendHttpPostRequest(url, content_type, content, headers.transform_keys(&:to_s), timeout)
|
|
65
|
+
request(:sendHttpPostRequest, url, content_type, content, headers:, timeout:)
|
|
75
66
|
end
|
|
76
67
|
alias_method :post, :send_http_post_request
|
|
77
68
|
|
|
69
|
+
#
|
|
70
|
+
# Sends an HTTP PATCH request and returns the result as a String.
|
|
71
|
+
#
|
|
72
|
+
# @param [String] url
|
|
73
|
+
# @param [String] content_type
|
|
74
|
+
# @param [String] content
|
|
75
|
+
# @param [Hash<String, String>, Hash<Symbol, String>] headers
|
|
76
|
+
# A hash of headers to send with the request. Symbolic keys will be converted to strings.
|
|
77
|
+
# @param [Duration, int, nil] timeout Timeout (in milliseconds, if given as an Integer)
|
|
78
|
+
# @return [String] the response body
|
|
79
|
+
# @return [nil] if an error occurred
|
|
80
|
+
#
|
|
81
|
+
# @since openHAB 5.3
|
|
82
|
+
#
|
|
83
|
+
def send_http_patch_request(url, content_type = nil, content = nil, headers: {}, timeout: nil)
|
|
84
|
+
request(:sendHttpPatchRequest, url, content_type, content, headers:, timeout:)
|
|
85
|
+
end
|
|
86
|
+
alias_method :patch, :send_http_patch_request
|
|
87
|
+
|
|
78
88
|
#
|
|
79
89
|
# Sends an HTTP DELETE request and returns the result as a String.
|
|
80
90
|
#
|
|
@@ -87,12 +97,18 @@ module OpenHAB
|
|
|
87
97
|
# @return [nil] if an error occurred
|
|
88
98
|
#
|
|
89
99
|
def send_http_delete_request(url, headers: {}, timeout: nil)
|
|
90
|
-
|
|
100
|
+
request(:sendHttpDeleteRequest, url, headers:, timeout:)
|
|
101
|
+
end
|
|
102
|
+
alias_method :delete, :send_http_delete_request
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
def request(java_method, url, *payload, headers:, timeout:, default_timeout: 1_000)
|
|
107
|
+
timeout ||= default_timeout
|
|
91
108
|
timeout = timeout.to_millis if timeout.is_a?(Duration)
|
|
92
109
|
|
|
93
|
-
|
|
110
|
+
public_send(java_method, url, *payload, headers.transform_keys(&:to_s), timeout)
|
|
94
111
|
end
|
|
95
|
-
alias_method :delete, :send_http_delete_request
|
|
96
112
|
end
|
|
97
113
|
end
|
|
98
114
|
end
|
|
@@ -6,9 +6,6 @@ module OpenHAB
|
|
|
6
6
|
# @see https://www.openhab.org/docs/configuration/multimedia.html#actions-3 Voice Actions
|
|
7
7
|
class Voice
|
|
8
8
|
class << self
|
|
9
|
-
# @!visibility private
|
|
10
|
-
alias_method :raw_say, :say if method_defined?(:say)
|
|
11
|
-
|
|
12
9
|
#
|
|
13
10
|
# Say text via openHAB Text-To-Speech service, Voice.say()
|
|
14
11
|
#
|
|
@@ -27,7 +24,15 @@ module OpenHAB
|
|
|
27
24
|
#
|
|
28
25
|
def say(text, voice: nil, sink: nil, volume: nil)
|
|
29
26
|
volume = PercentType.new(volume) unless volume.is_a?(PercentType) || volume.nil?
|
|
30
|
-
|
|
27
|
+
java_send :say,
|
|
28
|
+
[java.lang.Object,
|
|
29
|
+
java.lang.String,
|
|
30
|
+
java.lang.String,
|
|
31
|
+
org.openhab.core.library.types.PercentType],
|
|
32
|
+
text.to_s,
|
|
33
|
+
voice&.to_s,
|
|
34
|
+
sink&.to_s,
|
|
35
|
+
volume
|
|
31
36
|
end
|
|
32
37
|
end
|
|
33
38
|
end
|
data/lib/openhab/dsl/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openhab-scripting
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.52.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian O'Connell
|
|
@@ -389,7 +389,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
389
389
|
- !ruby/object:Gem::Version
|
|
390
390
|
version: '0'
|
|
391
391
|
requirements: []
|
|
392
|
-
rubygems_version: 4.0.
|
|
392
|
+
rubygems_version: 4.0.19
|
|
393
393
|
specification_version: 4
|
|
394
394
|
summary: JRuby Helper Libraries for openHAB Scripting
|
|
395
395
|
test_files: []
|