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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1d65bda738847e8070985bb73fd27c192321d633
4
- data.tar.gz: 44c2ca6d1ea98589e6ac9d09627296d801a835f9
2
+ SHA256:
3
+ metadata.gz: d486aeca39fe81f082a334eb2318f9f0882a48c8a57747a985a7e095a11d1403
4
+ data.tar.gz: 512bccdae79ae963e0a689519f06def2dd3e8dc95948d098399dc5d08a05fe9c
5
5
  SHA512:
6
- metadata.gz: 3d483deae42e129f56be73450c85b3e2d589bf6f1ce4e555f58690e75a7b4a9cc4e62bbbde620b90be1a696541576c612c459130863c9a0436d04474d495db1d
7
- data.tar.gz: 1402b964d0e8ea4eab8680c7b9ea34020fbee2b099d8e7c994d573501bda24157f2f0659666a401c555ef761dbac20a62fa195b799efc9ac610f67b60f288188
6
+ metadata.gz: 528a5c267e4a6400ff7590957b3d83ba0e55d3114d13c91ba2c95fe7088980f2fe63a02d1ad1bee6f6430ff3e446a914a5e2aeec61a83fd694ad23c8b1811c3b
7
+ data.tar.gz: 87d3370fd48549e22157030a524df31ee6c9ed06c1cb40aed52524ef896ebb8c65aeb8cbfe2362c4e667d8467aa723660791dff08e22742b03238199822484bd
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- @user_list, @device_list = whitelist[:users], whitelist[:devices]
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 'userid: ' + userid.inspect if @debug
38
+ puts ('deviceid: ' + userid.inspect).debug if @debug
34
39
 
35
- if @user_list and not @user_list.include? userid then
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 @device_list and not @device_list.include? deviceid then
47
+ if @devices and not @devices.include? deviceid then
40
48
  return output('Sorry, unauthorized device.')
41
- end
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
- rsc = @rsc if @rsc
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.3
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: 2018-07-29 00:00:00.000000000 Z
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.4'
41
+ version: '0.7'
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.4.4
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.4'
51
+ version: '0.7'
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.4.4
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
- rubyforge_project:
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