stealth 2.0.0.beta6 → 2.0.0.beta7
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/CHANGELOG.md +1 -0
- data/Gemfile.lock +18 -21
- data/README.md +1 -0
- data/VERSION +1 -1
- data/lib/stealth/base.rb +1 -1
- data/lib/stealth/controller/replies.rb +11 -5
- data/spec/controller/replies_spec.rb +48 -0
- data/spec/replies/messages/say_simple_hello.yml +2 -0
- data/stealth.gemspec +1 -2
- metadata +8 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df932db1ce6adab511eb5ebae31e647e3b5c547e7de0ef92ee427d0b592e250b
|
4
|
+
data.tar.gz: 74b9b5099125da94363c2f475062b62fdae543f4a5c40418d0d28293b2a6ca18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 589a9e5064cb490e861528edcd32a3da4ff5859fd0405308d73db36a246ebdab437f4f4bd0510eea765a49f1ac292ec4cd1eb0c8cf43fd0d05404f67c6a91566
|
7
|
+
data.tar.gz: b7e58cd020e541ba183150c27f4cdfc528c70bd47dbb2760d09084822e0334e747d50291672e18a21b68399fa423876f26ab02d94d9c532e2538b9dac7d30dac
|
data/CHANGELOG.md
CHANGED
@@ -56,6 +56,7 @@
|
|
56
56
|
* [Replies] Voice services (determined by having "voice" in the name) now automatically skip auto-delays.
|
57
57
|
* [Controllers] `current_message` now has a `confidence` attribute containing a float with the confidence value of the transcription (from 0 to 1).
|
58
58
|
* [Controllers] Added a `halt!` method that can be used with the controller error handlers to stop code execution.
|
59
|
+
* [Logger] If the driver makes the `translated_reply` instance variable available, it will now be logged.
|
59
60
|
|
60
61
|
## Bug Fixes
|
61
62
|
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stealth (2.0.0.
|
4
|
+
stealth (2.0.0.beta7)
|
5
5
|
activesupport (~> 6.0)
|
6
6
|
multi_json (~> 1.12)
|
7
7
|
puma (>= 4.2, < 6.0)
|
8
|
-
sidekiq (
|
8
|
+
sidekiq (< 7)
|
9
9
|
sinatra (~> 2.0)
|
10
10
|
thor (~> 1.0)
|
11
11
|
|
@@ -24,13 +24,13 @@ GEM
|
|
24
24
|
i18n (1.12.0)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
26
|
minitest (5.16.3)
|
27
|
-
mock_redis (0.
|
27
|
+
mock_redis (0.34.0)
|
28
28
|
ruby2_keywords
|
29
29
|
multi_json (1.15.0)
|
30
30
|
mustermann (2.0.2)
|
31
31
|
ruby2_keywords (~> 0.0.1)
|
32
32
|
nio4r (2.5.8)
|
33
|
-
oj (3.
|
33
|
+
oj (3.13.22)
|
34
34
|
puma (5.6.5)
|
35
35
|
nio4r (~> 2.0)
|
36
36
|
rack (2.2.4)
|
@@ -39,24 +39,22 @@ GEM
|
|
39
39
|
rack-test (2.0.2)
|
40
40
|
rack (>= 1.3)
|
41
41
|
redis (4.8.0)
|
42
|
-
rspec (3.
|
43
|
-
rspec-core (~> 3.
|
44
|
-
rspec-expectations (~> 3.
|
45
|
-
rspec-mocks (~> 3.
|
46
|
-
rspec-core (3.
|
47
|
-
rspec-support (~> 3.
|
48
|
-
rspec-expectations (3.
|
42
|
+
rspec (3.12.0)
|
43
|
+
rspec-core (~> 3.12.0)
|
44
|
+
rspec-expectations (~> 3.12.0)
|
45
|
+
rspec-mocks (~> 3.12.0)
|
46
|
+
rspec-core (3.12.0)
|
47
|
+
rspec-support (~> 3.12.0)
|
48
|
+
rspec-expectations (3.12.0)
|
49
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
-
rspec-support (~> 3.
|
51
|
-
rspec-mocks (3.
|
50
|
+
rspec-support (~> 3.12.0)
|
51
|
+
rspec-mocks (3.12.0)
|
52
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-support (3.
|
55
|
-
rspec_junit_formatter (0.4.1)
|
56
|
-
rspec-core (>= 2, < 4, != 2.12.0)
|
53
|
+
rspec-support (~> 3.12.0)
|
54
|
+
rspec-support (3.12.0)
|
57
55
|
ruby2_keywords (0.0.5)
|
58
|
-
sidekiq (6.5.
|
59
|
-
connection_pool (>= 2.2.5)
|
56
|
+
sidekiq (6.5.8)
|
57
|
+
connection_pool (>= 2.2.5, < 3)
|
60
58
|
rack (~> 2.0)
|
61
59
|
redis (>= 4.5.0, < 5)
|
62
60
|
sinatra (2.2.2)
|
@@ -68,7 +66,7 @@ GEM
|
|
68
66
|
tilt (2.0.11)
|
69
67
|
tzinfo (2.0.5)
|
70
68
|
concurrent-ruby (~> 1.0)
|
71
|
-
zeitwerk (2.6.
|
69
|
+
zeitwerk (2.6.4)
|
72
70
|
|
73
71
|
PLATFORMS
|
74
72
|
ruby
|
@@ -78,7 +76,6 @@ DEPENDENCIES
|
|
78
76
|
oj (~> 3.10)
|
79
77
|
rack-test (~> 2.0)
|
80
78
|
rspec (~> 3.9)
|
81
|
-
rspec_junit_formatter (~> 0.3)
|
82
79
|
stealth!
|
83
80
|
|
84
81
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -32,6 +32,7 @@ Currently, there are gems for:
|
|
32
32
|
### Messaging
|
33
33
|
* [Facebook Messenger](https://github.com/hellostealth/stealth-facebook)
|
34
34
|
* [Twilio SMS](https://github.com/hellostealth/stealth-twilio)
|
35
|
+
* [Bandwidth](https://github.com/hellostealth/stealth-bandwidth)
|
35
36
|
* [Smooch](https://github.com/hellostealth/stealth-smooch)
|
36
37
|
|
37
38
|
### Voice
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.
|
1
|
+
2.0.0.beta7
|
data/lib/stealth/base.rb
CHANGED
@@ -96,11 +96,11 @@ module Stealth
|
|
96
96
|
reply: reply
|
97
97
|
)
|
98
98
|
|
99
|
-
|
100
|
-
client = service_client.new(reply:
|
99
|
+
formatted_reply = handler.send(reply.reply_type)
|
100
|
+
client = service_client.new(reply: formatted_reply)
|
101
101
|
client.transmit
|
102
102
|
|
103
|
-
log_reply(reply) if Stealth.config.transcript_logging
|
103
|
+
log_reply(reply, handler) if Stealth.config.transcript_logging
|
104
104
|
|
105
105
|
# If this was a 'delay' type of reply, we insert the delay
|
106
106
|
if reply.delay?
|
@@ -264,10 +264,14 @@ module Stealth
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
|
-
def log_reply(reply)
|
267
|
+
def log_reply(reply, reply_handler)
|
268
268
|
message = case reply.reply_type
|
269
269
|
when 'text'
|
270
|
-
|
270
|
+
if reply_handler.respond_to?(:translated_reply)
|
271
|
+
reply_handler.translated_reply
|
272
|
+
else
|
273
|
+
reply['text']
|
274
|
+
end
|
271
275
|
when 'speech'
|
272
276
|
reply['speech']
|
273
277
|
when 'ssml'
|
@@ -282,6 +286,8 @@ module Stealth
|
|
282
286
|
topic: current_service,
|
283
287
|
message: "User #{current_session_id} -> Sending: #{message}"
|
284
288
|
)
|
289
|
+
|
290
|
+
message
|
285
291
|
end
|
286
292
|
|
287
293
|
end # instance methods
|
@@ -66,6 +66,10 @@ describe "Stealth::Controller replies" do
|
|
66
66
|
send_replies custom_reply: 'messages/sub1/sub2/say_nested'
|
67
67
|
end
|
68
68
|
|
69
|
+
def say_simple_hello
|
70
|
+
send_replies
|
71
|
+
end
|
72
|
+
|
69
73
|
def say_inline_reply
|
70
74
|
reply = [
|
71
75
|
{ 'reply_type' => 'text', 'text' => 'Hi, Morty. Welcome to Stealth bot...' },
|
@@ -609,6 +613,50 @@ describe "Stealth::Controller replies" do
|
|
609
613
|
end
|
610
614
|
end
|
611
615
|
|
616
|
+
describe "Logging replies" do
|
617
|
+
let(:stubbed_handler) { double("handler") }
|
618
|
+
let(:stubbed_client) { double("client") }
|
619
|
+
|
620
|
+
before(:each) do
|
621
|
+
allow(Stealth::Services::Facebook::ReplyHandler).to receive(:new).and_return(stubbed_handler)
|
622
|
+
allow(Stealth::Services::Facebook::Client).to receive(:new).and_return(stubbed_client)
|
623
|
+
allow(controller.current_session).to receive(:flow_string).and_return("message")
|
624
|
+
allow(controller.current_session).to receive(:state_string).and_return("say_simple_hello")
|
625
|
+
Stealth.config.auto_insert_delays = false
|
626
|
+
Stealth.config.transcript_logging = true
|
627
|
+
end
|
628
|
+
|
629
|
+
after(:each) do
|
630
|
+
Stealth.config.auto_insert_delays = true
|
631
|
+
Stealth.config.transcript_logging = false
|
632
|
+
end
|
633
|
+
|
634
|
+
it "should log replies if transcript_logging is enabled" do
|
635
|
+
allow(stubbed_client).to receive(:transmit).and_return(true)
|
636
|
+
allow(controller).to receive(:sleep).and_return(true).with(2.0)
|
637
|
+
|
638
|
+
allow(stubbed_handler).to receive(:text).exactly(1).times
|
639
|
+
expect(Stealth::Logger).to receive(:l).with(
|
640
|
+
topic: 'facebook',
|
641
|
+
message: "User #{controller.current_session_id} -> Sending: Hello"
|
642
|
+
)
|
643
|
+
controller.say_simple_hello
|
644
|
+
end
|
645
|
+
|
646
|
+
it "should log translated replies if transcript_logging is enabled and the driver supports it" do
|
647
|
+
allow(stubbed_client).to receive(:transmit).and_return(true)
|
648
|
+
allow(controller).to receive(:sleep).and_return(true).with(2.0)
|
649
|
+
|
650
|
+
allow(stubbed_handler).to receive(:text).exactly(1).times
|
651
|
+
allow(stubbed_handler).to receive(:translated_reply).and_return("Bonjour")
|
652
|
+
expect(Stealth::Logger).to receive(:l).with(
|
653
|
+
topic: 'facebook',
|
654
|
+
message: "User #{controller.current_session_id} -> Sending: Bonjour"
|
655
|
+
)
|
656
|
+
controller.say_simple_hello
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
612
660
|
describe "client errors" do
|
613
661
|
let(:stubbed_handler) { double("handler") }
|
614
662
|
let(:stubbed_client) { double("client") }
|
data/stealth.gemspec
CHANGED
@@ -16,11 +16,10 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_dependency 'puma', '>= 4.2', '< 6.0'
|
17
17
|
s.add_dependency 'thor', '~> 1.0'
|
18
18
|
s.add_dependency 'multi_json', '~> 1.12'
|
19
|
-
s.add_dependency 'sidekiq', '
|
19
|
+
s.add_dependency 'sidekiq', '< 7'
|
20
20
|
s.add_dependency 'activesupport', '~> 6.0'
|
21
21
|
|
22
22
|
s.add_development_dependency 'rspec', '~> 3.9'
|
23
|
-
s.add_development_dependency 'rspec_junit_formatter', '~> 0.3'
|
24
23
|
s.add_development_dependency 'rack-test', '~> 2.0'
|
25
24
|
s.add_development_dependency 'mock_redis', '~> 0.22'
|
26
25
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stealth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mauricio Gomes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -77,16 +77,16 @@ dependencies:
|
|
77
77
|
name: sidekiq
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "<"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '7'
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "<"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '7'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: activesupport
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,20 +115,6 @@ dependencies:
|
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '3.9'
|
118
|
-
- !ruby/object:Gem::Dependency
|
119
|
-
name: rspec_junit_formatter
|
120
|
-
requirement: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0.3'
|
125
|
-
type: :development
|
126
|
-
prerelease: false
|
127
|
-
version_requirements: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0.3'
|
132
118
|
- !ruby/object:Gem::Dependency
|
133
119
|
name: rack-test
|
134
120
|
requirement: !ruby/object:Gem::Requirement
|
@@ -362,6 +348,7 @@ files:
|
|
362
348
|
- spec/replies/messages/say_oi.yml.erb
|
363
349
|
- spec/replies/messages/say_randomize_speech.yml
|
364
350
|
- spec/replies/messages/say_randomize_text.yml
|
351
|
+
- spec/replies/messages/say_simple_hello.yml
|
365
352
|
- spec/replies/messages/say_yo.yml
|
366
353
|
- spec/replies/messages/say_yo.yml+twitter
|
367
354
|
- spec/replies/messages/sub1/sub2/say_nested.yml
|
@@ -437,6 +424,7 @@ test_files:
|
|
437
424
|
- spec/replies/messages/say_oi.yml.erb
|
438
425
|
- spec/replies/messages/say_randomize_speech.yml
|
439
426
|
- spec/replies/messages/say_randomize_text.yml
|
427
|
+
- spec/replies/messages/say_simple_hello.yml
|
440
428
|
- spec/replies/messages/say_yo.yml
|
441
429
|
- spec/replies/messages/say_yo.yml+twitter
|
442
430
|
- spec/replies/messages/sub1/sub2/say_nested.yml
|