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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b587c2395aa13bbf2cec83953c02a902e87189b4918c9104fb252980889d13f0
4
- data.tar.gz: 798c7e3541fe24bf097733257c6c10a61c76a5253ebb9f07b51d3159912aa5de
3
+ metadata.gz: 937ed40be1057ec3dc54f25a50020fbe08acfa45aa71587808698638ffcd4d95
4
+ data.tar.gz: 9a83ba84a3c8110efee29a929975c424420343eb51d8575db8169ed98e16973d
5
5
  SHA512:
6
- metadata.gz: 3b0c06e79501105585eda22cfd8a87d82a88492a6af42879d27cfae1c1b712ac08cbddcbe2ddef93a9c48f82075ca33329d5382c704e9d224eb794954c68573b
7
- data.tar.gz: c86ab796dbd4fd9f212376c938aa34659bcc46507b2846f9a7ab39bbe775eb630b7973e1fa62d00569ee41d498801c4de644bcf9e0dcff351639e935f785f916
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
@@ -1,4 +1,5 @@
1
1
  require_relative './request_entities/request'
2
+ require_relative './request_entities/lambda_request'
2
3
  require_relative './handler'
3
4
 
4
5
  # Routes an incoming request to the correct Handler.
@@ -1,3 +1,3 @@
1
1
  module Ralyxa
2
- VERSION = '1.8.0'.freeze
2
+ VERSION = '1.9.0'.freeze
3
3
  end
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.8.0
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