alexa_skillresponse 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/alexa_skillresponse.rb +31 -8
- metadata +7 -8
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d486aeca39fe81f082a334eb2318f9f0882a48c8a57747a985a7e095a11d1403
|
4
|
+
data.tar.gz: 512bccdae79ae963e0a689519f06def2dd3e8dc95948d098399dc5d08a05fe9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 528a5c267e4a6400ff7590957b3d83ba0e55d3114d13c91ba2c95fe7088980f2fe63a02d1ad1bee6f6430ff3e446a914a5e2aeec61a83fd694ad23c8b1811c3b
|
7
|
+
data.tar.gz: 87d3370fd48549e22157030a524df31ee6c9ed06c1cb40aed52524ef896ebb8c65aeb8cbfe2362c4e667d8467aa723660791dff08e22742b03238199822484bd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/alexa_skillresponse.rb
CHANGED
@@ -7,6 +7,7 @@ require 'rscript'
|
|
7
7
|
|
8
8
|
|
9
9
|
class AlexaSkillResponse
|
10
|
+
using ColouredText
|
10
11
|
|
11
12
|
def initialize(package, debug: false, rsc: nil,
|
12
13
|
whitelist: {users: nil, devices: nil})
|
@@ -15,7 +16,7 @@ class AlexaSkillResponse
|
|
15
16
|
@package, @debug, @rsc = package, debug, rsc
|
16
17
|
puts '@package: ' + @package.inspect if @debug
|
17
18
|
|
18
|
-
@
|
19
|
+
@users, @devices = whitelist[:users], whitelist[:devices]
|
19
20
|
puts '@user_list: ' + @user_list.inspect if @debug
|
20
21
|
|
21
22
|
end
|
@@ -28,32 +29,54 @@ class AlexaSkillResponse
|
|
28
29
|
|
29
30
|
def run(h)
|
30
31
|
|
32
|
+
puts 'inside run: '.info if @debug
|
33
|
+
|
31
34
|
userid = h[:session][:user][:userId]
|
35
|
+
puts ('userid: ' + userid.inspect).debug if @debug
|
36
|
+
|
32
37
|
deviceid = h[:context][:System][:device][:deviceId]
|
33
|
-
puts '
|
38
|
+
puts ('deviceid: ' + userid.inspect).debug if @debug
|
34
39
|
|
35
|
-
if @
|
40
|
+
if @users and not @users.include? userid then
|
36
41
|
return output('Sorry, unauthorized user.')
|
42
|
+
else
|
43
|
+
user = @users[userid]
|
44
|
+
puts ('user: ' + user.inspect).debug if @debug
|
37
45
|
end
|
38
46
|
|
39
|
-
if @
|
47
|
+
if @devices and not @devices.include? deviceid then
|
40
48
|
return output('Sorry, unauthorized device.')
|
41
|
-
|
42
|
-
|
49
|
+
else
|
50
|
+
device = @devices[deviceid]
|
51
|
+
puts ('device: ' + device.inspect).debug if @debug
|
52
|
+
end
|
53
|
+
|
43
54
|
req = h[:request]
|
44
55
|
|
45
56
|
id = req[:type] == 'IntentRequest' ? req[:intent][:name] : 'welcome'
|
46
57
|
puts 'id: ' + id.inspect if @debug
|
47
58
|
|
48
59
|
code, _, attr = @rscript.read ['//response:' + id, @package]
|
49
|
-
|
60
|
+
|
61
|
+
if @rsc then
|
62
|
+
|
63
|
+
rsc = @rsc
|
64
|
+
puts 'rsc found'.info if @debug
|
65
|
+
if rsc.registry and user and device then
|
66
|
+
puts ('sending to the registry').info if @debug
|
67
|
+
rsc.registry.set_key("hkey_apps/alexa/users/" +
|
68
|
+
user.downcase.gsub(/\W+/,'_') + "/lastsession/device", device)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
50
72
|
puts 'code:' + code.inspect if @debug
|
51
73
|
text, mimetype = eval(code)
|
52
74
|
|
53
75
|
return out if mimetype == 'application/json'
|
54
76
|
|
55
77
|
output text, attentive: attr[:attentive]
|
56
|
-
|
78
|
+
=begin
|
79
|
+
=end
|
57
80
|
end
|
58
81
|
|
59
82
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa_skillresponse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
LlGV+1M7EF/3KD6gOhEYz1EWlT542WsvEMRT4NNheh4sollCx//BxyUcXIXUB3Af
|
31
31
|
vMQ=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2019-03-08 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rscript
|
@@ -38,20 +38,20 @@ dependencies:
|
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0.
|
41
|
+
version: '0.7'
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.
|
44
|
+
version: 0.7.1
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
49
|
- - "~>"
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: '0.
|
51
|
+
version: '0.7'
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.7.1
|
55
55
|
description:
|
56
56
|
email: james@jamesrobertson.eu
|
57
57
|
executables: []
|
@@ -78,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
|
-
|
82
|
-
rubygems_version: 2.6.13
|
81
|
+
rubygems_version: 3.0.1
|
83
82
|
signing_key:
|
84
83
|
specification_version: 4
|
85
84
|
summary: Responds to an Alexa Skill request using Ruby scripts embedded in a kind
|
metadata.gz.sig
CHANGED
Binary file
|