alexa_skillresponse 0.1.1 → 0.1.2

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: c710de5e6f145bf73eaa45526b77199d342c0364
4
- data.tar.gz: 7fc5bf7da664aa494c2c5fcf7cb47faba6f118e4
3
+ metadata.gz: 51e5d8217fdacac6bb2c341bb27c3af506d974cd
4
+ data.tar.gz: ae332e443338b7cec78bf5d1a28b712e2f5d68c5
5
5
  SHA512:
6
- metadata.gz: 61ff0597555d8687e9117bbe1a8072cc5c4758e845b915c39afa0ed8820f4c3fccab9062b8a642cd668de92cd5567ad8fac7d20351932c8b1a0154191d8f19bf
7
- data.tar.gz: afa9600d8b582aa3971cdbfd08d4daf1145ef91f6d75e761d3d26bf232438c3313452978b653a6884c108a12ed5df7bf7eb6b100cc3664ab91769b5068c28414
6
+ metadata.gz: b6a6fa8139071c84a0dfc906843e29bdd3451a178c7e2ea1c719e9ac76906e82605f15d155b3548ddadf9fefd912db9eba6c83b05c5fbd04f315ab17e1ff2ff1
7
+ data.tar.gz: 329b7035b23883c667fb56821f74df31a7dba5ab8a8c95860f55251a8f87c54f86afd68bd3a7ff0698e9f9e23e9180bdc1c0f20611c3106f80629f8f6988c470
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- ��ƖY�=o. }j�L��RoU�Z εh-z�0� ����Vw��$e�����$�� l@�!��_�Hٽ`s¸@:��P}>̴7l{0>�9|��G��(�P�ǽ�-��4h@!���K@Uh�m��t����Yvr��$�C;�?�‰�R!��� ��G:�q �nUq� ��{}�n�'I[`y�2���5/�" "�܇��<���(��g{9$!�����ҀW���� u��Gx����@jY��-?��
1
+ 0-Q:Yxr WȫN�
@@ -8,33 +8,51 @@ require 'rscript'
8
8
 
9
9
  class AlexaSkillResponse
10
10
 
11
- def initialize(package, debug: false, rsc: nil)
11
+ def initialize(package, debug: false, rsc: nil,
12
+ whitelist: {users: nil, devices: nil})
12
13
 
13
- @rscript = RScript.new(type: 'response', debug: debug)
14
+ @rscript = RScript.new(type: 'response', debug: debug, cache: nil)
14
15
  @package, @debug, @rsc = package, debug, rsc
15
16
  puts '@package: ' + @package.inspect if @debug
16
17
 
18
+ @user_list, @device_list = whitelist[:users], whitelist[:devices]
19
+ puts '@user_list: ' + @user_list.inspect if @debug
20
+
17
21
  end
18
22
 
19
23
  def run(h)
24
+
25
+ userid = h[:session][:user][:userId]
26
+ deviceid = h[:context][:System][:device][:deviceId]
27
+ puts 'userid: ' + userid.inspect if @debug
20
28
 
29
+ if @user_list and not @user_list.include? userid then
30
+ return output('Sorry, unauthorized user.')
31
+ end
32
+
33
+ if @device_list and not @device_list.include? deviceid then
34
+ return output('Sorry, unauthorized device.')
35
+ end
36
+
21
37
  req = h[:request]
38
+
22
39
  id = req[:type] == 'IntentRequest' ? req[:intent][:name] : 'welcome'
23
40
  puts 'id: ' + id.inspect if @debug
24
41
 
25
42
  code, _, attr = @rscript.read ['//response:' + id, @package]
26
43
  rsc = @rsc if @rsc
44
+ puts 'code:' + code.inspect if @debug
27
45
  text, mimetype = eval(code)
28
46
 
29
47
  return out if mimetype == 'application/json'
30
48
 
31
- output text, attr[:attentive]
49
+ output text, attentive: attr[:attentive]
32
50
 
33
51
  end
34
52
 
35
53
  private
36
54
 
37
- def output(s='I hear you', attentive)
55
+ def output(s='I hear you', attentive: false)
38
56
 
39
57
  h = {
40
58
  version: "1.0",
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.1
4
+ version: 0.1.2
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-12 00:00:00.000000000 Z
33
+ date: 2018-07-13 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rscript
@@ -41,7 +41,7 @@ dependencies:
41
41
  version: '0.4'
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.4.3
44
+ version: 0.4.4
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,7 +51,7 @@ dependencies:
51
51
  version: '0.4'
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.4.3
54
+ version: 0.4.4
55
55
  description:
56
56
  email: james@jamesrobertson.eu
57
57
  executables: []
metadata.gz.sig CHANGED
Binary file