license-validator 1.0.1 → 1.1.0
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.adoc +5 -1
- data/lib/license_validator/validations/state_al.rb +5 -3
- data/lib/license_validator/validations/state_az.rb +2 -2
- data/lib/license_validator/validations/state_ca.rb +4 -4
- data/lib/license_validator/validations/state_co.rb +1 -3
- data/lib/license_validator/validations/state_ct.rb +1 -1
- data/lib/license_validator/validations/state_ia.rb +1 -6
- data/lib/license_validator/validations/state_id.rb +1 -1
- data/lib/license_validator/validations/state_ks.rb +1 -5
- data/lib/license_validator/validations/state_ky.rb +1 -3
- data/lib/license_validator/validations/state_ma.rb +1 -1
- data/lib/license_validator/validations/state_mo.rb +2 -2
- data/lib/license_validator/validations/state_mt.rb +2 -2
- data/lib/license_validator/validations/state_nc.rb +6 -6
- data/lib/license_validator/validations/state_nd.rb +6 -1
- data/lib/license_validator/validations/state_ne.rb +2 -2
- data/lib/license_validator/validations/state_nh.rb +1 -1
- data/lib/license_validator/validations/state_nv.rb +2 -2
- data/lib/license_validator/validations/state_ny.rb +2 -16
- data/lib/license_validator/validations/state_oh.rb +1 -1
- data/lib/license_validator/validations/state_ok.rb +4 -4
- data/lib/license_validator/validations/state_or.rb +1 -3
- data/lib/license_validator/validations/state_ri.rb +1 -1
- data/lib/license_validator/validations/state_sc.rb +2 -2
- data/lib/license_validator/validations/state_sd.rb +2 -4
- data/lib/license_validator/validations/state_tn.rb +4 -4
- data/lib/license_validator/validations/state_wa.rb +2 -2
- data/lib/license_validator/validations/state_wv.rb +1 -1
- data/lib/license_validator/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a657c54afd63a2651170f6a7d9add84e6866ed007a12487f7019d29bfbccaded
|
4
|
+
data.tar.gz: eadd6114c60bc489c1825928061439829671f69f3e82f53eac46750e3cb2c8f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69523cc734b9e371db1316e5e50bd881743c4546c04a1ec57883ae163fca23862b47b7e7566ff70b8a6b38c78a55fd488b357076075b4b32e1ea524da81940de
|
7
|
+
data.tar.gz: b90790f295516f72cbd2dcb2e801cf85a6f3ea7ce3a9187d42fb654da697918804bcb801b1fb2507e6ce0bb84b9ef334592981a3559edaf44c6c76d3717a8380
|
data/CHANGELOG.adoc
CHANGED
@@ -9,16 +9,18 @@ module LicenseValidator
|
|
9
9
|
|
10
10
|
lic_num = driver.license_num
|
11
11
|
|
12
|
-
return if lic_num.match?(/\A\d{
|
12
|
+
return if lic_num.match?(/\A\d{6,8}\z/i)
|
13
13
|
|
14
|
-
return if lic_num.match?(/\A[a-z]\d{6,
|
14
|
+
return if lic_num.match?(/\A[a-z]\d{6,7}\z/i)
|
15
|
+
|
16
|
+
return if lic_num.match?(/\AI\d{6,7}\z/i)
|
15
17
|
|
16
18
|
return if lic_num.match?(/\AID\d{5,6}\z/i)
|
17
19
|
|
18
20
|
errors.add(
|
19
21
|
:license_num,
|
20
22
|
[
|
21
|
-
'License number requires
|
23
|
+
'License number requires 6-8 numeric or "I", 6-7 numeric or "ID", 5-6 numeric or 1 alphabetic, 6-7 numeric',
|
22
24
|
'for AL'
|
23
25
|
].join(' ')
|
24
26
|
)
|
@@ -21,11 +21,11 @@ module LicenseValidator
|
|
21
21
|
|
22
22
|
lic_num = driver.license_num
|
23
23
|
|
24
|
-
return if lic_num.match?(/\A[a-z]\d{8}\z/i)
|
24
|
+
return if lic_num.match?(/\A[a-z]\d{7,8}\z/i)
|
25
25
|
|
26
26
|
return if lic_num.match?(/\A\d{9}\z/i)
|
27
27
|
|
28
|
-
errors.add(:license_num, 'License number requires 1
|
28
|
+
errors.add(:license_num, 'License number requires 1 alphabetic, 7-8 numeric or 9 numeric for AZ.')
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -7,13 +7,13 @@ module LicenseValidator
|
|
7
7
|
def validate
|
8
8
|
super
|
9
9
|
|
10
|
-
|
11
|
-
errors.add(:
|
10
|
+
if driver.last_name.blank?
|
11
|
+
errors.add(:last_name, 'Last name required for CA.')
|
12
12
|
end
|
13
13
|
|
14
|
-
return if driver.
|
14
|
+
return if driver.license_num.match?(/\A[a-z]\d{7}\z/i)
|
15
15
|
|
16
|
-
errors.add(:
|
16
|
+
errors.add(:license_num, 'License number requires 1 alphabetic, 7 numeric for CA.')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -15,9 +15,7 @@ module LicenseValidator
|
|
15
15
|
|
16
16
|
return if lic_num.match?(/\A\d{9}\z/i)
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
errors.add(:license_num, 'License number requires 9 numeric or 1 alphabetic, 3-6 numeric for CO.')
|
18
|
+
errors.add(:license_num, 'License number requires 9 numeric for CO.')
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -11,7 +11,7 @@ module LicenseValidator
|
|
11
11
|
errors.add(:last_name, 'Last name required for CT.')
|
12
12
|
end
|
13
13
|
|
14
|
-
# 9
|
14
|
+
# 9 numeric, 1st two positions are month of birth in odd or
|
15
15
|
# even year. 01-12 Jan-Dec odd years, 13 - 24 Jan-Dec even years, 99 unknown
|
16
16
|
|
17
17
|
if driver.dob.blank?
|
@@ -11,12 +11,7 @@ module LicenseValidator
|
|
11
11
|
|
12
12
|
return if lic_num.match?(/\A\d{3}[a-z]{2}\d{4}\z/i)
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
errors.add(
|
17
|
-
:license_num,
|
18
|
-
'License number requires 3 Numeric and 2 Alphabetic and 4 Numeric, or 9 numeric for IA.'
|
19
|
-
)
|
14
|
+
errors.add(:license_num, 'License number requires 3 numeric and 2 alphabetic and 4 numeric for IA.')
|
20
15
|
end
|
21
16
|
end
|
22
17
|
end
|
@@ -21,7 +21,7 @@ module LicenseValidator
|
|
21
21
|
|
22
22
|
return if lic_num.match?(/\A\d{9}\z/i)
|
23
23
|
|
24
|
-
errors.add(:license_num, 'License number requires 2
|
24
|
+
errors.add(:license_num, 'License number requires 2 alphabetic, 6 numeric, 1 alphabetic or 9 numeric for ID.')
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -15,11 +15,7 @@ module LicenseValidator
|
|
15
15
|
|
16
16
|
return if lic_num.match?(/\AK\d{8}\z/i)
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
return if lic_num.match?(/\A\d{9}\z/i)
|
21
|
-
|
22
|
-
errors.add(:license_num, 'License number requires “K” and 8 Numeric, 6 Alphanumeric, or 9 numeric for KS.')
|
18
|
+
errors.add(:license_num, 'License number requires “K” and 8 numeric for KS.')
|
23
19
|
end
|
24
20
|
end
|
25
21
|
end
|
@@ -11,9 +11,7 @@ module LicenseValidator
|
|
11
11
|
|
12
12
|
return if lic_num.match?(/\A[a-z]\d{8}\z/i)
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
errors.add(:license_num, 'License number requires 1 alphabetic and 8 numeric, or 9 numeric for KY.')
|
14
|
+
errors.add(:license_num, 'License number requires 1 alphabetic and 8 numeric for KY.')
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -15,7 +15,7 @@ module LicenseValidator
|
|
15
15
|
|
16
16
|
errors.add(
|
17
17
|
:license_num,
|
18
|
-
'License number requires 1
|
18
|
+
'License number requires 1 alphabetic (B-Z), 8 numeric or 2 alphabetic (excluding FR), 7 numeric for MA.'
|
19
19
|
)
|
20
20
|
end
|
21
21
|
end
|
@@ -22,8 +22,8 @@ module LicenseValidator
|
|
22
22
|
errors.add(
|
23
23
|
:license_num,
|
24
24
|
[
|
25
|
-
'License number requires 3 numeric, 1 alphabetic, 6 numeric or 1
|
26
|
-
'1
|
25
|
+
'License number requires 3 numeric, 1 alphabetic, 6 numeric or 1 alphabetic, 5-9 numeric or 9 numeric or',
|
26
|
+
'1 alphabetic, 8 numeric, 2 alphabetic “MA” or 9 numeric, 1 alphabetic, or 15 numeric for MO.'
|
27
27
|
].join(' ')
|
28
28
|
)
|
29
29
|
end
|
@@ -32,8 +32,8 @@ module LicenseValidator
|
|
32
32
|
errors.add(
|
33
33
|
:license_num,
|
34
34
|
[
|
35
|
-
'License number requires 1
|
36
|
-
'or 3
|
35
|
+
'License number requires 1 alpha, 1 numeric, 1 alphanumeric, 2 numeric, 3 alpha, 1 numeric or 13 numeric',
|
36
|
+
'or 3 alpha, 10 numeric or 9 numeric for MT.'
|
37
37
|
].join(' ')
|
38
38
|
)
|
39
39
|
end
|
@@ -7,17 +7,17 @@ module LicenseValidator
|
|
7
7
|
def validate
|
8
8
|
super
|
9
9
|
|
10
|
-
unless driver.license_num.match?(/\A\d{1,12}\z/i)
|
11
|
-
errors.add(:license_num, 'License number requires 1-12 numbers for NC.')
|
12
|
-
end
|
13
|
-
|
14
10
|
if driver.last_name.blank?
|
15
11
|
errors.add(:last_name, 'Last name required for NC.')
|
16
12
|
end
|
17
13
|
|
18
|
-
|
14
|
+
if driver.dob.blank?
|
15
|
+
errors.add(:dob, 'D.O.B. required for NC.')
|
16
|
+
end
|
17
|
+
|
18
|
+
return if driver.license_num.match?(/\A\d{12}\z/i)
|
19
19
|
|
20
|
-
errors.add(:
|
20
|
+
errors.add(:license_num, 'License number requires 12 numbers for NC.')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -13,7 +13,12 @@ module LicenseValidator
|
|
13
13
|
|
14
14
|
return if lic_num.match?(/\A[a-z]{3}\d{6}\z/i)
|
15
15
|
|
16
|
-
|
16
|
+
return if lic_num.match?(/\Aa00\d{6}\z/i)
|
17
|
+
|
18
|
+
errors.add(
|
19
|
+
:license_num,
|
20
|
+
'License number requires 9 numeric or 3 alphabetic, 6 numeric, or "A00", 6 numeric for ND.'
|
21
|
+
)
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
@@ -7,9 +7,9 @@ module LicenseValidator
|
|
7
7
|
def validate
|
8
8
|
super
|
9
9
|
|
10
|
-
return if driver.license_num.match?(/\A[abceghprvz]\d{8}\z/i)
|
10
|
+
return if driver.license_num.match?(/\A[abceghprvz]\d{1,8}\z/i)
|
11
11
|
|
12
|
-
errors.add(:license_num, 'License number requires 1
|
12
|
+
errors.add(:license_num, 'License number requires 1 alphabetic (A,B,C,E,G,H,P,R,V or Z), 1-8 numeric for NE.')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -23,7 +23,7 @@ module LicenseValidator
|
|
23
23
|
|
24
24
|
errors.add(
|
25
25
|
:license_num,
|
26
|
-
'License number requires 2
|
26
|
+
'License number requires 2 numeric, 3 alphabetic, 5 numeric or “NHL”, 8 numeric for NH.'
|
27
27
|
)
|
28
28
|
end
|
29
29
|
end
|
@@ -11,10 +11,10 @@ module LicenseValidator
|
|
11
11
|
|
12
12
|
regex = Regexp.new("\\A\\d{10}(#{dob_year})?\\z", 'i')
|
13
13
|
|
14
|
-
# 12
|
14
|
+
# 12 numeric (last 2 are year of birth) or 10 numeric
|
15
15
|
return if driver.license_num.match?(regex)
|
16
16
|
|
17
|
-
errors.add(:license_num, 'License number requires 12
|
17
|
+
errors.add(:license_num, 'License number requires 12 numeric (last 2 are year of birth) or 10 numeric for NV.')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -9,23 +9,9 @@ module LicenseValidator
|
|
9
9
|
|
10
10
|
lic_num = driver.license_num
|
11
11
|
|
12
|
-
return if lic_num.match?(/\A\d{
|
12
|
+
return if lic_num.match?(/\A\d{9}\z/i)
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
return if lic_num.match?(/\A[a-z]{8}\z/i)
|
17
|
-
|
18
|
-
return if lic_num.match?(/\A\d{16}\z/i)
|
19
|
-
|
20
|
-
return if lic_num.match?(/\A[a-z]\d{18}\z/i)
|
21
|
-
|
22
|
-
errors.add(
|
23
|
-
:license_num,
|
24
|
-
[
|
25
|
-
'License number requires 9 Numeric or 8 Numeric or 1 Alphabetic, 7 Numeric or 16 Numeric or 8 Alphabetic',
|
26
|
-
'or 1 Alphabetic, 18 Numeric (not being issued anymore) for NY.'
|
27
|
-
].join(' ')
|
28
|
-
)
|
14
|
+
errors.add(:license_num, 'License number requires 9 numeric for NY.')
|
29
15
|
end
|
30
16
|
end
|
31
17
|
end
|
@@ -13,7 +13,7 @@ module LicenseValidator
|
|
13
13
|
|
14
14
|
return if lic_num.match?(/\A\d{9}\z/i)
|
15
15
|
|
16
|
-
errors.add(:license_num, 'License number requires 2
|
16
|
+
errors.add(:license_num, 'License number requires 2 alphabetic, 6 numeric or 9 numeric for OH.')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -7,13 +7,13 @@ module LicenseValidator
|
|
7
7
|
def validate
|
8
8
|
super
|
9
9
|
|
10
|
-
|
11
|
-
errors.add(:
|
10
|
+
if driver.dob.blank?
|
11
|
+
errors.add(:dob, 'D.O.B. required for OK.')
|
12
12
|
end
|
13
13
|
|
14
|
-
return if driver.
|
14
|
+
return if driver.license_num.match?(/\A[a-z]\d{9}\z/i)
|
15
15
|
|
16
|
-
errors.add(:
|
16
|
+
errors.add(:license_num, 'License number requires 1 letter followed by 9 numbers for OK.')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -13,13 +13,11 @@ module LicenseValidator
|
|
13
13
|
|
14
14
|
license = driver.license_num
|
15
15
|
|
16
|
-
return if license.match?(/\A\d{9}\z/i)
|
17
|
-
|
18
16
|
return if license.match?(/\A[a-z]\d{6}\z/i)
|
19
17
|
|
20
18
|
return if license.match?(/\A\d{7}\z/i)
|
21
19
|
|
22
|
-
errors.add(:license_num, 'License number requires
|
20
|
+
errors.add(:license_num, 'License number requires 7 numeric or 1 alpha, 6 numeric for OR.')
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
@@ -13,7 +13,7 @@ module LicenseValidator
|
|
13
13
|
|
14
14
|
return if lic_num.match?(/\AV\d{6}\z/i)
|
15
15
|
|
16
|
-
errors.add(:license_num, 'License number requires 8 numeric or 7
|
16
|
+
errors.add(:license_num, 'License number requires 8 numeric or 7 numeric or V and 6 numeric for RI.')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -7,9 +7,9 @@ module LicenseValidator
|
|
7
7
|
def validate
|
8
8
|
super
|
9
9
|
|
10
|
-
return if driver.license_num.match?(/\A\d{1,
|
10
|
+
return if driver.license_num.match?(/\A\d{1,10}\z/i)
|
11
11
|
|
12
|
-
errors.add(:license_num, 'License number requires 1-
|
12
|
+
errors.add(:license_num, 'License number requires 1-10 numbers for SC.')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -9,11 +9,9 @@ module LicenseValidator
|
|
9
9
|
|
10
10
|
lic_num = driver.license_num
|
11
11
|
|
12
|
-
return if lic_num.match?(/\
|
12
|
+
return if lic_num.match?(/\A0\d{7}\z/i)
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
errors.add(:license_num, 'License number requires 6,8, or 9 numbers for SD.')
|
14
|
+
errors.add(:license_num, 'License number requires 8 numbers (must start with 0) for SD.')
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -7,13 +7,13 @@ module LicenseValidator
|
|
7
7
|
def validate
|
8
8
|
super
|
9
9
|
|
10
|
-
|
11
|
-
errors.add(:
|
10
|
+
if driver.last_name.blank?
|
11
|
+
errors.add(:last_name, 'Last name required for TN.')
|
12
12
|
end
|
13
13
|
|
14
|
-
return if driver.
|
14
|
+
return if driver.license_num.match?(/\A\d{1,9}\z/i)
|
15
15
|
|
16
|
-
errors.add(:
|
16
|
+
errors.add(:license_num, 'License number requires 1-9 numbers for TN.')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -12,8 +12,8 @@ module LicenseValidator
|
|
12
12
|
errors.add(
|
13
13
|
:license_num,
|
14
14
|
[
|
15
|
-
'License number requires 5
|
16
|
-
'3
|
15
|
+
'License number requires 5 alphabetic (last name), 1 alphabetic (first name), 1 alphabetic (middle name),',
|
16
|
+
'3 numeric, 1 alphabetic, 1 alphanumeric or 12 alphanumeric or “WDL”, 9 alphanumeric for WA.',
|
17
17
|
'Names should be padded with *'
|
18
18
|
].join(' ')
|
19
19
|
)
|
@@ -19,7 +19,7 @@ module LicenseValidator
|
|
19
19
|
|
20
20
|
errors.add(
|
21
21
|
:license_num,
|
22
|
-
'License number requires 7
|
22
|
+
'License number requires 7 numeric or 1-2 alpha, 5-6 numeric (Can start with 0 or 1 or any letter) for WV.'
|
23
23
|
)
|
24
24
|
end
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license-validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brands Insurance
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop-rubomatic
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.3.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|