rdoc/DeathMasterFileLoader.html in ssn_validator-1.0.10 vs rdoc/DeathMasterFileLoader.html in ssn_validator-1.0.11
- old
+ new
@@ -163,11 +163,11 @@
loaded, and loads each missing file in sequence up to the current file.</p>
<div class="method-source-code" id="load_update_files_from_web-source">
- <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 80</span>
+ <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 88</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_update_files_from_web</span>
<span class="ruby-identifier">max_as_of</span> = <span class="ruby-constant">DeathMasterFile</span>.<span class="ruby-identifier">maximum</span>(<span class="ruby-value">:as_of</span>)
<span class="ruby-identifier">run_file_date</span> = <span class="ruby-identifier">max_as_of</span>.<span class="ruby-identifier">beginning_of_month</span>.<span class="ruby-identifier">next_month</span>
<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>
<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>
@@ -207,11 +207,11 @@
data is accurate.</p>
<div class="method-source-code" id="new-source">
- <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 11</span>
+ <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">path_or_url</span>, <span class="ruby-identifier">file_as_of</span>)
<span class="ruby-ivar">@file_path_or_url</span> = <span class="ruby-identifier">path_or_url</span>
<span class="ruby-ivar">@file_as_of</span> = <span class="ruby-identifier">file_as_of</span>
<span class="ruby-identifier">valid?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">status</span><span class="ruby-operator">|</span> <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> }
<span class="ruby-keyword">end</span></pre>
@@ -245,11 +245,11 @@
<div class="method-source-code" id="get_file_from_web-source">
- <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 47</span>
+ <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 55</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_file_from_web</span>
<span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@file_path_or_url</span>)
<span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Get</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">request_uri</span>)
<span class="ruby-identifier">request</span>.<span class="ruby-identifier">basic_auth</span>(<span class="ruby-constant">SsnValidator</span><span class="ruby-operator">::</span><span class="ruby-constant">Ntis</span>.<span class="ruby-identifier">user_name</span>, <span class="ruby-constant">SsnValidator</span><span class="ruby-operator">::</span><span class="ruby-constant">Ntis</span>.<span class="ruby-identifier">password</span>)
@@ -301,14 +301,14 @@
<div class="method-source-code" id="load_file-source">
- <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 32</span>
+ <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 40</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_file</span>
- <span class="ruby-keyword">if</span> <span class="ruby-constant">DeathMasterFile</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">ConnectionAdapters</span><span class="ruby-operator">::</span><span class="ruby-constant">MysqlAdapter</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">DeathMasterFile</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">ConnectionAdapters</span><span class="ruby-operator">::</span><span class="ruby-constant">JdbcAdapter</span>)
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">DeathMasterFile</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">ConnectionAdapters</span><span class="ruby-operator">::</span><span class="ruby-constant">AbstractMysqlAdapter</span>) <span class="ruby-operator">||</span> <span class="ruby-constant">DeathMasterFile</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">ConnectionAdapters</span><span class="ruby-operator">::</span><span class="ruby-constant">JdbcAdapter</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-string">"Converting file to csv format for Mysql import. This could take several minutes."</span>
<span class="ruby-keyword">yield</span> <span class="ruby-string">"Converting file to csv format for Mysql import. This could take several minutes."</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
<span class="ruby-identifier">csv_file</span> = <span class="ruby-identifier">convert_file_to_csv</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">status</span><span class="ruby-operator">|</span> <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> }
@@ -342,10 +342,10 @@
<div class="method-source-code" id="valid-3F-source">
- <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 17</span>
+ <pre><span class="ruby-comment"># File lib/ssn_validator/models/death_master_file_loader.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">valid?</span>
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"path_or_url not specified"</span>) <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@file_path_or_url</span>
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"as_of not specified"</span>) <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@file_as_of</span>
<span class="ruby-identifier">max_as_of</span> = <span class="ruby-constant">DeathMasterFile</span>.<span class="ruby-identifier">maximum</span>(<span class="ruby-value">:as_of</span>)
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"A more recent file has already been processed. DB as_of date #{max_as_of}"</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">max_as_of</span> <span class="ruby-operator">&&</span> (<span class="ruby-identifier">max_as_of</span> <span class="ruby-operator">>=</span> <span class="ruby-ivar">@file_as_of</span>.<span class="ruby-identifier">to_date</span>)