fanforce-validations 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzNmYzI5NDgxYThlY2IzZGU3MWU5NDU2ZTMwOWY3MGExYTVhNDdmNA==
4
+ NmQ0MmU3YjhiZjI2MjBiMzcwODZmNjk3YzNjYzE5NzM4Mzg0ZGRkYw==
5
5
  data.tar.gz: !binary |-
6
- MzkyYWYwNGI1NjczYTEwYjFkMzU4N2FlZDg1OTM1OWNjMzBhY2JiYg==
6
+ NGVmNjNlZGNkYWI2YWJlZDExZTRkZTFhZmQ1ODU0ZWI2MmExNDQ0Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjIxNTBmYjJjZTFiNjE1M2MxOWI3Y2QzOGI2MTE2MDhiMjVhZTMxY2QxYzNl
10
- NWI4ZmYwODZhNTNkZmM4MTNkMzM5ZDkzNjRiNTRhNTI0M2JmY2VhNjkzZTA3
11
- NDdjNzRmMWM4MGNhYmJkYTYwZjg1NjYyNGYxMjBjNjExOWMyZTM=
9
+ ODFmNDQ0ZjQwZDljMWNmZDMwY2Q3NWFjNWE3NzI1NDcwZTQ5NTdhYjg3MWJh
10
+ Mjg2YmYyZWRlMDZhOWJiODZkM2EzYjkzMDEyYjhlMTlmZmUzOWE0NDg3OWIw
11
+ MmYxMTY3MGNiZTQ5YWQ0YmVmNDhlYWRlNjUzMDViYWYxYmMzMDY=
12
12
  data.tar.gz: !binary |-
13
- N2ZiZDE2NjJlY2UyODc4ODBlNjY2MWZmZjgzNGVhZTIxM2UxMDE0YWNlMzc3
14
- ZDliOTU0M2ExZjBkMTI4ZjY0NTliODQwODdjOTkyNTYzNzUxMWU4YTVmYmQ3
15
- ZmMwNGRhOGRiMDRjYzQxNjIwYTg1ZWNjNTMwOWFmNmQwMTdlNGM=
13
+ NzA2NDY5N2Q1NDhlYWI0MzU5ZWRlOWMzYTZjZTJlYjg2OGYxM2VlMGMyYTBh
14
+ ZDFjNWQ3MzA1ZTRhNTlhZjE3ZjliNDhiNTk3MjYyOThlMjgyZDc1ODkyMWVk
15
+ NGJlMTYwYjgxOGU5NTcyN2IyNzBmYjJiYzU4ODMwM2RhZjBkMmE=
@@ -33,7 +33,8 @@ module Fanforce::Validations
33
33
  end
34
34
  return true if invalid_fields.size == 0
35
35
 
36
- errors = invalid_fields.inject([]) {|result, f| result << format_validation_error(opts, f, :missing_field) }
36
+ error_code = (invalid_fields.size == 1) ? :missing_field : :missing_fields
37
+ errors = invalid_fields.inject([]) {|result, f| result << format_validation_error(opts, f, error_code) }
37
38
  raise_validation_errors(opts, errors, Fanforce::Error::BadRequest)
38
39
  end
39
40
  alias :validates_presence_of :validates_presence_of_all
@@ -51,7 +52,8 @@ module Fanforce::Validations
51
52
  end
52
53
  return true if invalid_fields.size < fields_to_validate.size
53
54
 
54
- errors = [format_validation_error(opts, invalid_fields, :invalid_data)]
55
+ error_code = (invalid_fields.size == 1) ? :missing_field : :missing_field_from_list
56
+ errors = [format_validation_error(opts, invalid_fields, error_code)]
55
57
  raise_validation_errors(opts, errors, Fanforce::Error::BadRequest)
56
58
  end
57
59
 
@@ -1,5 +1,5 @@
1
1
  class Fanforce
2
2
  module Validations
3
- VERSION = '0.7.0'
3
+ VERSION = '0.7.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fanforce-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clark