flexirest 1.2.8 → 1.2.9
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/CHANGELOG.md +6 -0
- data/lib/flexirest/validation.rb +4 -4
- data/lib/flexirest/version.rb +1 -1
- 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: 81462a92874dcd46c379c35a305f9fa6c0cfbdea
|
4
|
+
data.tar.gz: fad159ec5aa84dc8f60e840f18a8ea161101cbd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5354c2a387defe3e442edd48a41fc859e9c52143785cd13c3f119c7b3e3e0e3d4a88eed08aed1392c7a37de687dfc4c2611e4fec3fcd098f15179e1a0e96951
|
7
|
+
data.tar.gz: 273024d2280a99e634bea16561f6d364842a6dc88335993751d46ed658bac0323ad5dc859a3187f610b536475a504488b6d42d93a7f2cf45eafd05132e32b162
|
data/CHANGELOG.md
CHANGED
data/lib/flexirest/validation.rb
CHANGED
@@ -30,7 +30,7 @@ module Flexirest
|
|
30
30
|
elsif type == :existence
|
31
31
|
if value.nil?
|
32
32
|
@errors[validation[:field_name]] << "must be not be nil"
|
33
|
-
end
|
33
|
+
end
|
34
34
|
elsif type == :length
|
35
35
|
if options[:within]
|
36
36
|
@errors[validation[:field_name]] << "must be within range #{options[:within]}" unless options[:within].include?(value.to_s.length )
|
@@ -39,7 +39,7 @@ module Flexirest
|
|
39
39
|
@errors[validation[:field_name]] << "must be at least #{options[:minimum]} characters long" unless value.to_s.length >= options[:minimum]
|
40
40
|
end
|
41
41
|
if options[:maximum]
|
42
|
-
@errors[validation[:field_name]] << "must be no more than #{options[:
|
42
|
+
@errors[validation[:field_name]] << "must be no more than #{options[:maximum]} characters long" unless value.to_s.length <= options[:maximum]
|
43
43
|
end
|
44
44
|
elsif type == :numericality
|
45
45
|
numeric = (true if Float(value) rescue false)
|
@@ -51,7 +51,7 @@ module Flexirest
|
|
51
51
|
@errors[validation[:field_name]] << "must be at least #{options[:minimum]}" unless value.to_f >= options[:minimum]
|
52
52
|
end
|
53
53
|
if options[:maximum]
|
54
|
-
@errors[validation[:field_name]] << "must be no more than #{options[:
|
54
|
+
@errors[validation[:field_name]] << "must be no more than #{options[:maximum]}" unless value.to_f <= options[:maximum]
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -74,7 +74,7 @@ module Flexirest
|
|
74
74
|
return "" unless _errors.present?
|
75
75
|
_errors.reduce([]) do |memo, (field, errors)|
|
76
76
|
memo << "#{field.to_s} #{errors.join(' and ')}"
|
77
|
-
end
|
77
|
+
end
|
78
78
|
end
|
79
79
|
|
80
80
|
def _errors
|
data/lib/flexirest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexirest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|