dl_validator 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/config/dl_config.rb +20 -20
- data/lib/dl_validator/version.rb +1 -1
- data/test/test_helper.rb +17 -17
- 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: 76554deef531864d8c973ddeb96e1f0dbb0e5bf7
|
4
|
+
data.tar.gz: 1486e96a648374dcd4a9ea9a4b7f996c1a429377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4843364c3d988ab432f44a2c33178c160b8418bbe83fa010c1ae67548eeee103f0a56edd3e9fa6efea6f529ebaeda6f28035bed7df6a51027657afeccc9ba9e9
|
7
|
+
data.tar.gz: f231305738916b5987c6cd5bf8e9db408b569ef5f910d00824e76899c5a6c95e915fbb843a84842f7c19bdd959ea87bda16ca9c2587883e4ff36f1028b2c8a29
|
data/Gemfile.lock
CHANGED
data/lib/config/dl_config.rb
CHANGED
@@ -58,56 +58,56 @@ module DlValidator
|
|
58
58
|
|
59
59
|
# Constant frozen hash of regular expressions to validate a drivers license by state
|
60
60
|
STATES_REGEX = {
|
61
|
-
'AL' => /^([0-9]{7})$/,
|
62
|
-
'AK' => /^([0-9]{7})$/,
|
61
|
+
'AL' => /^([0-9]{7}|[0-9]{8})$/, # Format: 7 or 8 numeric
|
62
|
+
'AK' => /^([0-9]{1,7})$/, # Format: up to 7 numeric
|
63
63
|
'AZ' => /^([A-Z][0-9]{8})$/, # Format: 1 Alpha 8 numeric
|
64
|
-
'AR' => /^([0-9]{8})$/,
|
64
|
+
'AR' => /^([0-9]{8}|[0-9]{9})$/, # Format: 8 or 9 Numeric
|
65
65
|
'CA' => /^([A-Z][0-9]{7})$/, # Format: 1 Alpha 7 Numeric
|
66
66
|
'CO' => /^([0-9]{9})$/, # Format: 9 Numeric
|
67
67
|
'CT' => /^((01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24)[0-9]{7})$/, # Format: 9 Numeric; The first 2 digits can not be less than 01 or greater than 24.
|
68
|
-
'DE' => /^([0-9]{7})
|
68
|
+
'DE' => /^([0-9]{1,7}$)/, # Format: upto 7 Numeric
|
69
69
|
'DC' => /^([0-9]{7})$/, # Format: 7 Numeric
|
70
70
|
'FL' => /^([A-Z][0-9]{12})$/, # Format: 1 Alpha 12 Numeric
|
71
|
-
'GA' => /^([0-9]{
|
71
|
+
'GA' => /^([0-9]{1,9})$/, # Format: up to 9 Numeric
|
72
72
|
'HI' => /^([H][0-9]{8})$/, # Format: H followed by 8 numeric
|
73
73
|
'ID' => /^([A-Z]{2}[0-9]{6}[A-Z])$/, # Format: 2 Alpha 6 Numeric 1 Alpha (example LS123456C)
|
74
74
|
'IL' => /^([A-Z][0-9]{11})$/, # Format: 1 alpha 11 numeric
|
75
75
|
'IN' => /^([0-9]{10})$/, # Format: 10 Numeric
|
76
76
|
'IA' => /^([0-9]{3}[A-Z]{2}[0-9]{4})$/, # Format: 3 Numeric 2 Alpha 4 Numeric (example 123SL4567)
|
77
|
-
'KS' => /^([
|
77
|
+
'KS' => /^([K][0-9]{8})$/, # Format: 1 Alpha K for Alpha 8 Numeric
|
78
78
|
'KY' => /^([A-Z][0-9]{8})$/, # Format: 1 Alpha 8 Numeric
|
79
79
|
'LA' => /^((00|01)[0-9]{7})$/, # Format: 9 Numeric (First two numbers are 00 or 01)
|
80
80
|
'ME' => /^([0-9]{7})$/, # Format: 7 Numeric
|
81
81
|
'MD' => /^([A-Z][0-9]{12})$/, # Format: 1 Alpha 12 Numeric
|
82
|
-
'MA' => /^([
|
82
|
+
'MA' => /^([S][0-9]{8})$/, # Format: 1 Alpha 8 Numeric
|
83
83
|
'MI' => /^([A-Z][0-9]{12})$/, # Format: 1 Alpha 12 Numeric
|
84
|
-
'MN' => /^([A-
|
84
|
+
'MN' => /^([A-Z0-9]{13})$/, # Format: 13 Alphanumeric
|
85
85
|
'MS' => /^([0-9]{9})$/, # Format: 9 Numeric
|
86
|
-
'MO' => /^([A-Z][0-9]{
|
87
|
-
'MT' => /^(([A-
|
86
|
+
'MO' => /^([A-Z][0-9]{6,9})$/, # Format: 1 Alpha 6-9 Numeric
|
87
|
+
'MT' => /^(([A-Z0-9]{9}|[0-9]{13}))$/, # Format: 13 Numeric or 9 Alphanumeric
|
88
88
|
'NE' => /^([A-Z][0-9]{3,8})$/, # Format: 1 Alpha 3-8 Numeric
|
89
|
-
'NV' => /^([0-9]{10}
|
89
|
+
'NV' => /^([0-9]{10})$/, # Format: 10 Numeric
|
90
90
|
'NH' => /^([0-9]{2}[A-Z]{3}[0-9]{5})$/, # Format: 2 Numeric 3 Alpha 5 Numeric
|
91
91
|
'NJ' => /^([A-Z][0-9]{14})$/, # Format: 1 Alpha 14 Numeric
|
92
92
|
'NY' => /^([0-9]{9})$/, # Format: 9 Numeric
|
93
93
|
'NM' => /^([0-9]{9})$/, # Format: 9 Numeric
|
94
|
-
'NC' => /^([0-9]{
|
94
|
+
'NC' => /^([0-9]{1,12})$/, # Format: Up to 12 Numeric
|
95
95
|
'ND' => /^([0-9]{9})$/, # Format: 9 Numeric
|
96
96
|
'OH' => /^([A-Z]{2}[0-9]{6})$/, # Format: 2 Alpha 6 Numeric
|
97
|
-
'OK' => /^([0-9]{9})$/,
|
98
|
-
'OR' => /^([0-9]{
|
97
|
+
'OK' => /^([A-Z][0-9]{9})$/, # Format: 1 Alpha 9 Numeric
|
98
|
+
'OR' => /^([0-9]{1,7})$/, # Format: Up to 7 Numeric
|
99
99
|
'PA' => /^([0-9]{8})$/, # Format: 8 Numeric
|
100
100
|
'RI' => /^([0-9]{7})$/, # Format: 7 Numeric
|
101
101
|
'SC' => /^([0-9]{9})$/, # Format: 9 Numeric
|
102
102
|
'SD' => /^([0-9]{8})$/, # Format: 8 Numeric
|
103
|
-
'TN' => /^([0-9]{
|
103
|
+
'TN' => /^([0-9]{8}|[0-9]{9})$/, # Format: 8 or 9 Numeric
|
104
104
|
'TX' => /^([0-9]{8})$/, # Format: 8 Numeric
|
105
|
-
'UT' => /^([0-9]{
|
106
|
-
'VT' => /^([0-9]{8}|[0-9]{7}[A
|
107
|
-
'VA' => /^([A-Z][0-9]{8})$/,
|
105
|
+
'UT' => /^([0-9]{4,9})$/, # Format: 4 to 9 Numeric
|
106
|
+
'VT' => /^([0-9]{8}|[0-9]{7}[A])$/, # Format: 8 Numeric; or 7 Numeric 1 Alpha. Alpha is A.
|
107
|
+
'VA' => /^([A-Z][0-9]{8})$/, # Format: 1 Alpha 8 Numeric
|
108
108
|
'WA' => /^(([A-Z]|[0-9]){12})$/, # Format: 12 Alpha And Numeric Combination
|
109
|
-
'WV' => /^([0-9]{7}|[A-Z][0-9]{6})$/,
|
109
|
+
'WV' => /^([0-9]{7}|[A-Z][0-9]{6})$/, # Format: 7 Numeric; or 1 Alpha 6 Numeric
|
110
110
|
'WI' => /^([A-Z][0-9]{13})$/, # Format: 1 Alpha 13 Numeric
|
111
|
-
'WY' => /^([0-9]{9
|
111
|
+
'WY' => /^([0-9]{9})$/ }.freeze # Format: 9 Numeric
|
112
112
|
end
|
113
113
|
end
|
data/lib/dl_validator/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -5,17 +5,17 @@ require 'shoulda'
|
|
5
5
|
class Helper
|
6
6
|
|
7
7
|
VALID_DRIVERS_LICENSES = {
|
8
|
-
'AL' => ['1234567'],
|
9
|
-
'AK' => ['1234567'],
|
8
|
+
'AL' => ['1234567', '12345678'], # Format: 7 numeric or 8 numeric
|
9
|
+
'AK' => ['1234567', '12345'], # Format: Up to 7 numeric
|
10
10
|
'AZ' => ['A12345678'], # Format: 1 Alpha 8 numeric
|
11
|
-
'AR' => ['12345678'],
|
11
|
+
'AR' => ['12345678', '123456789'], # Format: 8 or 9 Numeric
|
12
12
|
'CA' => ['c1234567'], # Format: 1 Alpha 7 Numeric
|
13
13
|
'CO' => ['123456789'], # Format: 9 Numeric
|
14
14
|
'CT' => ['201234567', '241234567'], # Format: 9 Numeric; The first 2 digits can not be less than 01 or greater than 24.
|
15
|
-
'DE' => ['1234567'],
|
15
|
+
'DE' => ['1234567', '12345'], # Format: Up to 7 Numeric
|
16
16
|
'DC' => ['1234567'], # Format: 7 Numeric
|
17
17
|
'FL' => ['F123456789876'], # Format: 1 Alpha 12 Numeric
|
18
|
-
'GA' => ['1234567', '1234567', '123456789'], # Format:
|
18
|
+
'GA' => ['1234567', '1234567', '123456789'], # Format: Up to 9 Numeric
|
19
19
|
'HI' => ['h12345678'], # Format: H followed by 8 numeric
|
20
20
|
'ID' => ['LS123456C'], # Format: 2 Alpha 6 Numeric 1 Alpha (example LS123456C)
|
21
21
|
'IL' => ['J12345678901'], # Format: 1 alpha 11 numeric
|
@@ -26,34 +26,34 @@ class Helper
|
|
26
26
|
'LA' => ['001234567', '012345678'], # Format: 9 Numeric (First two numbers are 00 or 01)
|
27
27
|
'ME' => ['1234567'], # Format: 7 Numeric
|
28
28
|
'MD' => ['M123456789012'], # Format: 1 Alpha 12 Numeric
|
29
|
-
'MA' => ['
|
29
|
+
'MA' => ['S12345678'], # Format: 1 Alpha 8 Numeric Alpha is S
|
30
30
|
'MI' => ['h123456789012'], # Format: 1 Alpha 12 Numeric
|
31
|
-
'MN' => ['
|
31
|
+
'MN' => ['L1234G6J89012'], # Format: 13 Alphanumeric
|
32
32
|
'MS' => ['123456789'], # Format: 9 Numeric
|
33
|
-
'MO' => ['M12345678', '
|
34
|
-
'MT' => ['J9G4n6E8a'],
|
33
|
+
'MO' => ['M12345678', 'M123456' , 'M12345679'], # Format: 1 Alpha 6-9 Numeric
|
34
|
+
'MT' => ['J9G4n6E8a', '1234567890123'], # Format: 9 Alpha And Numeric Combination or 13 numeric
|
35
35
|
'NE' => ['A123', 'A1234', 'A12345', 'A123456', 'A1234567', 'A12345678'], # Format: 1 Alpha 3-8 Numeric
|
36
|
-
'NV' => ['1234567890'
|
36
|
+
'NV' => ['1234567890'], # Format: 10 Numeric
|
37
37
|
'NH' => ['12ADF12345'], # Format: 2 Numeric 3 Alpha 5 Numeric
|
38
38
|
'NJ' => ['F12345678901234'], # Format: 1 Alpha 14 Numeric
|
39
39
|
'NY' => ['123456789'], # Format: 9 Numeric
|
40
40
|
'NM' => ['123456789'], # Format: 9 Numeric
|
41
|
-
'NC' => ['123456', '1234567', '12345678', '123456789'],
|
41
|
+
'NC' => ['123456', '1234567', '12345678', '123456789', '123456789012'], # Format: Up to 12 numeric
|
42
42
|
'ND' => ['123456789'], # Format: 9 Numeric
|
43
43
|
'OH' => ['LK123456'], # Format: 2 Alpha 6 Numeric
|
44
|
-
'OK' => ['
|
45
|
-
'OR' => ['12345', '123456', '1234567'], # Format:
|
44
|
+
'OK' => ['O123456789'], # Format: 1 Alpha 9 Numeric
|
45
|
+
'OR' => ['12345', '123456', '1234567'], # Format: Up to 7 numeric
|
46
46
|
'PA' => ['12345678'], # Format: 8 Numeric
|
47
47
|
'RI' => ['1234567'], # Format: 7 Numeric
|
48
48
|
'SC' => ['123456789'], # Format: 9 Numeric
|
49
49
|
'SD' => ['12345678'], # Format: 8 Numeric
|
50
|
-
'TN' => ['
|
50
|
+
'TN' => ['12345678', '123456789'], # Format: 8 or 9 Numeric
|
51
51
|
'TX' => ['12345678'], # Format: 8 Numeric
|
52
|
-
'UT' => ['123456', '1234567', '12345678', '123456789', '
|
53
|
-
'VT' => ['12345678', '
|
52
|
+
'UT' => ['123456', '1234567', '12345678', '123456789', '1234'], # Format: 4-9 Numeric
|
53
|
+
'VT' => ['12345678', '1234567A'], # Format: 8 Numeric; or 7 Numeric 1 Alpha is A
|
54
54
|
'VA' => ['K12345678'], # Format: 1 Alpha 8 Numeric
|
55
55
|
'WA' => ['123ghk456QWE'], # Format: 12 Characters
|
56
56
|
'WV' => ['1234567', 'E123456'], # Format: 7 Numeric; or 1 Alpha 6 Numeric
|
57
57
|
'WI' => ['W1234567890123'], # Format: 1 Alpha 13 Numeric
|
58
|
-
'WY' => ['123456789'
|
58
|
+
'WY' => ['123456789'] } # Format: 9 Numeric
|
59
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dl_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Medeiros
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|