soar_wadl_validation 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/lib/soar_wadl_validation.rb +12 -1
- data/lib/soar_wadl_validation/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 539cfd195a197e4ce48e60a2db8d0f789401e052
|
4
|
+
data.tar.gz: ede17f06f1c69a117d8b0d13a29d9759bb017748
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fb175b4fafdaa017473a34dad55f085a6bbb4d0ffa1e4a6b71c45413f19920ebf98b004837d160747c7d9e68d7a164e902a2961f4999474d9938c62fb26f5a7
|
7
|
+
data.tar.gz: 551034bbd8268b229e172ffb9e07b8064d735858e2fb90bc79d819733d48e043bdbd405045788db1596235e7cd08473ea5c1c2eade65e7955a78176cc60e2540
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
soar_wadl_validation
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.3
|
data/lib/soar_wadl_validation.rb
CHANGED
@@ -37,7 +37,8 @@ module SoarWadlValidation
|
|
37
37
|
errors = []
|
38
38
|
entries.each do |entry|
|
39
39
|
if entry[2] == 'true'
|
40
|
-
|
40
|
+
dictionary = extract_dictionary(request)
|
41
|
+
errors << "Parameter '#{entry[0]}' is required" if not parameter_present?(dictionary, entry[0])
|
41
42
|
end
|
42
43
|
# if request.params[entry[0]]
|
43
44
|
# errors << "Parameter #{entry[0]} is not of type #{entry[1]}" if not request.params[entry[0]].class.is_a?(entry[1])
|
@@ -46,6 +47,16 @@ module SoarWadlValidation
|
|
46
47
|
errors.empty? ? nil : errors
|
47
48
|
end
|
48
49
|
|
50
|
+
def extract_dictionary(request)
|
51
|
+
dictionary = {}
|
52
|
+
dictionary = request.params
|
53
|
+
begin
|
54
|
+
dictionary.merge!(JSON.parse(request.body.string)) if request.body
|
55
|
+
rescue
|
56
|
+
end
|
57
|
+
dictionary
|
58
|
+
end
|
59
|
+
|
49
60
|
def parameter_present?(dictionary, param)
|
50
61
|
nested = param.include?('[') and param.include?(']')
|
51
62
|
if not nested
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar_wadl_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernst Van Graan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -137,6 +137,8 @@ extra_rdoc_files: []
|
|
137
137
|
files:
|
138
138
|
- ".gitignore"
|
139
139
|
- ".rspec"
|
140
|
+
- ".ruby-gemset"
|
141
|
+
- ".ruby-version"
|
140
142
|
- ".travis.yml"
|
141
143
|
- Gemfile
|
142
144
|
- LICENSE.txt
|