alexa_skillsimulator 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: ffc1b176b365392be314945733ba137b7db5edef
4
- data.tar.gz: c8f8a2045047e82c6dbb28e1c98e7a02a6b3e277
3
+ metadata.gz: abbc370026501a523c3259fe8f621dbef48e0122
4
+ data.tar.gz: 0c80e56120ec1e3e9f02d3f88e0620a284c916f1
5
5
  SHA512:
6
- metadata.gz: 100a3a7c1dbb4a328ff8c867f52d64edbbd982e882fd787cf9b9b5cf88b9a7fc13cdef744f909c6ee3576c045249947fc155f5c0560b52238cfef948c5e4bee1
7
- data.tar.gz: c9cd8a1db62befba27c7dea325a4d50a9596dca2dae8d6ce26576f795c38f795cfa0624a4190becaea5e04a72cfd61f7f5500725aabb8ec459770a33b9da43af
6
+ metadata.gz: 97d68b0b36af1377cf106fa2076ecdf0ff2206a5d0a1b2be14e5416a02dd821381b16b0dc7490c92fa4fbd026c15d724518468f025e68889ea44cfccede8aa12
7
+ data.tar.gz: fc88905b6d47f454d40805feb7bb356eb95920300e6425aa92227952a494d3a4b71ebadf885315ef616291e17145605fad1572b0d782d36dc1ecdc5afe5775b4
@@ -1,3 +1 @@
1
- V��x�W��uwϷ�rRNW������mz�(�.�!$�@Њ��]]P������M���oٵ�̯>+"���U���c]
2
- �=R�:�f�35ݠCj��s`��Eo�1S{SÍ�*�]�5��U��D0�~��BT���I��;��*O�F�^^
3
- y`A�hGw|
1
+ �r�]v=,W�?I=XvXC~��3^}$�
data.tar.gz.sig CHANGED
Binary file
@@ -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
- if command =~ /^what can i say/ then
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
- return false unless command =~ /^open|tell|ask$/
60
+ when /^bye|quit|stop|exit$/
61
+ return (@running=false; '' )
56
62
 
57
- response = @alexa.ask command.downcase
58
- "Alexa says: " + response
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
- when 'open'
126
-
127
- respond()
128
-
129
- else
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
- if r then
131
+ if r then
136
132
 
137
- puts ' debugger: your intent is to ' + r if @debug
133
+ puts ' debugger: your intent is to ' + r if @debug
138
134
 
139
- respond(r)
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
- end
152
-
153
- response
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
- "type"=>"IntentRequest",
200
- "requestId"=>"amzn1.echo-api.request.0",
201
- "timestamp"=>Time.now.utc.iso8601,
202
- "locale"=>@locale,
203
- "intent"=>{"name"=>intent, "confirmationStatus"=>"NONE"},
204
- "dialogState"=>"STARTED"
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.0
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-02 00:00:00.000000000 Z
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