alexa_skillsimulator 0.2.0 → 0.2.1
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
- checksums.yaml.gz.sig +1 -3
- data.tar.gz.sig +0 -0
- data/lib/alexa_skillsimulator.rb +37 -51
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abbc370026501a523c3259fe8f621dbef48e0122
|
4
|
+
data.tar.gz: 0c80e56120ec1e3e9f02d3f88e0620a284c916f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97d68b0b36af1377cf106fa2076ecdf0ff2206a5d0a1b2be14e5416a02dd821381b16b0dc7490c92fa4fbd026c15d724518468f025e68889ea44cfccede8aa12
|
7
|
+
data.tar.gz: fc88905b6d47f454d40805feb7bb356eb95920300e6425aa92227952a494d3a4b71ebadf885315ef616291e17145605fad1572b0d782d36dc1ecdc5afe5775b4
|
checksums.yaml.gz.sig
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/alexa_skillsimulator.rb
CHANGED
@@ -11,8 +11,10 @@ require 'securerandom'
|
|
11
11
|
class AlexaShell < ConsoleCmdr
|
12
12
|
|
13
13
|
def initialize(manifest, model, debug: false)
|
14
|
+
|
14
15
|
@alexa = AlexaSkillSimulator.new(manifest, model, debug: debug)
|
15
16
|
super(debug: debug)
|
17
|
+
|
16
18
|
end
|
17
19
|
|
18
20
|
def start()
|
@@ -45,18 +47,22 @@ class AlexaShell < ConsoleCmdr
|
|
45
47
|
|
46
48
|
puts 'on_enter: ' + command.inspect if @debug
|
47
49
|
|
48
|
-
|
50
|
+
case command
|
51
|
+
|
52
|
+
when /^open|tell|ask$/
|
53
|
+
response = @alexa.ask command
|
54
|
+
"Alexa says: " + response
|
55
|
+
|
56
|
+
when /^what can i say/
|
49
57
|
return "you can say the following: \n\n" \
|
50
58
|
+ "open #{@alexa.invocation}\n" + @alexa.utterances.keys.join("\n")
|
51
|
-
end
|
52
|
-
|
53
|
-
return (@running=false; '' ) if command.downcase =~ /^bye|quit|stop|exit$/
|
54
59
|
|
55
|
-
|
60
|
+
when /^bye|quit|stop|exit$/
|
61
|
+
return (@running=false; '' )
|
56
62
|
|
57
|
-
|
58
|
-
|
59
|
-
|
63
|
+
else
|
64
|
+
return false
|
65
|
+
end
|
60
66
|
|
61
67
|
end
|
62
68
|
|
@@ -82,17 +88,14 @@ class AlexaSkillSimulator
|
|
82
88
|
|
83
89
|
@invocation = model['interactionModel']['languageModel']['invocationName']
|
84
90
|
|
85
|
-
# get the utterances
|
86
|
-
|
87
91
|
@utterances = model['interactionModel']['languageModel']\
|
88
92
|
['intents'].inject({}) do |r, intent|
|
89
|
-
intent['samples'].each {|x| r[x] = intent['name']}
|
93
|
+
intent['samples'].each {|x| r[x.downcase] = intent['name']}
|
90
94
|
r
|
91
95
|
end
|
92
96
|
|
93
97
|
puts ' debugger::@utterances: ' + @utterances.inspect if @debug
|
94
98
|
|
95
|
-
# get the endpoint
|
96
99
|
@endpoint = manifest['manifest']['apis']['custom']['endpoint']['uri']
|
97
100
|
|
98
101
|
puts ' debugger: @endpoint: ' + @endpoint.inspect if @debug
|
@@ -113,45 +116,28 @@ class AlexaSkillSimulator
|
|
113
116
|
\g<ask>|\g<open>
|
114
117
|
}x
|
115
118
|
|
116
|
-
r2 = s.match(regex)
|
119
|
+
r2 = s.downcase.match(regex)
|
117
120
|
|
118
121
|
puts ' debugger: r2: ' + r2.inspect if @debug
|
119
122
|
puts
|
120
|
-
|
121
|
-
response = if r2 then
|
122
|
-
|
123
|
-
case r2[:action]
|
124
123
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
r = @utterances[r2[:request]]
|
132
|
-
puts ' debugger: r: ' + r.inspect if @debug
|
133
|
-
puts
|
124
|
+
return "hmmm, I don't know that one." unless r2
|
125
|
+
return respond() if r2[:action] == 'open'
|
126
|
+
|
127
|
+
r = @utterances[r2[:request]]
|
128
|
+
puts ' debugger: r: ' + r.inspect if @debug
|
129
|
+
puts
|
134
130
|
|
135
|
-
|
131
|
+
if r then
|
136
132
|
|
137
|
-
|
133
|
+
puts ' debugger: your intent is to ' + r if @debug
|
138
134
|
|
139
|
-
|
140
|
-
|
141
|
-
else
|
142
|
-
"I'm sorry I didn't understand what you said"
|
143
|
-
end
|
144
|
-
|
145
|
-
end
|
146
|
-
|
147
|
-
else
|
148
|
-
|
149
|
-
"hmmm, I don't know that one."
|
135
|
+
respond(r)
|
150
136
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
137
|
+
else
|
138
|
+
"I'm sorry I didn't understand what you said"
|
139
|
+
end
|
140
|
+
|
155
141
|
end
|
156
142
|
|
157
143
|
|
@@ -195,14 +181,14 @@ class AlexaSkillSimulator
|
|
195
181
|
}
|
196
182
|
|
197
183
|
h['request'] = if intent then
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
184
|
+
{
|
185
|
+
"type"=>"IntentRequest",
|
186
|
+
"requestId"=>"amzn1.echo-api.request.0",
|
187
|
+
"timestamp"=>Time.now.utc.iso8601,
|
188
|
+
"locale"=>@locale,
|
189
|
+
"intent"=>{"name"=>intent, "confirmationStatus"=>"NONE"},
|
190
|
+
"dialogState"=>"STARTED"
|
191
|
+
}
|
206
192
|
else
|
207
193
|
{
|
208
194
|
"type"=>"LaunchRequest",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa_skillsimulator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
gYx7JRswmPvGXlAKr/p3KoEauefzGu8oNgv4HYyTterelwGlwnWJORM09hCjSoNv
|
31
31
|
3NE=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-07-
|
33
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rest-client
|
metadata.gz.sig
CHANGED
Binary file
|