active_validation 4.0.7 → 4.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/.rubocop.yml +14 -12
- data/active_validation.gemspec +1 -0
- data/lib/active_validation/validators/coordinate_validator.rb +1 -1
- data/lib/active_validation/validators/credit_card_validator.rb +12 -12
- data/lib/active_validation/validators/isbn_validator.rb +1 -1
- data/lib/active_validation/validators/tracking_number_validator.rb +2 -2
- data/lib/active_validation/validators/url_validator.rb +1 -1
- data/lib/active_validation/version.rb +1 -1
- data/lib/active_validation.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91f5bc2ffa4caf18e05f39ecd8f8deda3937091b
|
4
|
+
data.tar.gz: ff902a17fd63dddf75c4a687f809867d9ac68ead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9cccc0c94152f26ab7c24d75e48ef30f86ae02c0e8862a7e4c0f1246a53c9d7c02bc47c494161f8375d7cf58bff670ce4adecb7579f9576679456434d8122ab
|
7
|
+
data.tar.gz: 68fd81d6cd9c426c57e14db746ac570af7bd45b07f4d91c749b20229fb7dad2eed704fd0792f0f5fffc7094069ab017dae6923e5302dd140edf4f9b013ae80a3
|
data/.rubocop.yml
CHANGED
@@ -4,8 +4,22 @@ AllCops:
|
|
4
4
|
TargetRubyVersion: 2.3
|
5
5
|
Exclude:
|
6
6
|
- 'spec/**/**/*'
|
7
|
+
Layout/ClosingParenthesisIndentation:
|
8
|
+
Enabled: false
|
9
|
+
Layout/EmptyLinesAroundBlockBody:
|
10
|
+
Enabled: false
|
11
|
+
Layout/EmptyLinesAroundClassBody:
|
12
|
+
Enabled: false
|
13
|
+
Layout/EmptyLinesAroundModuleBody:
|
14
|
+
Enabled: false
|
15
|
+
Layout/FirstParameterIndentation:
|
16
|
+
Enabled: false
|
17
|
+
Layout/MultilineMethodCallIndentation:
|
18
|
+
EnforcedStyle: aligned
|
7
19
|
LineLength:
|
8
20
|
Max: 100
|
21
|
+
Lint/ScriptPermission:
|
22
|
+
Enabled: false
|
9
23
|
Metrics/AbcSize:
|
10
24
|
Enabled: false
|
11
25
|
Metrics/ClassLength:
|
@@ -28,24 +42,12 @@ Style/ClassAndModuleChildren:
|
|
28
42
|
Enabled: false
|
29
43
|
Style/ClassVars:
|
30
44
|
Enabled: false
|
31
|
-
Style/ClosingParenthesisIndentation:
|
32
|
-
Enabled: false
|
33
45
|
Style/Documentation:
|
34
46
|
Enabled: false
|
35
|
-
Style/EmptyLinesAroundBlockBody:
|
36
|
-
Enabled: false
|
37
|
-
Style/EmptyLinesAroundClassBody:
|
38
|
-
Enabled: false
|
39
|
-
Style/EmptyLinesAroundModuleBody:
|
40
|
-
Enabled: false
|
41
47
|
Style/HashSyntax:
|
42
48
|
Enabled: false
|
43
|
-
Style/FirstParameterIndentation:
|
44
|
-
Enabled: false
|
45
49
|
Style/FrozenStringLiteralComment:
|
46
50
|
Enabled: false
|
47
|
-
Style/MultilineMethodCallIndentation:
|
48
|
-
EnforcedStyle: aligned
|
49
51
|
Style/NumericLiterals:
|
50
52
|
Enabled: false
|
51
53
|
Style/RescueModifier:
|
data/active_validation.gemspec
CHANGED
@@ -15,23 +15,23 @@ class CreditCardValidator < ActiveModel::EachValidator
|
|
15
15
|
|
16
16
|
# rubocop:disable Style/IndentArray
|
17
17
|
PREFIXES ||= {
|
18
|
-
american_express: %w
|
19
|
-
diners_club: %w
|
20
|
-
discover: %w
|
18
|
+
american_express: %w[34 37],
|
19
|
+
diners_club: %w[300 301 302 303 304 305 36 54 55],
|
20
|
+
discover: %w[
|
21
21
|
6011 622126 622127 622128 622129 62213 62214 62215 62216 62217 62218 62219 6222
|
22
22
|
6223 6224 6225 6226 6227 6228 62290 62291 622920 622921 622922 622923 622924
|
23
23
|
622925 644 645 646 647 648 649 65
|
24
|
-
|
25
|
-
jcb: %w
|
26
|
-
laser: %w
|
27
|
-
maestro: %w
|
28
|
-
mastercard: %w
|
29
|
-
solo: %w
|
30
|
-
unionpay: %w
|
24
|
+
],
|
25
|
+
jcb: %w[3528 3529 353 354 355 356 357 358],
|
26
|
+
laser: %w[6304 6706 6771 6709],
|
27
|
+
maestro: %w[5018 5020 5038 6304 6759 6761 6762 6763 6764 6765 6766],
|
28
|
+
mastercard: %w[51 52 53 54 55],
|
29
|
+
solo: %w[6334 6767],
|
30
|
+
unionpay: %w[
|
31
31
|
622126 622127 622128 622129 62213 62214 62215 62216 62217 62218 62219 6222 6223
|
32
32
|
6224 6225 6226 6227 6228 62290 62291 622920 622921 622922 622923 622924 622925
|
33
|
-
|
34
|
-
visa: %w
|
33
|
+
],
|
34
|
+
visa: %w[4]
|
35
35
|
}.freeze
|
36
36
|
# rubocop:enable Style/IndentArray
|
37
37
|
|
@@ -58,7 +58,7 @@ class TrackingNumberValidator < ActiveModel::EachValidator
|
|
58
58
|
end
|
59
59
|
|
60
60
|
CARRIERS_AND_SERVICES[:fedex]
|
61
|
-
.select { |key, _| [
|
61
|
+
.select { |key, _| %i[ground ground18 ground96].include?(key) }
|
62
62
|
.each_with_index do |(srv, pat), idx|
|
63
63
|
define_method("valid_fedex_#{srv}_checksum?") do |val|
|
64
64
|
return(false) unless val.size == [15, 18, 22].at(idx)
|
@@ -103,7 +103,7 @@ class TrackingNumberValidator < ActiveModel::EachValidator
|
|
103
103
|
|
104
104
|
# Ontrac & UPS
|
105
105
|
CARRIERS_AND_SERVICES
|
106
|
-
.select { |key, _| [
|
106
|
+
.select { |key, _| %i[ontrac ups].include?(key) }
|
107
107
|
.each_with_index do |(cars, sers), idx|
|
108
108
|
sers.each do |ser, pat|
|
109
109
|
define_method("valid_#{cars}_#{ser}_checksum?") do |val|
|
data/lib/active_validation.rb
CHANGED
@@ -3,11 +3,11 @@ require 'active_support'
|
|
3
3
|
require 'active_support/core_ext/time/zones'
|
4
4
|
require 'active_validation/version'
|
5
5
|
|
6
|
-
ACTIVE_VALIDATION_VALIDATORS ||= %w
|
6
|
+
ACTIVE_VALIDATION_VALIDATORS ||= %w[
|
7
7
|
alpha alpha_numeric base64 boolean coordinate credit_card currency cusip email equality hex imei
|
8
8
|
ip isbn isin mac_address name password phone sedol slug ssn time_zone tracking_number type url
|
9
9
|
username uuid
|
10
|
-
|
10
|
+
].freeze
|
11
11
|
|
12
12
|
ACTIVE_VALIDATION_VALIDATORS.each do |file_name|
|
13
13
|
require "active_validation/validators/#{file_name}_validator"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
229
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.6.
|
230
|
+
rubygems_version: 2.6.12
|
231
231
|
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: Gem for commonly used validators.
|