json_check 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/json_check.rb +8 -7
- 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: f4b90d3ec5b077f172e589238e26d45a3c05696f
|
4
|
+
data.tar.gz: 17dbcabb3f6242976386226441e9e2b88a3d008e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04f689f557a364da8fc169d4ef7136d688a2bfa09a4d257afbdc36e5c9f84841f82d13977dee043783ac3cfd2523546f6edbd5c93cffcc85c65dddb6072cbc5f
|
7
|
+
data.tar.gz: 96ec1692cd3f6f3479b1791f283b76fca003c125583129837c357c1179574a8746d04a558976b791ab7ddd300d180ad1017c6abbd57af57298a4a3ac1c4d758e
|
data/lib/json_check.rb
CHANGED
@@ -22,7 +22,7 @@ module JSON_check
|
|
22
22
|
'Float' => ['null', 'required', 'enum', 'compare', 'integer'],
|
23
23
|
'String' => ['null', 'required', 'enum', 'mask'],
|
24
24
|
'Boolean' => ['null', 'required', 'enum'],
|
25
|
-
'URL' => ['null', 'required', 'mask'],
|
25
|
+
'URL' => ['null', 'required', 'mask', 'empty'],
|
26
26
|
'Array' => ['null', 'required', 'empty', 'pattern', 'patterns'],
|
27
27
|
'Hash' => ['null', 'required', 'pattern', 'patterns', 'dynamic_key'],
|
28
28
|
'NULL' => ['required']
|
@@ -204,12 +204,12 @@ module JSON_check
|
|
204
204
|
change_status
|
205
205
|
end
|
206
206
|
when 'URL'
|
207
|
-
unless check_url value, c_p["null"]
|
207
|
+
unless check_url value, c_p["null"], c_p["empty"]
|
208
208
|
add({key=>value}, num != last, "It must be URL")
|
209
209
|
failure = true
|
210
210
|
change_status
|
211
211
|
end
|
212
|
-
unless failure or value.nil?
|
212
|
+
unless failure or value.nil? or value == ''
|
213
213
|
status = 0
|
214
214
|
attempt = 0
|
215
215
|
while status != 200 and attempt < 8
|
@@ -367,12 +367,12 @@ module JSON_check
|
|
367
367
|
change_status
|
368
368
|
end
|
369
369
|
when 'URL'
|
370
|
-
unless check_url value, ptn['null']
|
370
|
+
unless check_url value, ptn['null'], ptn['empty']
|
371
371
|
add([value], num != last, "It must be URL")
|
372
372
|
failure = true
|
373
373
|
change_status
|
374
374
|
end
|
375
|
-
unless failure
|
375
|
+
unless failure or value == ''
|
376
376
|
status = 0
|
377
377
|
attempt = 0
|
378
378
|
while status != 200 and attempt < 8
|
@@ -541,7 +541,8 @@ module JSON_check
|
|
541
541
|
return (arg.class == TrueClass or arg.class == FalseClass)
|
542
542
|
end
|
543
543
|
|
544
|
-
def self.check_url arg, null
|
544
|
+
def self.check_url arg, null, empty
|
545
|
+
return true if empty && arg.class == String && arg == ''
|
545
546
|
return true if null && arg.class == NilClass
|
546
547
|
return false unless arg.class == String
|
547
548
|
attempt = 0
|
@@ -717,4 +718,4 @@ module JSON_check
|
|
717
718
|
return true
|
718
719
|
end
|
719
720
|
|
720
|
-
end
|
721
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Motin Artem
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|