ssn_validator 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Rakefile +61 -60
- data/VERSION.yml +1 -1
- data/lib/ssn_validator/models/death_master_file_loader.rb +46 -43
- data/rdoc/DeathMasterFile.html +139 -0
- data/rdoc/DeathMasterFileLoader.html +384 -0
- data/rdoc/LICENSE.html +116 -0
- data/rdoc/README_rdoc.html +226 -0
- data/rdoc/SsnHighGroupCode.html +139 -0
- data/rdoc/SsnHighGroupCodeLoader.html +251 -0
- data/rdoc/SsnValidator/Ntis.html +139 -0
- data/rdoc/SsnValidator/Ssn.html +417 -0
- data/rdoc/SsnValidator.html +134 -0
- data/rdoc/created.rid +10 -1
- data/rdoc/images/add.png +0 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/delete.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_blue.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/transparent.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/index.html +89 -21
- data/rdoc/js/darkfish.js +153 -0
- data/rdoc/js/jquery.js +18 -0
- data/rdoc/js/navigation.js +142 -0
- data/rdoc/js/search.js +94 -0
- data/rdoc/js/search_index.js +1 -0
- data/rdoc/js/searcher.js +228 -0
- data/rdoc/lib/ssn_validator/models/death_master_file_loader_rb.html +95 -0
- data/rdoc/lib/ssn_validator/models/death_master_file_rb.html +95 -0
- data/rdoc/lib/ssn_validator/models/ssn_high_group_code_loader_rb.html +95 -0
- data/rdoc/lib/ssn_validator/models/ssn_high_group_code_rb.html +95 -0
- data/rdoc/lib/ssn_validator/models/ssn_validator_rb.html +95 -0
- data/rdoc/lib/ssn_validator/ntis_rb.html +95 -0
- data/rdoc/lib/ssn_validator_rb.html +95 -0
- data/rdoc/rdoc.css +543 -0
- data/rdoc/table_of_contents.html +107 -0
- data/ssn_validator.gemspec +54 -14
- metadata +56 -20
@@ -0,0 +1,226 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>LICENSE</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body class="file">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="project-metadata">
|
47
|
+
<nav id="fileindex-section" class="section project-section">
|
48
|
+
<h3 class="section-header">Pages</h3>
|
49
|
+
|
50
|
+
<ul>
|
51
|
+
|
52
|
+
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
53
|
+
|
54
|
+
<li class="file"><a href="./README_rdoc.html">README</a>
|
55
|
+
|
56
|
+
</ul>
|
57
|
+
</nav>
|
58
|
+
|
59
|
+
<nav id="classindex-section" class="section project-section">
|
60
|
+
<h3 class="section-header">Class and Module Index</h3>
|
61
|
+
|
62
|
+
<ul class="link-list">
|
63
|
+
|
64
|
+
<li><a href="./SsnValidator.html">SsnValidator</a>
|
65
|
+
|
66
|
+
<li><a href="./SsnValidator/Ntis.html">SsnValidator::Ntis</a>
|
67
|
+
|
68
|
+
<li><a href="./SsnValidator/Ssn.html">SsnValidator::Ssn</a>
|
69
|
+
|
70
|
+
<li><a href="./DeathMasterFile.html">DeathMasterFile</a>
|
71
|
+
|
72
|
+
<li><a href="./DeathMasterFileLoader.html">DeathMasterFileLoader</a>
|
73
|
+
|
74
|
+
<li><a href="./SsnHighGroupCode.html">SsnHighGroupCode</a>
|
75
|
+
|
76
|
+
<li><a href="./SsnHighGroupCodeLoader.html">SsnHighGroupCodeLoader</a>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
</nav>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
</nav>
|
83
|
+
|
84
|
+
<div id="documentation" class="description">
|
85
|
+
|
86
|
+
<h1 id="label-ssn_validator">ssn_validator</h1>
|
87
|
+
<ul><li>
|
88
|
+
<p><a
|
89
|
+
href="http://kevintyll.github.com/ssn_validator">kevintyll.github.com/ssn_validator</a></p>
|
90
|
+
</li><li>
|
91
|
+
<p><a href="http://www.drexel-labs.com">www.drexel-labs.com</a></p>
|
92
|
+
</li></ul>
|
93
|
+
|
94
|
+
<h2 id="label-DESCRIPTION%3A">DESCRIPTION:</h2>
|
95
|
+
|
96
|
+
<p>ssn_validator is a ruby gem that validates whether an SSN has likely been
|
97
|
+
issued or not. What exactly does that mean “likely” been issued? We
|
98
|
+
can’t tell for sure if an SSN belongs to a particular person, but knowing
|
99
|
+
the “<a
|
100
|
+
href="http://www.socialsecurity.gov/employer/ssnweb.htm">rules”</a> on
|
101
|
+
how the social security administration assigns numbers, we can determine
|
102
|
+
whether a number has ever been issued or not.</p>
|
103
|
+
|
104
|
+
<p>ssn_validator started as a need for the company I work for, Clarity
|
105
|
+
Services Inc. Incredibly, we couldn’t find an existing gem or service
|
106
|
+
that provided what we needed. Since we were going to have to roll our own
|
107
|
+
solution, we decided to create a gem out of it and share it with the
|
108
|
+
community. Much thanks goes to the management at Clarity Services Inc. for
|
109
|
+
allowing this code to be open sourced.</p>
|
110
|
+
|
111
|
+
<h2 id="label-FEATURES%2FPROBLEMS%3A">FEATURES/PROBLEMS:</h2>
|
112
|
+
<ul><li>
|
113
|
+
<p>What it can do:</p>
|
114
|
+
|
115
|
+
<pre class="ruby"><span class="ruby-constant">Validates</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">likelyhood</span> <span class="ruby-identifier">that</span> <span class="ruby-identifier">an</span> <span class="ruby-constant">SSN</span> <span class="ruby-identifier">has</span> <span class="ruby-identifier">been</span> <span class="ruby-identifier">issued</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">someone</span>.
|
116
|
+
<span class="ruby-constant">Checks</span> <span class="ruby-identifier">the</span> <span class="ruby-constant">Death</span> <span class="ruby-constant">Master</span> <span class="ruby-constant">File</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">the</span> <span class="ruby-constant">SSN</span> <span class="ruby-identifier">belongs</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">a</span> <span class="ruby-identifier">dead</span> <span class="ruby-identifier">person</span>. <span class="ruby-constant">This</span> <span class="ruby-identifier">will</span> <span class="ruby-identifier">require</span> <span class="ruby-identifier">you</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">purchase</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">dmf</span> <span class="ruby-identifier">data</span> <span class="ruby-identifier">from</span> <span class="ruby-identifier">https</span>:<span class="ruby-operator">/</span><span class="ruby-regexp">/dmf.ntis.gov
|
117
|
+
</span></pre>
|
118
|
+
</li><li>
|
119
|
+
<p>What it cannot do:</p>
|
120
|
+
|
121
|
+
<pre>Validate that an SSN actually belongs to a particular person.</pre>
|
122
|
+
</li><li>
|
123
|
+
<p>What it’s planned to do:</p>
|
124
|
+
|
125
|
+
<pre>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.</pre>
|
126
|
+
</li></ul>
|
127
|
+
|
128
|
+
<h2 id="label-SYNOPSIS%3A">SYNOPSIS:</h2>
|
129
|
+
<ul><li>
|
130
|
+
<p>Just instantiate the object with an SSN.</p>
|
131
|
+
|
132
|
+
<pre>ssn = SsnValidator::Ssn.new('123-45-6789')</pre>
|
133
|
+
</li><li>
|
134
|
+
<p>Then check if it’s valid</p>
|
135
|
+
|
136
|
+
<pre>ssn.valid?
|
137
|
+
ssn.death_master_file_hit?
|
138
|
+
|
139
|
+
ssn.valid? only checks to see if the number itself is valid. Check the death_master_file_hit? method
|
140
|
+
as well to verify the ssn does not belong the the deceased.
|
141
|
+
|
142
|
+
The death_master_file_hit? method will only return true of false if you have purchased the dmf data and
|
143
|
+
loaded it into your database. There is a generator and rake task to facilitate this, but you'll have
|
144
|
+
to purchase the data yourself at https://dmf.ntis.gov.</pre>
|
145
|
+
</li><li>
|
146
|
+
<p>You can check the errors array to see why it’s not valid.</p>
|
147
|
+
|
148
|
+
<pre>ssn.errors</pre>
|
149
|
+
</li></ul>
|
150
|
+
|
151
|
+
<h2 id="label-REQUIREMENTS%3A">REQUIREMENTS:</h2>
|
152
|
+
<ul><li>
|
153
|
+
<p>Rails 2.0.0 or greater</p>
|
154
|
+
</li></ul>
|
155
|
+
|
156
|
+
<h2 id="label-INSTALL%3A">INSTALL:</h2>
|
157
|
+
<ul><li>
|
158
|
+
<p>To install the gem:</p>
|
159
|
+
|
160
|
+
<pre>sudo gem install kevintyll-ssn_validator</pre>
|
161
|
+
</li><li>
|
162
|
+
<p>To create the necessary db migration, from the command line, run:</p>
|
163
|
+
|
164
|
+
<pre>script/generate ssn_validator_migration</pre>
|
165
|
+
</li><li>
|
166
|
+
<p>Require the gem in your environment.rb file in the Rails::Initializer
|
167
|
+
block:</p>
|
168
|
+
|
169
|
+
<pre class="ruby"><span class="ruby-identifier">config</span>.<span class="ruby-identifier">gem</span> <span class="ruby-string">'kevintyll-ssn_validator'</span>, :<span class="ruby-identifier">lib</span> =<span class="ruby-operator">></span> <span class="ruby-string">'ssn_validator'</span>
|
170
|
+
</pre>
|
171
|
+
</li><li>
|
172
|
+
<p>To load your table with the current SSN data, from the command line, run:</p>
|
173
|
+
|
174
|
+
<pre>rake ssn_validator:update_data
|
175
|
+
|
176
|
+
* The SSN data is updated monthly, so you'll want to run this rake task monthly to keep your validations accurate.</pre>
|
177
|
+
</li><li>
|
178
|
+
<p>If you’ve purchased the death master file data, create the
|
179
|
+
death_master_files migration:</p>
|
180
|
+
|
181
|
+
<pre>script/generate death_master_file_migration</pre>
|
182
|
+
</li><li>
|
183
|
+
<p>To load the dmf files you receive from ntis:</p>
|
184
|
+
|
185
|
+
<pre>rake ssn_validator:death_master_file:load_file PATH='path/to/file' AS_OF='2009-03-01'
|
186
|
+
|
187
|
+
* You'll need to pass in the full path to where the file is on disk. You'll also need
|
188
|
+
to pass in the date this file's data are as of in the format yyyy-mm-dd.
|
189
|
+
|
190
|
+
* This task must be used to load the initial file you receive from ntis on CD. It can optionally be used
|
191
|
+
to load the monthly update files you download from the website. If you manually download the update files,
|
192
|
+
you do not need to add your user name and password to the environment.rb file. For a more automated approach
|
193
|
+
to loading the update files, add your user name and password to the environment.rb file and use the 2nd rake task.</pre>
|
194
|
+
</li><li>
|
195
|
+
<p>To load the monthly updates from the ntis website:</p>
|
196
|
+
|
197
|
+
<pre>* Add your user_name and password to the environment.rb file
|
198
|
+
|
199
|
+
SsnValidator::Ntis.user_name = 'REPLACE WITH YOUR dmf.ntis.gov USER NAME'
|
200
|
+
SsnValidator::Ntis.password = 'REPLACE WITH YOUR dmf.ntis.gov PASSWORD'
|
201
|
+
|
202
|
+
* Run the rake task:
|
203
|
+
|
204
|
+
rake ssn_validator:death_master_file:update_data
|
205
|
+
|
206
|
+
* This rake task will determine the most recent file that has been loaded, and loads all subsequent files in order
|
207
|
+
from the dmf.ntis.gov website.
|
208
|
+
|
209
|
+
* The death master file data is updated monthly, so you'll want to run this rake task monthly to keep your validations accurate.</pre>
|
210
|
+
</li></ul>
|
211
|
+
|
212
|
+
<h2 id="label-Copyright">Copyright</h2>
|
213
|
+
|
214
|
+
<p>Copyright © 2009 Kevin Tyll. See <a href="LICENSE.html">LICENSE</a> for
|
215
|
+
details.</p>
|
216
|
+
|
217
|
+
</div>
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
<footer id="validator-badges">
|
222
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
223
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
|
224
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
225
|
+
</footer>
|
226
|
+
|
@@ -0,0 +1,139 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Class: SsnHighGroupCode</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/ssn_validator/models/ssn_high_group_code.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">ActiveRecord::Base
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<div id="project-metadata">
|
71
|
+
<nav id="fileindex-section" class="section project-section">
|
72
|
+
<h3 class="section-header">Pages</h3>
|
73
|
+
|
74
|
+
<ul>
|
75
|
+
|
76
|
+
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
77
|
+
|
78
|
+
<li class="file"><a href="./README_rdoc.html">README</a>
|
79
|
+
|
80
|
+
</ul>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<nav id="classindex-section" class="section project-section">
|
84
|
+
<h3 class="section-header">Class and Module Index</h3>
|
85
|
+
|
86
|
+
<ul class="link-list">
|
87
|
+
|
88
|
+
<li><a href="./SsnValidator.html">SsnValidator</a>
|
89
|
+
|
90
|
+
<li><a href="./SsnValidator/Ntis.html">SsnValidator::Ntis</a>
|
91
|
+
|
92
|
+
<li><a href="./SsnValidator/Ssn.html">SsnValidator::Ssn</a>
|
93
|
+
|
94
|
+
<li><a href="./DeathMasterFile.html">DeathMasterFile</a>
|
95
|
+
|
96
|
+
<li><a href="./DeathMasterFileLoader.html">DeathMasterFileLoader</a>
|
97
|
+
|
98
|
+
<li><a href="./SsnHighGroupCode.html">SsnHighGroupCode</a>
|
99
|
+
|
100
|
+
<li><a href="./SsnHighGroupCodeLoader.html">SsnHighGroupCodeLoader</a>
|
101
|
+
|
102
|
+
</ul>
|
103
|
+
</nav>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
</nav>
|
107
|
+
|
108
|
+
<div id="documentation">
|
109
|
+
<h1 class="class">class SsnHighGroupCode</h1>
|
110
|
+
|
111
|
+
<div id="description" class="description">
|
112
|
+
|
113
|
+
</div><!-- description -->
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<!-- Methods -->
|
128
|
+
|
129
|
+
</section><!-- 5Buntitled-5D -->
|
130
|
+
|
131
|
+
</div><!-- documentation -->
|
132
|
+
|
133
|
+
|
134
|
+
<footer id="validator-badges">
|
135
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
136
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
|
137
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
138
|
+
</footer>
|
139
|
+
|
@@ -0,0 +1,251 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Class: SsnHighGroupCodeLoader</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/ssn_validator/models/ssn_high_group_code_loader.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">Object
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-c-load_all_high_group_codes_files">::load_all_high_group_codes_files</a>
|
74
|
+
|
75
|
+
<li><a href="#method-c-load_current_high_group_codes_file">::load_current_high_group_codes_file</a>
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</nav>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<div id="project-metadata">
|
83
|
+
<nav id="fileindex-section" class="section project-section">
|
84
|
+
<h3 class="section-header">Pages</h3>
|
85
|
+
|
86
|
+
<ul>
|
87
|
+
|
88
|
+
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
89
|
+
|
90
|
+
<li class="file"><a href="./README_rdoc.html">README</a>
|
91
|
+
|
92
|
+
</ul>
|
93
|
+
</nav>
|
94
|
+
|
95
|
+
<nav id="classindex-section" class="section project-section">
|
96
|
+
<h3 class="section-header">Class and Module Index</h3>
|
97
|
+
|
98
|
+
<ul class="link-list">
|
99
|
+
|
100
|
+
<li><a href="./SsnValidator.html">SsnValidator</a>
|
101
|
+
|
102
|
+
<li><a href="./SsnValidator/Ntis.html">SsnValidator::Ntis</a>
|
103
|
+
|
104
|
+
<li><a href="./SsnValidator/Ssn.html">SsnValidator::Ssn</a>
|
105
|
+
|
106
|
+
<li><a href="./DeathMasterFile.html">DeathMasterFile</a>
|
107
|
+
|
108
|
+
<li><a href="./DeathMasterFileLoader.html">DeathMasterFileLoader</a>
|
109
|
+
|
110
|
+
<li><a href="./SsnHighGroupCode.html">SsnHighGroupCode</a>
|
111
|
+
|
112
|
+
<li><a href="./SsnHighGroupCodeLoader.html">SsnHighGroupCodeLoader</a>
|
113
|
+
|
114
|
+
</ul>
|
115
|
+
</nav>
|
116
|
+
|
117
|
+
</div>
|
118
|
+
</nav>
|
119
|
+
|
120
|
+
<div id="documentation">
|
121
|
+
<h1 class="class">class SsnHighGroupCodeLoader</h1>
|
122
|
+
|
123
|
+
<div id="description" class="description">
|
124
|
+
|
125
|
+
</div><!-- description -->
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<!-- Methods -->
|
140
|
+
|
141
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
142
|
+
<h3 class="section-header">Public Class Methods</h3>
|
143
|
+
|
144
|
+
|
145
|
+
<div id="method-c-load_all_high_group_codes_files" class="method-detail ">
|
146
|
+
|
147
|
+
<div class="method-heading">
|
148
|
+
<span class="method-name">load_all_high_group_codes_files</span><span
|
149
|
+
class="method-args">() { |status| ... }</span>
|
150
|
+
<span class="method-click-advice">click to toggle source</span>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
<div class="method-description">
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<div class="method-source-code" id="load_all_high_group_codes_files-source">
|
161
|
+
<pre><span class="ruby-comment"># File lib/ssn_validator/models/ssn_high_group_code_loader.rb, line 4</span>
|
162
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_all_high_group_codes_files</span>
|
163
|
+
<span class="ruby-identifier">months</span> = [<span class="ruby-string">'Jan'</span>,<span class="ruby-string">'Feb'</span>,<span class="ruby-string">'Mar'</span>,<span class="ruby-string">'Apr'</span>,<span class="ruby-string">'May'</span>,<span class="ruby-string">'June'</span>,<span class="ruby-string">'July'</span>,<span class="ruby-string">'Aug'</span>,[<span class="ruby-string">'Sept'</span>,<span class="ruby-string">'Sep'</span>],<span class="ruby-string">'Oct'</span>,<span class="ruby-string">'Nov'</span>,<span class="ruby-string">'Dec'</span>]
|
164
|
+
<span class="ruby-identifier">run_file_date</span> = <span class="ruby-constant">SsnHighGroupCode</span>.<span class="ruby-identifier">maximum</span>(<span class="ruby-value">:as_of</span>)
|
165
|
+
<span class="ruby-identifier">run_file_date</span> = <span class="ruby-identifier">run_file_date</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">run_file_date</span>.<span class="ruby-identifier">next_month</span>.<span class="ruby-identifier">beginning_of_month</span>.<span class="ruby-identifier">to_date</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2003</span>,<span class="ruby-value">11</span>,<span class="ruby-value">01</span>)
|
166
|
+
<span class="ruby-identifier">last_file_date</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">today</span>.<span class="ruby-identifier">beginning_of_month</span>
|
167
|
+
<span class="ruby-keyword">while</span> <span class="ruby-identifier">run_file_date</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">last_file_date</span>
|
168
|
+
<span class="ruby-identifier">file_processed</span> = <span class="ruby-keyword">false</span>
|
169
|
+
<span class="ruby-identifier">run_file_month_variants</span> = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">months</span>[<span class="ruby-identifier">run_file_date</span>.<span class="ruby-identifier">month</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>])
|
170
|
+
<span class="ruby-identifier">run_file_year</span> = <span class="ruby-identifier">run_file_date</span>.<span class="ruby-identifier">year</span>
|
171
|
+
<span class="ruby-identifier">run_file_month_variants</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">run_file_month</span><span class="ruby-operator">|</span>
|
172
|
+
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">file_processed</span>
|
173
|
+
[<span class="ruby-string">''</span>,<span class="ruby-string">'corrected'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span>
|
174
|
+
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">file_processed</span>
|
175
|
+
[<span class="ruby-string">'ssns'</span>,<span class="ruby-string">'ssnvs'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">url_mod</span><span class="ruby-operator">|</span>
|
176
|
+
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">file_processed</span>
|
177
|
+
(<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">today</span>.<span class="ruby-identifier">day</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">day</span><span class="ruby-operator">|</span>
|
178
|
+
<span class="ruby-identifier">string_day</span> = <span class="ruby-identifier">day</span>.<span class="ruby-identifier">to_s</span>
|
179
|
+
<span class="ruby-identifier">string_day</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>,<span class="ruby-string">'0'</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">day</span> <span class="ruby-operator"><</span> <span class="ruby-value">10</span>
|
180
|
+
<span class="ruby-identifier">string_year</span> = <span class="ruby-identifier">run_file_year</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">last</span>(<span class="ruby-value">2</span>)
|
181
|
+
<span class="ruby-identifier">file_name</span> = <span class="ruby-node">"HG#{run_file_month}#{string_day}#{string_year}#{mod}.txt"</span>
|
182
|
+
<span class="ruby-identifier">text</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get</span>(<span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">"http://www.socialsecurity.gov/employer/#{url_mod}/#{file_name}"</span>))
|
183
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">include?</span> <span class="ruby-string">'File Not Found'</span>
|
184
|
+
<span class="ruby-identifier">create_records</span>(<span class="ruby-identifier">parse_text</span>(<span class="ruby-identifier">text</span>),<span class="ruby-identifier">extract_as_of_date</span>(<span class="ruby-identifier">text</span>)) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">status</span><span class="ruby-operator">|</span>
|
185
|
+
<span class="ruby-keyword">yield</span> <span class="ruby-identifier">status</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
|
186
|
+
<span class="ruby-keyword">end</span>
|
187
|
+
<span class="ruby-identifier">file_processed</span> = <span class="ruby-keyword">true</span>
|
188
|
+
<span class="ruby-keyword">break</span>
|
189
|
+
<span class="ruby-keyword">end</span>
|
190
|
+
<span class="ruby-keyword">end</span>
|
191
|
+
<span class="ruby-keyword">end</span>
|
192
|
+
<span class="ruby-keyword">end</span>
|
193
|
+
<span class="ruby-keyword">end</span>
|
194
|
+
<span class="ruby-identifier">run_file_date</span> = <span class="ruby-identifier">run_file_date</span>.<span class="ruby-identifier">next_month</span>
|
195
|
+
<span class="ruby-keyword">end</span>
|
196
|
+
<span class="ruby-keyword">end</span></pre>
|
197
|
+
</div><!-- load_all_high_group_codes_files-source -->
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</div><!-- load_all_high_group_codes_files-method -->
|
205
|
+
|
206
|
+
|
207
|
+
<div id="method-c-load_current_high_group_codes_file" class="method-detail ">
|
208
|
+
|
209
|
+
<div class="method-heading">
|
210
|
+
<span class="method-name">load_current_high_group_codes_file</span><span
|
211
|
+
class="method-args">()</span>
|
212
|
+
<span class="method-click-advice">click to toggle source</span>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
|
216
|
+
<div class="method-description">
|
217
|
+
|
218
|
+
<p>Loads the most recent file from <a
|
219
|
+
href="http://www.socialsecurity.gov/employer/ssns/highgroup.txt">www.socialsecurity.gov/employer/ssns/highgroup.txt</a></p>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
<div class="method-source-code" id="load_current_high_group_codes_file-source">
|
224
|
+
<pre><span class="ruby-comment"># File lib/ssn_validator/models/ssn_high_group_code_loader.rb, line 41</span>
|
225
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_current_high_group_codes_file</span>
|
226
|
+
<span class="ruby-identifier">text</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get</span>(<span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">'http://www.socialsecurity.gov/employer/ssns/highgroup.txt'</span>))
|
227
|
+
<span class="ruby-identifier">create_records</span>(<span class="ruby-identifier">parse_text</span>(<span class="ruby-identifier">text</span>),<span class="ruby-identifier">extract_as_of_date</span>(<span class="ruby-identifier">text</span>))
|
228
|
+
<span class="ruby-keyword">end</span></pre>
|
229
|
+
</div><!-- load_current_high_group_codes_file-source -->
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
</div><!-- load_current_high_group_codes_file-method -->
|
237
|
+
|
238
|
+
|
239
|
+
</section><!-- public-class-method-details -->
|
240
|
+
|
241
|
+
</section><!-- 5Buntitled-5D -->
|
242
|
+
|
243
|
+
</div><!-- documentation -->
|
244
|
+
|
245
|
+
|
246
|
+
<footer id="validator-badges">
|
247
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
248
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
|
249
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
250
|
+
</footer>
|
251
|
+
|