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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7556046c7ea3b1dfca62ddf7170a2b87b59377b
4
- data.tar.gz: b94e7ecdbfac2a342285e63a0adabca34e1c968c
3
+ metadata.gz: 539cfd195a197e4ce48e60a2db8d0f789401e052
4
+ data.tar.gz: ede17f06f1c69a117d8b0d13a29d9759bb017748
5
5
  SHA512:
6
- metadata.gz: b0e9409344303d5be74de953799133514067d4bc4fc28a734b59e1bec637d510673205833a73d79599f5f166e503ec885b41be1edd821b43487afe3273551222
7
- data.tar.gz: 63da511b337be4e3a2f7ed821e86a3035d0717f007035284a68878025f4d158963671f166741bf9450797704b451469737b0ab388fa88fb6b30c0e02f42e7a85
6
+ metadata.gz: 8fb175b4fafdaa017473a34dad55f085a6bbb4d0ffa1e4a6b71c45413f19920ebf98b004837d160747c7d9e68d7a164e902a2961f4999474d9938c62fb26f5a7
7
+ data.tar.gz: 551034bbd8268b229e172ffb9e07b8064d735858e2fb90bc79d819733d48e043bdbd405045788db1596235e7cd08473ea5c1c2eade65e7955a78176cc60e2540
@@ -0,0 +1 @@
1
+ soar_wadl_validation
@@ -0,0 +1 @@
1
+ ruby-2.3
@@ -37,7 +37,8 @@ module SoarWadlValidation
37
37
  errors = []
38
38
  entries.each do |entry|
39
39
  if entry[2] == 'true'
40
- errors << "Parameter '#{entry[0]}' is required" if not parameter_present?(request.params, entry[0])
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
@@ -1,3 +1,3 @@
1
1
  module SoarWadlValidation
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-19 00:00:00.000000000 Z
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