alexa-rails 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/alexa/response.rb +18 -9
- data/lib/alexa/responses/bye.rb +7 -5
- data/lib/alexa/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: 6f7424bec9291cbc50679c312fd312806dd0bfa4e8305204f57a6ddf6b62de2e
|
4
|
+
data.tar.gz: 4b503fd5f01d4b15ff12e8fef2054fd251f1005a9a32516c1e8eac00fb4dad33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d797df382fb66afc6def0947558e74219c87955c022a0151d7e0044fe1b1605ac23db0b9312eca60fd82d4fb038d01355c48ee152d89de7db97a4b7ae6f54e9
|
7
|
+
data.tar.gz: 5d4ba2496b7054b58a4925e40ee4815b5d75c40438574e8c9dd939bf693b03d909eec63779f18d6c6751201062aca89a5e60f94eb9bea9efe845135e0318aea2
|
data/lib/alexa/response.rb
CHANGED
@@ -36,36 +36,38 @@ module Alexa
|
|
36
36
|
slot_to_elicit = elicit_directives.first[:slotToElicit]
|
37
37
|
end
|
38
38
|
|
39
|
-
template_path = "alexa/#{intent.context.locale.downcase}/intent_handlers/"\
|
40
|
-
"#{intent.class.name.demodulize.underscore}"
|
41
|
-
|
42
39
|
if filename.nil? && @force_template_filename.present?
|
43
40
|
filename = @force_template_filename
|
44
41
|
end
|
45
42
|
|
46
43
|
if filename.present?
|
47
44
|
if format == :ssml
|
48
|
-
"#{
|
45
|
+
"#{partials_directory}/#{filename}.ssml.erb"
|
49
46
|
else
|
50
|
-
"#{
|
47
|
+
"#{partials_directory}/#{filename}.text.erb"
|
51
48
|
end
|
52
49
|
else
|
53
50
|
if slot_to_elicit.present? && !@slots_to_not_render_elicitation.include?(slot_to_elicit)
|
54
51
|
if format == :ssml
|
55
|
-
"#{
|
52
|
+
"#{partials_directory}/elicitations/#{slot_to_elicit.underscore}.ssml.erb"
|
56
53
|
else
|
57
|
-
"#{
|
54
|
+
"#{partials_directory}/elicitations/#{slot_to_elicit.underscore}.text.erb"
|
58
55
|
end
|
59
56
|
else
|
60
57
|
if format == :ssml
|
61
|
-
"#{
|
58
|
+
"#{partials_directory}/default.ssml.erb"
|
62
59
|
else
|
63
|
-
"#{
|
60
|
+
"#{partials_directory}/default.text.erb"
|
64
61
|
end
|
65
62
|
end
|
66
63
|
end
|
67
64
|
end
|
68
65
|
|
66
|
+
def partials_directory
|
67
|
+
@_partials_directory ||= "alexa/#{intent.context.locale.downcase}/intent_handlers/"\
|
68
|
+
"#{intent_directory_name}"
|
69
|
+
end
|
70
|
+
|
69
71
|
def elicit_directives
|
70
72
|
return [] if directives.empty?
|
71
73
|
directives.select { |directive| directive[:type] == "Dialog.ElicitSlot" }
|
@@ -85,5 +87,12 @@ module Alexa
|
|
85
87
|
return false if elicit_directives.any?
|
86
88
|
return true
|
87
89
|
end
|
90
|
+
|
91
|
+
def intent_directory_name
|
92
|
+
# respects namespacing.
|
93
|
+
# For example +Alexa::IntentHandlers::MyNameSpace::IntentName+
|
94
|
+
# will return +my_name_space/intent_name+.
|
95
|
+
intent.class.name.split("::").drop(2).join("::").underscore
|
96
|
+
end
|
88
97
|
end
|
89
98
|
end
|
data/lib/alexa/responses/bye.rb
CHANGED
@@ -8,16 +8,18 @@ module Alexa
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def partial_path(format: :ssml)
|
11
|
-
template_path = "alexa/#{intent.context.locale.downcase}/intent_handlers/"\
|
12
|
-
"#{intent.class.name.demodulize.underscore}"
|
13
|
-
|
14
11
|
if format == :ssml
|
15
|
-
"#{
|
12
|
+
"#{partials_directory}/bye.ssml.erb"
|
16
13
|
else
|
17
|
-
"#{
|
14
|
+
"#{partials_directory}/bye.text.erb"
|
18
15
|
end
|
19
16
|
end
|
20
17
|
|
18
|
+
def partials_directory
|
19
|
+
@_partials_directory ||= "alexa/#{intent.context.locale.downcase}/intent_handlers/"\
|
20
|
+
"#{intent.class.name.demodulize.underscore}"
|
21
|
+
end
|
22
|
+
|
21
23
|
def end_session?
|
22
24
|
true
|
23
25
|
end
|
data/lib/alexa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sri Vishnu Totakura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|