librevox 1.1.0 → 1.2.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: 741f63e510f82a40cfbb818d889405e46327bda536843c891767d21fafc7032d
4
- data.tar.gz: be1b2346b673120f343d2cfea7c6eb71fcc085a3e1bdcdcaa86989dd97705b8a
3
+ metadata.gz: fadfc835daf0f70edfe72c9a1fb2fb8ff709dc649e2105b06e0e304537b4a1aa
4
+ data.tar.gz: 6b6d55db19a6d4d8f3079148c5e0da1af6bd3b31491dc7238967c24188579332
5
5
  SHA512:
6
- metadata.gz: 77ed21f1951ea0061315850c0222ac422bedd25baa1e18b3e73bc983d9be1cfd94c6d3f9628ddc2e1461405d6623c248bd72e2a9a2bb1f898df035b0303962ed
7
- data.tar.gz: 53fde0404e9b427820018c805d15f1bbb65fe9108384db699702130fb6c0aecefd89a3865e06193b75a5bc04fb06e7d47957e3e179f80f0f16a1edd414e479be
6
+ metadata.gz: ade75b396dfaf64a08de980507b3a3ad47c6b3c91d0112196eceb9cc9f787ef96e0e0423583b0bfcb50dca63ce7f7d881b8166c5d28ec8763b0be6297d62566b
7
+ data.tar.gz: 62950a76f942a2021f05c0594daf0dfa7c9227e50218f7f78cf485e4edda45356a893cb6eb6aeffb9042a3535429a0cecb1bcf151619017afbd6303c13ea27e3
@@ -150,9 +150,7 @@ module Librevox
150
150
  args = [min, max, tries, timeout, terminators, file, invalid_file,
151
151
  variable, regexp].join " "
152
152
 
153
- params = {variable: variable}
154
-
155
- application "play_and_get_digits", args, params
153
+ application "play_and_get_digits", args, variable: variable
156
154
  end
157
155
 
158
156
  # Plays a sound file on the current channel.
@@ -182,9 +180,7 @@ module Librevox
182
180
  arg_string = "%s %s %s %s %s %s" % [min, max, file, variable, timeout,
183
181
  terminators]
184
182
 
185
- params = {variable: variable}
186
-
187
- application "read", arg_string, params
183
+ application "read", arg_string, variable: variable
188
184
  end
189
185
 
190
186
  # Records a message, with an optional limit on the maximum duration of the
@@ -37,11 +37,17 @@ module Librevox
37
37
  end
38
38
  end
39
39
 
40
- def application(uuid, app, args = nil)
41
- parts = ["sendmsg #{uuid}", "call-command: execute", "execute-app-name: #{app}"]
42
- parts << "execute-app-arg: #{args}" if args && !args.empty?
43
- parts << "event-lock: true"
44
- send_message parts.join("\n")
40
+ def application(uuid, app, args = nil, **params)
41
+ headers = params
42
+ .merge(
43
+ event_lock: true,
44
+ call_command: "execute",
45
+ execute_app_name: app,
46
+ execute_app_arg: args,
47
+ )
48
+ .map { |key, value| "#{key.to_s.tr('_', '-')}: #{value}" }
49
+
50
+ send_message "sendmsg #{uuid}\n#{headers.join("\n")}"
45
51
  end
46
52
 
47
53
  def close
@@ -13,16 +13,24 @@ module Librevox
13
13
  barrier.async { server.run }
14
14
  end
15
15
 
16
- def application(app, args = nil, params = {})
17
- parts = ["sendmsg", "call-command: execute", "execute-app-name: #{app}"]
18
- parts << "execute-app-arg: #{args}" if args && !args.empty?
19
- parts << "event-lock: true"
16
+ def application(app, args = nil, **params)
17
+ variable_name = params.delete(:variable)
18
+
19
+ headers = params
20
+ .merge(
21
+ event_lock: true,
22
+ call_command: "execute",
23
+ execute_app_name: app,
24
+ execute_app_arg: args,
25
+ )
26
+ .map { |key, value| "#{key.to_s.tr('_', '-')}: #{value}" }
27
+
28
+ send_message "sendmsg\n#{headers.join("\n")}"
20
29
 
21
- send_message parts.join("\n")
22
30
  response = @app_complete_queue.dequeue
23
31
  @session = response.content
24
32
 
25
- params[:variable] ? variable(params[:variable]) : nil
33
+ variable(variable_name) if variable_name
26
34
  end
27
35
 
28
36
  attr_accessor :session
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Librevox
4
- VERSION = "1.1.0"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librevox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Vangberg