ssn_validator 1.0.4
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.
- data/.gitignore +4 -0
- data/History.txt +41 -0
- data/LICENSE +20 -0
- data/PostInstall.txt +29 -0
- data/README.rdoc +98 -0
- data/Rakefile +60 -0
- data/VERSION.yml +5 -0
- data/generators/death_master_file_migration/death_master_file_migration_generator.rb +12 -0
- data/generators/death_master_file_migration/templates/migration.rb +26 -0
- data/generators/ssn_validator_migration/ssn_validator_migration_generator.rb +12 -0
- data/generators/ssn_validator_migration/templates/migration.rb +18 -0
- data/lib/ssn_validator.rb +12 -0
- data/lib/ssn_validator/models/death_master_file.rb +5 -0
- data/lib/ssn_validator/models/death_master_file_loader.rb +235 -0
- data/lib/ssn_validator/models/ssn_high_group_code.rb +5 -0
- data/lib/ssn_validator/models/ssn_high_group_code_loader.rb +87 -0
- data/lib/ssn_validator/models/ssn_validator.rb +94 -0
- data/lib/ssn_validator/ntis.rb +9 -0
- data/lib/tasks/ssn_validator.rake +24 -0
- data/rdoc/classes/DeathMasterFile.html +111 -0
- data/rdoc/classes/DeathMasterFileLoader.html +298 -0
- data/rdoc/classes/SsnHighGroupCode.html +111 -0
- data/rdoc/classes/SsnHighGroupCodeLoader.html +202 -0
- data/rdoc/classes/SsnValidator.html +116 -0
- data/rdoc/classes/SsnValidator/Ntis.html +111 -0
- data/rdoc/classes/SsnValidator/Ssn.html +315 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/LICENSE.html +129 -0
- data/rdoc/files/README_rdoc.html +262 -0
- data/rdoc/files/lib/ssn_validator/models/death_master_file_loader_rb.html +112 -0
- data/rdoc/files/lib/ssn_validator/models/death_master_file_rb.html +108 -0
- data/rdoc/files/lib/ssn_validator/models/ssn_high_group_code_loader_rb.html +108 -0
- data/rdoc/files/lib/ssn_validator/models/ssn_high_group_code_rb.html +108 -0
- data/rdoc/files/lib/ssn_validator/models/ssn_validator_rb.html +101 -0
- data/rdoc/files/lib/ssn_validator/ntis_rb.html +101 -0
- data/rdoc/files/lib/ssn_validator_rb.html +113 -0
- data/rdoc/fr_class_index.html +33 -0
- data/rdoc/fr_file_index.html +35 -0
- data/rdoc/fr_method_index.html +37 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/ssn_validator.gemspec +130 -0
- data/test/files/test_dmf_funky_data_load.txt +6 -0
- data/test/files/test_dmf_initial_load.txt +5 -0
- data/test/files/test_dmf_update_load.txt +5 -0
- data/test/files/valid_csv_from_funky_data_file.txt +6 -0
- data/test/mocks/test/death_master_file_loader.rb +40 -0
- data/test/test_death_master_file_loader.rb +113 -0
- data/test/test_helper.rb +62 -0
- data/test/test_ssn_high_group_code_loader.rb +22 -0
- data/test/test_ssn_validator.rb +85 -0
- metadata +145 -0
@@ -0,0 +1,315 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: SsnValidator::Ssn</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">SsnValidator::Ssn</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/ssn_validator/models/ssn_validator_rb.html">
|
59
|
+
lib/ssn_validator/models/ssn_validator.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000011">death_master_file_hit?</a>
|
90
|
+
<a href="#M000010">death_master_file_record</a>
|
91
|
+
<a href="#M000008">new</a>
|
92
|
+
<a href="#M000009">valid?</a>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<div id="attribute-list">
|
108
|
+
<h3 class="section-bar">Attributes</h3>
|
109
|
+
|
110
|
+
<div class="name-list">
|
111
|
+
<table>
|
112
|
+
<tr class="top-aligned-row context-row">
|
113
|
+
<td class="context-item-name">area</td>
|
114
|
+
<td class="context-item-value"> [R] </td>
|
115
|
+
<td class="context-item-desc"></td>
|
116
|
+
</tr>
|
117
|
+
<tr class="top-aligned-row context-row">
|
118
|
+
<td class="context-item-name">as_of</td>
|
119
|
+
<td class="context-item-value"> [R] </td>
|
120
|
+
<td class="context-item-desc"></td>
|
121
|
+
</tr>
|
122
|
+
<tr class="top-aligned-row context-row">
|
123
|
+
<td class="context-item-name">errors</td>
|
124
|
+
<td class="context-item-value"> [R] </td>
|
125
|
+
<td class="context-item-desc"></td>
|
126
|
+
</tr>
|
127
|
+
<tr class="top-aligned-row context-row">
|
128
|
+
<td class="context-item-name">group</td>
|
129
|
+
<td class="context-item-value"> [R] </td>
|
130
|
+
<td class="context-item-desc"></td>
|
131
|
+
</tr>
|
132
|
+
<tr class="top-aligned-row context-row">
|
133
|
+
<td class="context-item-name">serial_number</td>
|
134
|
+
<td class="context-item-value"> [R] </td>
|
135
|
+
<td class="context-item-desc"></td>
|
136
|
+
</tr>
|
137
|
+
<tr class="top-aligned-row context-row">
|
138
|
+
<td class="context-item-name">ssn</td>
|
139
|
+
<td class="context-item-value"> [R] </td>
|
140
|
+
<td class="context-item-desc"></td>
|
141
|
+
</tr>
|
142
|
+
</table>
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<!-- if method_list -->
|
149
|
+
<div id="methods">
|
150
|
+
<h3 class="section-bar">Public Class methods</h3>
|
151
|
+
|
152
|
+
<div id="method-M000008" class="method-detail">
|
153
|
+
<a name="M000008"></a>
|
154
|
+
|
155
|
+
<div class="method-heading">
|
156
|
+
<a href="#M000008" class="method-signature">
|
157
|
+
<span class="method-name">new</span><span class="method-args">(ssn)</span>
|
158
|
+
</a>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
<p>
|
163
|
+
Instantiate the object passing in a social security number. The ssn can be
|
164
|
+
a string or integer, with or without the ’-’s.
|
165
|
+
</p>
|
166
|
+
<p><a class="source-toggle" href="#"
|
167
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
168
|
+
<div class="method-source-code" id="M000008-source">
|
169
|
+
<pre>
|
170
|
+
<span class="ruby-comment cmt"># File lib/ssn_validator/models/ssn_validator.rb, line 10</span>
|
171
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ssn</span>)
|
172
|
+
<span class="ruby-ivar">@errors</span> = []
|
173
|
+
<span class="ruby-identifier">ssn</span> = <span class="ruby-identifier">ssn</span>.<span class="ruby-identifier">to_s</span>
|
174
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ssn</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/-/</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">ssn</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/\d\d\d-\d\d-\d\d\d\d/</span>
|
175
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'Hyphen misplaced.'</span>
|
176
|
+
<span class="ruby-keyword kw">end</span>
|
177
|
+
|
178
|
+
<span class="ruby-identifier">ssn</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">'-'</span>,<span class="ruby-value str">''</span>)
|
179
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ssn</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">9</span>
|
180
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'SSN not 9 digits long.'</span>
|
181
|
+
<span class="ruby-keyword kw">end</span>
|
182
|
+
|
183
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ssn</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\D/</span>
|
184
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'Non-digit found.'</span>
|
185
|
+
<span class="ruby-keyword kw">end</span>
|
186
|
+
|
187
|
+
<span class="ruby-comment cmt">#known dummy numbers</span>
|
188
|
+
<span class="ruby-keyword kw">if</span> [<span class="ruby-value str">"078051120"</span>,<span class="ruby-value str">"111111111"</span>,<span class="ruby-value str">"123456789"</span>,<span class="ruby-value str">"219099999"</span>,<span class="ruby-value str">"999999999"</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">ssn</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">ssn</span> <span class="ruby-operator">>=</span> <span class="ruby-value str">"987654320"</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">ssn</span> <span class="ruby-operator"><=</span> <span class="ruby-value str">"987654329"</span>)
|
189
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"Known dummy SSN."</span>
|
190
|
+
<span class="ruby-keyword kw">end</span>
|
191
|
+
<span class="ruby-comment cmt">#known invalid area, group and serial numbers</span>
|
192
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ssn</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\d{3}00\d{4}|0000\Z/</span>
|
193
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"Invalid group or serial number."</span>
|
194
|
+
<span class="ruby-keyword kw">end</span>
|
195
|
+
|
196
|
+
<span class="ruby-ivar">@ssn</span> = <span class="ruby-identifier">ssn</span>
|
197
|
+
<span class="ruby-ivar">@area</span> = <span class="ruby-identifier">ssn</span>.<span class="ruby-identifier">first</span>(<span class="ruby-value">3</span>)
|
198
|
+
<span class="ruby-ivar">@group</span> = <span class="ruby-identifier">ssn</span>[<span class="ruby-value">3</span>,<span class="ruby-value">2</span>]
|
199
|
+
<span class="ruby-ivar">@serial_number</span> = <span class="ruby-identifier">ssn</span>.<span class="ruby-identifier">last</span>(<span class="ruby-value">4</span>)
|
200
|
+
|
201
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@errors</span>.<span class="ruby-identifier">empty?</span>
|
202
|
+
<span class="ruby-ivar">@ssn_high_group_code</span> = <span class="ruby-constant">SsnHighGroupCode</span>.<span class="ruby-identifier">find_by_area</span>(<span class="ruby-ivar">@area</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'as_of desc'</span>)
|
203
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@ssn_high_group_code</span>.<span class="ruby-identifier">nil?</span>
|
204
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Area '#{@area}' has not been assigned."</span>
|
205
|
+
<span class="ruby-keyword kw">else</span>
|
206
|
+
<span class="ruby-ivar">@as_of</span> = <span class="ruby-ivar">@ssn_high_group_code</span>.<span class="ruby-identifier">as_of</span>
|
207
|
+
|
208
|
+
<span class="ruby-identifier">define_group_ranks</span>
|
209
|
+
|
210
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@group_ranks</span>[<span class="ruby-ivar">@group</span>] <span class="ruby-operator">></span> <span class="ruby-ivar">@group_ranks</span>[<span class="ruby-ivar">@ssn_high_group_code</span>.<span class="ruby-identifier">group</span>]
|
211
|
+
<span class="ruby-ivar">@errors</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Group '#{@group}' has not been assigned yet for area '#{@area}'"</span>
|
212
|
+
<span class="ruby-keyword kw">end</span>
|
213
|
+
<span class="ruby-keyword kw">end</span>
|
214
|
+
<span class="ruby-keyword kw">end</span>
|
215
|
+
|
216
|
+
|
217
|
+
<span class="ruby-keyword kw">end</span>
|
218
|
+
</pre>
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
224
|
+
|
225
|
+
<div id="method-M000011" class="method-detail">
|
226
|
+
<a name="M000011"></a>
|
227
|
+
|
228
|
+
<div class="method-heading">
|
229
|
+
<a href="#M000011" class="method-signature">
|
230
|
+
<span class="method-name">death_master_file_hit?</span><span class="method-args">()</span>
|
231
|
+
</a>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div class="method-description">
|
235
|
+
<p>
|
236
|
+
Determines if the passed in ssn belongs to the deceased.
|
237
|
+
</p>
|
238
|
+
<p><a class="source-toggle" href="#"
|
239
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
240
|
+
<div class="method-source-code" id="M000011-source">
|
241
|
+
<pre>
|
242
|
+
<span class="ruby-comment cmt"># File lib/ssn_validator/models/ssn_validator.rb, line 70</span>
|
243
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">death_master_file_hit?</span>
|
244
|
+
<span class="ruby-operator">!</span><span class="ruby-identifier">death_master_file_record</span>.<span class="ruby-identifier">nil?</span>
|
245
|
+
<span class="ruby-keyword kw">end</span>
|
246
|
+
</pre>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<div id="method-M000010" class="method-detail">
|
252
|
+
<a name="M000010"></a>
|
253
|
+
|
254
|
+
<div class="method-heading">
|
255
|
+
<a href="#M000010" class="method-signature">
|
256
|
+
<span class="method-name">death_master_file_record</span><span class="method-args">()</span>
|
257
|
+
</a>
|
258
|
+
</div>
|
259
|
+
|
260
|
+
<div class="method-description">
|
261
|
+
<p>
|
262
|
+
returns the death master record if there is one.
|
263
|
+
</p>
|
264
|
+
<p><a class="source-toggle" href="#"
|
265
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
266
|
+
<div class="method-source-code" id="M000010-source">
|
267
|
+
<pre>
|
268
|
+
<span class="ruby-comment cmt"># File lib/ssn_validator/models/ssn_validator.rb, line 65</span>
|
269
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">death_master_file_record</span>
|
270
|
+
<span class="ruby-constant">DeathMasterFile</span>.<span class="ruby-identifier">find_by_social_security_number</span>(<span class="ruby-ivar">@ssn</span>)
|
271
|
+
<span class="ruby-keyword kw">end</span>
|
272
|
+
</pre>
|
273
|
+
</div>
|
274
|
+
</div>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div id="method-M000009" class="method-detail">
|
278
|
+
<a name="M000009"></a>
|
279
|
+
|
280
|
+
<div class="method-heading">
|
281
|
+
<a href="#M000009" class="method-signature">
|
282
|
+
<span class="method-name">valid?</span><span class="method-args">()</span>
|
283
|
+
</a>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
<div class="method-description">
|
287
|
+
<p>
|
288
|
+
Determines whether or not the passed in ssn passed all validations.
|
289
|
+
</p>
|
290
|
+
<p><a class="source-toggle" href="#"
|
291
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
292
|
+
<div class="method-source-code" id="M000009-source">
|
293
|
+
<pre>
|
294
|
+
<span class="ruby-comment cmt"># File lib/ssn_validator/models/ssn_validator.rb, line 60</span>
|
295
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid?</span>
|
296
|
+
<span class="ruby-ivar">@errors</span>.<span class="ruby-identifier">empty?</span>
|
297
|
+
<span class="ruby-keyword kw">end</span>
|
298
|
+
</pre>
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
|
304
|
+
</div>
|
305
|
+
|
306
|
+
|
307
|
+
</div>
|
308
|
+
|
309
|
+
|
310
|
+
<div id="validator-badges">
|
311
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
</body>
|
315
|
+
</html>
|
data/rdoc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Fri, 05 Feb 2010 12:34:16 -0500
|
@@ -0,0 +1,129 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: LICENSE</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>LICENSE</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>LICENSE
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Apr 24 11:27:55 -0400 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
Copyright (c) 2009 Kevin Tyll
|
74
|
+
</p>
|
75
|
+
<p>
|
76
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
77
|
+
copy of this software and associated documentation files (the
|
78
|
+
"Software"), to deal in the Software without restriction,
|
79
|
+
including without limitation the rights to use, copy, modify, merge,
|
80
|
+
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
81
|
+
permit persons to whom the Software is furnished to do so, subject to the
|
82
|
+
following conditions:
|
83
|
+
</p>
|
84
|
+
<p>
|
85
|
+
The above copyright notice and this permission notice shall be included in
|
86
|
+
all copies or substantial portions of the Software.
|
87
|
+
</p>
|
88
|
+
<p>
|
89
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
90
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
91
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
92
|
+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
93
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
94
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
95
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
96
|
+
</p>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if includes -->
|
108
|
+
|
109
|
+
<div id="section">
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<!-- if method_list -->
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
<div id="validator-badges">
|
125
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
</body>
|
129
|
+
</html>
|
@@ -0,0 +1,262 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README.rdoc</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README.rdoc</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README.rdoc
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Apr 24 11:28:41 -0400 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<h1>ssn_validator</h1>
|
73
|
+
<ul>
|
74
|
+
<li><a
|
75
|
+
href="http://kevintyll.github.com/ssn_validator">kevintyll.github.com/ssn_validator</a>
|
76
|
+
|
77
|
+
</li>
|
78
|
+
<li><a href="http://www.drexel-labs.com">www.drexel-labs.com</a>
|
79
|
+
|
80
|
+
</li>
|
81
|
+
</ul>
|
82
|
+
<h2>DESCRIPTION:</h2>
|
83
|
+
<p>
|
84
|
+
ssn_validator is a ruby gem that validates whether an SSN has likely been
|
85
|
+
issued or not. What exactly does that mean "likely" been issued?
|
86
|
+
We can‘t tell for sure if an SSN belongs to a particular person, but
|
87
|
+
knowing the "<a
|
88
|
+
href="http://www.socialsecurity.gov/employer/ssnweb.htm">rules"</a> on how
|
89
|
+
the social security administration assigns numbers, we can determine
|
90
|
+
whether a number has ever been issued or not.
|
91
|
+
</p>
|
92
|
+
<p>
|
93
|
+
ssn_validator started as a need for the company I work for, Clarity
|
94
|
+
Services Inc. Incredibly, we couldn‘t find an existing gem or service
|
95
|
+
that provided what we needed. Since we were going to have to roll our own
|
96
|
+
solution, we decided to create a gem out of it and share it with the
|
97
|
+
community. Much thanks goes to the management at Clarity Services Inc. for
|
98
|
+
allowing this code to be open sourced.
|
99
|
+
</p>
|
100
|
+
<h2>FEATURES/PROBLEMS:</h2>
|
101
|
+
<ul>
|
102
|
+
<li>What it can do:
|
103
|
+
|
104
|
+
<pre>
|
105
|
+
Validates the likelyhood that an SSN has been issued to someone.
|
106
|
+
Checks the Death Master File if the SSN belongs to a dead person. This will require you to purchase the dmf data from https://dmf.ntis.gov
|
107
|
+
</pre>
|
108
|
+
</li>
|
109
|
+
<li>What it cannot do:
|
110
|
+
|
111
|
+
<pre>
|
112
|
+
Validate that an SSN actually belongs to a particular person.
|
113
|
+
</pre>
|
114
|
+
</li>
|
115
|
+
<li>What it‘s planned to do:
|
116
|
+
|
117
|
+
<pre>
|
118
|
+
Determine when an SSN was issued...if i can find the historical data. This can be used to further validate an SSN by comparing it to a Date of Birth.
|
119
|
+
</pre>
|
120
|
+
</li>
|
121
|
+
</ul>
|
122
|
+
<h2>SYNOPSIS:</h2>
|
123
|
+
<ul>
|
124
|
+
<li>Just instantiate the object with an SSN.
|
125
|
+
|
126
|
+
<pre>
|
127
|
+
ssn = SsnValidator::Ssn.new('123-45-6789')
|
128
|
+
</pre>
|
129
|
+
</li>
|
130
|
+
<li>Then check if it‘s valid
|
131
|
+
|
132
|
+
<pre>
|
133
|
+
ssn.valid?
|
134
|
+
ssn.death_master_file_hit?
|
135
|
+
|
136
|
+
ssn.valid? only checks to see if the number itself is valid. Check the death_master_file_hit? method
|
137
|
+
as well to verify the ssn does not belong the the deceased.
|
138
|
+
|
139
|
+
The death_master_file_hit? method will only return true of false if you have purchased the dmf data and
|
140
|
+
loaded it into your database. There is a generator and rake task to facilitate this, but you'll have
|
141
|
+
to purchase the data yourself at https://dmf.ntis.gov.
|
142
|
+
</pre>
|
143
|
+
</li>
|
144
|
+
<li>You can check the errors array to see why it‘s not valid.
|
145
|
+
|
146
|
+
<pre>
|
147
|
+
ssn.errors
|
148
|
+
</pre>
|
149
|
+
</li>
|
150
|
+
</ul>
|
151
|
+
<h2>REQUIREMENTS:</h2>
|
152
|
+
<ul>
|
153
|
+
<li>Rails 2.0.0 or greater
|
154
|
+
|
155
|
+
</li>
|
156
|
+
</ul>
|
157
|
+
<h2>INSTALL:</h2>
|
158
|
+
<ul>
|
159
|
+
<li>To install the gem:
|
160
|
+
|
161
|
+
<pre>
|
162
|
+
sudo gem install kevintyll-ssn_validator
|
163
|
+
</pre>
|
164
|
+
</li>
|
165
|
+
<li>To create the necessary db migration, from the command line, run:
|
166
|
+
|
167
|
+
<pre>
|
168
|
+
script/generate ssn_validator_migration
|
169
|
+
</pre>
|
170
|
+
</li>
|
171
|
+
<li>Require the gem in your environment.rb file in the Rails::Initializer
|
172
|
+
block:
|
173
|
+
|
174
|
+
<pre>
|
175
|
+
config.gem 'kevintyll-ssn_validator', :lib => 'ssn_validator'
|
176
|
+
</pre>
|
177
|
+
</li>
|
178
|
+
<li>To load your table with the current SSN data, from the command line, run:
|
179
|
+
|
180
|
+
<pre>
|
181
|
+
rake ssn_validator:update_data
|
182
|
+
|
183
|
+
* The SSN data is updated monthly, so you'll want to run this rake task monthly to keep your validations accurate.
|
184
|
+
</pre>
|
185
|
+
</li>
|
186
|
+
<li>If you‘ve purchased the death master file data, create the
|
187
|
+
death_master_files migration:
|
188
|
+
|
189
|
+
<pre>
|
190
|
+
script/generate death_master_file_migration
|
191
|
+
</pre>
|
192
|
+
</li>
|
193
|
+
<li>To load the dmf files you receive from ntis:
|
194
|
+
|
195
|
+
<pre>
|
196
|
+
rake ssn_validator:death_master_file:load_file PATH='path/to/file' AS_OF='2009-03-01'
|
197
|
+
|
198
|
+
* You'll need to pass in the full path to where the file is on disk. You'll also need
|
199
|
+
to pass in the date this file's data are as of in the format yyyy-mm-dd.
|
200
|
+
|
201
|
+
* This task must be used to load the initial file you receive from ntis on CD. It can optionally be used
|
202
|
+
to load the monthly update files you download from the website. If you manually download the update files,
|
203
|
+
you do not need to add your user name and password to the environment.rb file. For a more automated approach
|
204
|
+
to loading the update files, add your user name and password to the environment.rb file and use the 2nd rake task.
|
205
|
+
</pre>
|
206
|
+
</li>
|
207
|
+
<li>To load the monthly updates from the ntis website:
|
208
|
+
|
209
|
+
<pre>
|
210
|
+
* Add your user_name and password to the environment.rb file
|
211
|
+
|
212
|
+
SsnValidator::Ntis.user_name = 'REPLACE WITH YOUR dmf.ntis.gov USER NAME'
|
213
|
+
SsnValidator::Ntis.password = 'REPLACE WITH YOUR dmf.ntis.gov PASSWORD'
|
214
|
+
|
215
|
+
* Run the rake task:
|
216
|
+
|
217
|
+
rake ssn_validator:death_master_file:update_data
|
218
|
+
|
219
|
+
* This rake task will determine the most recent file that has been loaded, and loads all subsequent files in order
|
220
|
+
from the dmf.ntis.gov website.
|
221
|
+
|
222
|
+
* The death master file data is updated monthly, so you'll want to run this rake task monthly to keep your validations accurate.
|
223
|
+
</pre>
|
224
|
+
</li>
|
225
|
+
</ul>
|
226
|
+
<h2>Copyright</h2>
|
227
|
+
<p>
|
228
|
+
Copyright (c) 2009 Kevin Tyll. See LICENSE for details.
|
229
|
+
</p>
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
|
234
|
+
</div>
|
235
|
+
|
236
|
+
|
237
|
+
</div>
|
238
|
+
|
239
|
+
|
240
|
+
<!-- if includes -->
|
241
|
+
|
242
|
+
<div id="section">
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
<!-- if method_list -->
|
252
|
+
|
253
|
+
|
254
|
+
</div>
|
255
|
+
|
256
|
+
|
257
|
+
<div id="validator-badges">
|
258
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
</body>
|
262
|
+
</html>
|