alexa_ruby 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/alexa_ruby/alexa.rb +12 -2
- data/lib/alexa_ruby/version.rb +1 -1
- data/lib/alexa_ruby.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef6318023e97d0690ce4b2ffbae5f97b33d94a1
|
4
|
+
data.tar.gz: 2fbe7fbc0f0fa1d291c046c29b821b958a2f5932
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5bca1bc8b0753d216344a946d5c138eac83f8c7db3b04a2d85547180edf875e60fe37fd380742849f7a653d08b578e2bad2ffab1a9ed6850536249e92305331
|
7
|
+
data.tar.gz: 33cda627fe06f51af512396f4e09170b74f59cd9d2ca1734dec524bbc7cf1355b6b7b2a6a6acc5261cc833b991e6faafb06e25c741b097496e6bc088e46e6636
|
data/CHANGELOG
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -63,6 +63,12 @@ class App < Roda
|
|
63
63
|
end
|
64
64
|
```
|
65
65
|
|
66
|
+
Request validations can be disabled:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
AlexaRuby.new(request, disable_validations: true)
|
70
|
+
```
|
71
|
+
|
66
72
|
After initializing new AlexaRuby instance you will have a possibility to access
|
67
73
|
all parameters of the received request.
|
68
74
|
|
data/lib/alexa_ruby/alexa.rb
CHANGED
@@ -7,8 +7,11 @@ module AlexaRuby
|
|
7
7
|
# Initialize new Alexa assistant
|
8
8
|
#
|
9
9
|
# @param request [Hash] request from Amazon Alexa web service
|
10
|
-
|
10
|
+
# @param opts [Hash] additional options:
|
11
|
+
# :disable_validations [Boolean] disables request validation if true
|
12
|
+
def initialize(request, opts)
|
11
13
|
@req = request
|
14
|
+
@opts = opts
|
12
15
|
invalid_request_exception if invalid_request?
|
13
16
|
@request = define_request
|
14
17
|
raise ArgumentError, 'Unknown type of Alexa request' if @request.nil?
|
@@ -17,11 +20,18 @@ module AlexaRuby
|
|
17
20
|
|
18
21
|
private
|
19
22
|
|
23
|
+
# Check if validations are enabled
|
24
|
+
#
|
25
|
+
# @return [Boolean]
|
26
|
+
def validations_enabled?
|
27
|
+
!@opts[:disable_validations] || @opts[:disable_validations].nil?
|
28
|
+
end
|
29
|
+
|
20
30
|
# Check if it is an invalid request
|
21
31
|
#
|
22
32
|
# @return [Boolean]
|
23
33
|
def invalid_request?
|
24
|
-
@req[:version].nil? || @req[:request].nil?
|
34
|
+
@req[:version].nil? || @req[:request].nil? if validations_enabled?
|
25
35
|
end
|
26
36
|
|
27
37
|
# Request structure isn't valid, raise exception
|
data/lib/alexa_ruby/version.rb
CHANGED
data/lib/alexa_ruby.rb
CHANGED
@@ -26,11 +26,13 @@ module AlexaRuby
|
|
26
26
|
#
|
27
27
|
# @param request [Object] request from Amazon Alexa web service,
|
28
28
|
# can be hash or JSON encoded string
|
29
|
+
# @param opts [Hash] additional options:
|
30
|
+
# :disable_validations [Boolean] disables request validation if true
|
29
31
|
# @return [Object] new Request object instance
|
30
32
|
# @raise [ArgumentError] if given object isn't a valid JSON object
|
31
|
-
def new(request)
|
33
|
+
def new(request, opts = {})
|
32
34
|
obj = build_json(request)
|
33
|
-
Alexa.new(obj)
|
35
|
+
Alexa.new(obj, opts)
|
34
36
|
end
|
35
37
|
|
36
38
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexa_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Mulev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|