ralyxa-lambda 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ralyxa/request_entities/lambda_request.rb +31 -0
- data/lib/ralyxa/request_entities/request.rb +7 -0
- data/lib/ralyxa/skill.rb +1 -0
- data/lib/ralyxa/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 937ed40be1057ec3dc54f25a50020fbe08acfa45aa71587808698638ffcd4d95
|
4
|
+
data.tar.gz: 9a83ba84a3c8110efee29a929975c424420343eb51d8575db8169ed98e16973d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5969e52728f88283fc54fd17ce2f93a49eab98ce95ae33ba0045ecf7f92ab176e0e193f3b816f40cc5f7933e656d83274e4d033a3c77364fb539864e2065d366
|
7
|
+
data.tar.gz: d42f2aa6ec9628fc4ff53eda91f8c2d6e28c7493a5132a1df24f8fd75213216a4b85cd19b19098b06ff196ac05df4ef22bb3507266e5ffd28ecae27fb8132693
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'forwardable'
|
3
|
+
require 'alexa_verifier'
|
4
|
+
require_relative './user'
|
5
|
+
|
6
|
+
module Ralyxa
|
7
|
+
module RequestEntities
|
8
|
+
class LambdaRequest < Request
|
9
|
+
extend Forwardable
|
10
|
+
INTENT_REQUEST_TYPE = 'IntentRequest'.freeze
|
11
|
+
|
12
|
+
def_delegator :@user, :id, :user_id
|
13
|
+
def_delegator :@user, :access_token, :user_access_token
|
14
|
+
def_delegator :@user, :access_token_exists?, :user_access_token_exists?
|
15
|
+
|
16
|
+
attr_reader :request
|
17
|
+
|
18
|
+
def initialize(event, user_class = Ralyxa::RequestEntities::User)
|
19
|
+
@request = event
|
20
|
+
@user = user_class.build(@request)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def validate_request(request)
|
26
|
+
true
|
27
|
+
end
|
28
|
+
alias_method :attempt_to_rewind_request_body, :validate_request
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -33,6 +33,13 @@ module Ralyxa
|
|
33
33
|
@request['request']['intent']['slots'][slot_name]['value']
|
34
34
|
end
|
35
35
|
|
36
|
+
def slot_id(slot_name)
|
37
|
+
resolution = @request['request']['intent']['slots'][slot_name]['resolutions']['resolutionsPerAuthority'].select do |resolution|
|
38
|
+
resolution['status']['code'] == 'ER_SUCCESS_MATCH'
|
39
|
+
end
|
40
|
+
resolution.first['values'].first['value']['id']
|
41
|
+
end
|
42
|
+
|
36
43
|
def new_session?
|
37
44
|
@request['session']['new']
|
38
45
|
end
|
data/lib/ralyxa/skill.rb
CHANGED
data/lib/ralyxa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ralyxa-lambda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Morgan
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- lib/ralyxa/errors.rb
|
150
150
|
- lib/ralyxa/handler.rb
|
151
151
|
- lib/ralyxa/register_intents.rb
|
152
|
+
- lib/ralyxa/request_entities/lambda_request.rb
|
152
153
|
- lib/ralyxa/request_entities/request.rb
|
153
154
|
- lib/ralyxa/request_entities/user.rb
|
154
155
|
- lib/ralyxa/response_builder.rb
|