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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d03309523af0c0f06a2dafb3591955407d52e00cd7f9760525e52b38349e7dc8
4
- data.tar.gz: 7d10169cac5df98db050a0095cbac14d051ab8e68e23059a7b4f2e7988d15a62
3
+ metadata.gz: 6f7424bec9291cbc50679c312fd312806dd0bfa4e8305204f57a6ddf6b62de2e
4
+ data.tar.gz: 4b503fd5f01d4b15ff12e8fef2054fd251f1005a9a32516c1e8eac00fb4dad33
5
5
  SHA512:
6
- metadata.gz: cd6f5a97942b6bdf85bd308f009456bff0b876b9bb34a6bc6fdffe7ca4abbd0dcca32a9d18cfee92a53b7a3d45371410f2685a66cb7c054e33f2734cded96374
7
- data.tar.gz: 337b0cb337acc5ecac5d2baaad60a5b48c3b0ae132881eb9fc64bd82c5ddef896953df1d1402982a560ad4dadb0c4414a96834aa83540a6493eca01f61a8360a
6
+ metadata.gz: 7d797df382fb66afc6def0947558e74219c87955c022a0151d7e0044fe1b1605ac23db0b9312eca60fd82d4fb038d01355c48ee152d89de7db97a4b7ae6f54e9
7
+ data.tar.gz: 5d4ba2496b7054b58a4925e40ee4815b5d75c40438574e8c9dd939bf693b03d909eec63779f18d6c6751201062aca89a5e60f94eb9bea9efe845135e0318aea2
@@ -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
- "#{template_path}/#{filename}.ssml.erb"
45
+ "#{partials_directory}/#{filename}.ssml.erb"
49
46
  else
50
- "#{template_path}/#{filename}.text.erb"
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
- "#{template_path}/elicitations/#{slot_to_elicit.underscore}.ssml.erb"
52
+ "#{partials_directory}/elicitations/#{slot_to_elicit.underscore}.ssml.erb"
56
53
  else
57
- "#{template_path}/elicitations/#{slot_to_elicit.underscore}.text.erb"
54
+ "#{partials_directory}/elicitations/#{slot_to_elicit.underscore}.text.erb"
58
55
  end
59
56
  else
60
57
  if format == :ssml
61
- "#{template_path}/default.ssml.erb"
58
+ "#{partials_directory}/default.ssml.erb"
62
59
  else
63
- "#{template_path}/default.text.erb"
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
@@ -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
- "#{template_path}/bye.ssml.erb"
12
+ "#{partials_directory}/bye.ssml.erb"
16
13
  else
17
- "#{template_path}/bye.text.erb"
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
@@ -1,3 +1,3 @@
1
1
  module Alexa
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
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.6
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-06-24 00:00:00.000000000 Z
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails