ofac 2.0.1 → 2.0.2

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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +24 -49
  3. data/lib/ofac/version.rb +1 -0
  4. data/test/test_helper.rb +5 -1
  5. metadata +118 -94
  6. data/.document +0 -5
  7. data/.ruby-gemset +0 -1
  8. data/.ruby-version +0 -1
  9. data/History.txt +0 -134
  10. data/PostInstall.txt +0 -11
  11. data/VERSION.yml +0 -5
  12. data/generators/ofac_migration/.DS_Store +0 -0
  13. data/generators/ofac_migration/ofac_migration_generator.rb +0 -12
  14. data/generators/ofac_migration/templates/.DS_Store +0 -0
  15. data/generators/ofac_migration/templates/migration.rb +0 -31
  16. data/nbproject/project.properties +0 -7
  17. data/nbproject/project.xml +0 -15
  18. data/ofac.gemspec +0 -129
  19. data/rdoc/CreateOfacSdns.html +0 -249
  20. data/rdoc/Ofac.html +0 -434
  21. data/rdoc/OfacMatch.html +0 -299
  22. data/rdoc/OfacMigration.html +0 -138
  23. data/rdoc/OfacMigration/Generators.html +0 -138
  24. data/rdoc/OfacMigration/Generators/BuildGenerator.html +0 -251
  25. data/rdoc/OfacSdn.html +0 -209
  26. data/rdoc/OfacSdnLoader.html +0 -238
  27. data/rdoc/README_rdoc.html +0 -323
  28. data/rdoc/String.html +0 -262
  29. data/rdoc/classes/Ofac.html +0 -411
  30. data/rdoc/classes/OfacMatch.html +0 -239
  31. data/rdoc/classes/OfacSdn.html +0 -111
  32. data/rdoc/classes/OfacSdnLoader.html +0 -190
  33. data/rdoc/classes/String.html +0 -207
  34. data/rdoc/created.rid +0 -10
  35. data/rdoc/files/README_rdoc.html +0 -317
  36. data/rdoc/files/lib/ofac/models/ofac_rb.html +0 -101
  37. data/rdoc/files/lib/ofac/models/ofac_sdn_loader_rb.html +0 -110
  38. data/rdoc/files/lib/ofac/models/ofac_sdn_rb.html +0 -108
  39. data/rdoc/files/lib/ofac/ofac_match_rb.html +0 -101
  40. data/rdoc/files/lib/ofac/ruby_string_extensions_rb.html +0 -101
  41. data/rdoc/files/lib/ofac_rb.html +0 -113
  42. data/rdoc/fr_class_index.html +0 -31
  43. data/rdoc/fr_file_index.html +0 -33
  44. data/rdoc/fr_method_index.html +0 -35
  45. data/rdoc/images/add.png +0 -0
  46. data/rdoc/images/arrow_up.png +0 -0
  47. data/rdoc/images/brick.png +0 -0
  48. data/rdoc/images/brick_link.png +0 -0
  49. data/rdoc/images/bug.png +0 -0
  50. data/rdoc/images/bullet_black.png +0 -0
  51. data/rdoc/images/bullet_toggle_minus.png +0 -0
  52. data/rdoc/images/bullet_toggle_plus.png +0 -0
  53. data/rdoc/images/date.png +0 -0
  54. data/rdoc/images/delete.png +0 -0
  55. data/rdoc/images/find.png +0 -0
  56. data/rdoc/images/loadingAnimation.gif +0 -0
  57. data/rdoc/images/macFFBgHack.png +0 -0
  58. data/rdoc/images/package.png +0 -0
  59. data/rdoc/images/page_green.png +0 -0
  60. data/rdoc/images/page_white_text.png +0 -0
  61. data/rdoc/images/page_white_width.png +0 -0
  62. data/rdoc/images/plugin.png +0 -0
  63. data/rdoc/images/ruby.png +0 -0
  64. data/rdoc/images/tag_blue.png +0 -0
  65. data/rdoc/images/tag_green.png +0 -0
  66. data/rdoc/images/transparent.png +0 -0
  67. data/rdoc/images/wrench.png +0 -0
  68. data/rdoc/images/wrench_orange.png +0 -0
  69. data/rdoc/images/zoom.png +0 -0
  70. data/rdoc/index.html +0 -96
  71. data/rdoc/js/darkfish.js +0 -155
  72. data/rdoc/js/jquery.js +0 -18
  73. data/rdoc/js/navigation.js +0 -142
  74. data/rdoc/js/search.js +0 -94
  75. data/rdoc/js/search_index.js +0 -1
  76. data/rdoc/js/searcher.js +0 -228
  77. data/rdoc/lib/generators/ofac_migration/build/build_generator_rb.html +0 -97
  78. data/rdoc/lib/generators/ofac_migration/build/templates/create_ofac_sdns_rb.html +0 -97
  79. data/rdoc/lib/ofac/models/ofac_rb.html +0 -97
  80. data/rdoc/lib/ofac/models/ofac_sdn_loader_rb.html +0 -97
  81. data/rdoc/lib/ofac/models/ofac_sdn_rb.html +0 -97
  82. data/rdoc/lib/ofac/ofac_match_rb.html +0 -97
  83. data/rdoc/lib/ofac/ruby_string_extensions_rb.html +0 -97
  84. data/rdoc/lib/ofac_rb.html +0 -97
  85. data/rdoc/rdoc-style.css +0 -208
  86. data/rdoc/rdoc.css +0 -595
  87. data/rdoc/table_of_contents.html +0 -120
@@ -1,209 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class OfacSdn - ofac 2.0.1</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
-
47
-
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/ofac/models/ofac_sdn.rb
53
- </ul>
54
- </nav>
55
-
56
-
57
- </div>
58
-
59
- <div id="class-metadata">
60
-
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
63
-
64
- <p class="link">ActiveRecord::Base
65
-
66
- </nav>
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <nav id="method-list-section" class="section">
72
- <h3 class="section-header">Methods</h3>
73
-
74
- <ul class="link-list">
75
-
76
- <li ><a href="#method-c-possible_sdns">::possible_sdns</a>
77
-
78
- </ul>
79
- </nav>
80
-
81
- </div>
82
-
83
- <div id="project-metadata">
84
- <nav id="fileindex-section" class="section project-section">
85
- <h3 class="section-header">Pages</h3>
86
-
87
- <ul>
88
-
89
- <li class="file"><a href="./README_rdoc.html">README</a>
90
-
91
- </ul>
92
- </nav>
93
-
94
- <nav id="classindex-section" class="section project-section">
95
- <h3 class="section-header">Class and Module Index</h3>
96
-
97
- <ul class="link-list">
98
-
99
- <li><a href="./CreateOfacSdns.html">CreateOfacSdns</a>
100
-
101
- <li><a href="./Ofac.html">Ofac</a>
102
-
103
- <li><a href="./OfacMatch.html">OfacMatch</a>
104
-
105
- <li><a href="./OfacMigration.html">OfacMigration</a>
106
-
107
- <li><a href="./OfacMigration/Generators.html">OfacMigration::Generators</a>
108
-
109
- <li><a href="./OfacMigration/Generators/BuildGenerator.html">OfacMigration::Generators::BuildGenerator</a>
110
-
111
- <li><a href="./OfacSdn.html">OfacSdn</a>
112
-
113
- <li><a href="./OfacSdnLoader.html">OfacSdnLoader</a>
114
-
115
- <li><a href="./String.html">String</a>
116
-
117
- </ul>
118
- </nav>
119
-
120
- </div>
121
- </nav>
122
-
123
- <div id="documentation">
124
- <h1 class="class">class OfacSdn</h1>
125
-
126
- <div id="description" class="description">
127
-
128
- </div><!-- description -->
129
-
130
-
131
-
132
-
133
- <section id="5Buntitled-5D" class="documentation-section">
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
- <!-- Methods -->
143
-
144
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
145
- <h3 class="section-header">Public Class Methods</h3>
146
-
147
-
148
- <div id="method-c-possible_sdns" class="method-detail ">
149
-
150
- <div class="method-heading">
151
- <span class="method-name">possible_sdns</span><span
152
- class="method-args">(name_array, use_ors = false)</span>
153
-
154
- <span class="method-click-advice">click to toggle source</span>
155
-
156
- </div>
157
-
158
-
159
- <div class="method-description">
160
-
161
-
162
-
163
-
164
-
165
-
166
- <div class="method-source-code" id="possible_sdns-source">
167
- <pre><span class="ruby-comment"># File lib/ofac/models/ofac_sdn.rb, line 5</span>
168
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">possible_sdns</span>(<span class="ruby-identifier">name_array</span>, <span class="ruby-identifier">use_ors</span> = <span class="ruby-keyword">false</span>)
169
- <span class="ruby-identifier">name_conditions</span> = []
170
- <span class="ruby-identifier">alt_name_conditions</span> = []
171
- <span class="ruby-identifier">values</span> = []
172
- <span class="ruby-identifier">name_array</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">partial_name</span><span class="ruby-operator">|</span>
173
- <span class="ruby-identifier">name_conditions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;(lower(name) like ?)&#39;</span>
174
- <span class="ruby-identifier">alt_name_conditions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&#39;(lower(alternate_identity_name) like ?)&#39;</span>
175
- <span class="ruby-identifier">values</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;%#{partial_name.downcase}%&quot;</span>
176
- <span class="ruby-keyword">end</span>
177
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">use_ors</span>
178
- <span class="ruby-identifier">conditions</span> = (<span class="ruby-identifier">name_conditions</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">alt_name_conditions</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; or &#39;</span>)
179
- <span class="ruby-keyword">else</span>
180
- <span class="ruby-identifier">name_conditions</span> = <span class="ruby-identifier">name_conditions</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; and &#39;</span>)
181
- <span class="ruby-identifier">alt_name_conditions</span> = <span class="ruby-identifier">alt_name_conditions</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; and &#39;</span>)
182
- <span class="ruby-identifier">conditions</span> = <span class="ruby-node">&quot;(#{name_conditions}) or (#{alt_name_conditions})&quot;</span>
183
- <span class="ruby-keyword">end</span>
184
- <span class="ruby-comment"># we need the values in there twice, once for the names and once for the alt_names</span>
185
- <span class="ruby-constant">OfacSdn</span>.<span class="ruby-identifier">select</span>([<span class="ruby-value">:name</span>, <span class="ruby-value">:alternate_identity_name</span>, <span class="ruby-value">:address</span>, <span class="ruby-value">:city</span>]).<span class="ruby-identifier">where</span>(<span class="ruby-identifier">sdn_type</span><span class="ruby-operator">:</span> <span class="ruby-string">&#39;individual&#39;</span>).<span class="ruby-identifier">where</span>(<span class="ruby-identifier">conditions</span>, <span class="ruby-operator">*</span>(<span class="ruby-identifier">values</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span>))
186
- <span class="ruby-keyword">end</span></pre>
187
- </div><!-- possible_sdns-source -->
188
-
189
- </div>
190
-
191
-
192
-
193
-
194
- </div><!-- possible_sdns-method -->
195
-
196
-
197
- </section><!-- public-class-method-details -->
198
-
199
- </section><!-- 5Buntitled-5D -->
200
-
201
- </div><!-- documentation -->
202
-
203
-
204
- <footer id="validator-badges">
205
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
206
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
207
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
208
- </footer>
209
-
@@ -1,238 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class OfacSdnLoader - ofac 2.0.1</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
-
47
-
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/ofac/models/ofac_sdn_loader.rb
53
- </ul>
54
- </nav>
55
-
56
-
57
- </div>
58
-
59
- <div id="class-metadata">
60
-
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
63
-
64
- <p class="link">Object
65
-
66
- </nav>
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <nav id="method-list-section" class="section">
72
- <h3 class="section-header">Methods</h3>
73
-
74
- <ul class="link-list">
75
-
76
- <li ><a href="#method-c-load_current_sdn_file">::load_current_sdn_file</a>
77
-
78
- </ul>
79
- </nav>
80
-
81
- </div>
82
-
83
- <div id="project-metadata">
84
- <nav id="fileindex-section" class="section project-section">
85
- <h3 class="section-header">Pages</h3>
86
-
87
- <ul>
88
-
89
- <li class="file"><a href="./README_rdoc.html">README</a>
90
-
91
- </ul>
92
- </nav>
93
-
94
- <nav id="classindex-section" class="section project-section">
95
- <h3 class="section-header">Class and Module Index</h3>
96
-
97
- <ul class="link-list">
98
-
99
- <li><a href="./CreateOfacSdns.html">CreateOfacSdns</a>
100
-
101
- <li><a href="./Ofac.html">Ofac</a>
102
-
103
- <li><a href="./OfacMatch.html">OfacMatch</a>
104
-
105
- <li><a href="./OfacMigration.html">OfacMigration</a>
106
-
107
- <li><a href="./OfacMigration/Generators.html">OfacMigration::Generators</a>
108
-
109
- <li><a href="./OfacMigration/Generators/BuildGenerator.html">OfacMigration::Generators::BuildGenerator</a>
110
-
111
- <li><a href="./OfacSdn.html">OfacSdn</a>
112
-
113
- <li><a href="./OfacSdnLoader.html">OfacSdnLoader</a>
114
-
115
- <li><a href="./String.html">String</a>
116
-
117
- </ul>
118
- </nav>
119
-
120
- </div>
121
- </nav>
122
-
123
- <div id="documentation">
124
- <h1 class="class">class OfacSdnLoader</h1>
125
-
126
- <div id="description" class="description">
127
-
128
- </div><!-- description -->
129
-
130
-
131
-
132
-
133
- <section id="5Buntitled-5D" class="documentation-section">
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
- <!-- Methods -->
143
-
144
- <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
145
- <h3 class="section-header">Public Class Methods</h3>
146
-
147
-
148
- <div id="method-c-load_current_sdn_file" class="method-detail ">
149
-
150
- <div class="method-heading">
151
- <span class="method-name">load_current_sdn_file</span><span
152
- class="method-args">() { |"Downloading OFAC data from http://treas.gov/offices/enforcement/ofac/sdn"| ... }</span>
153
-
154
- <span class="method-click-advice">click to toggle source</span>
155
-
156
- </div>
157
-
158
-
159
- <div class="method-description">
160
-
161
- <p>Loads the most recent file from <a
162
- href="http://www.treas.gov/offices/enforcement/ofac/sdn/delimit/index.shtml">www.treas.gov/offices/enforcement/ofac/sdn/delimit/index.shtml</a></p>
163
-
164
-
165
-
166
-
167
- <div class="method-source-code" id="load_current_sdn_file-source">
168
- <pre><span class="ruby-comment"># File lib/ofac/models/ofac_sdn_loader.rb, line 18</span>
169
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_current_sdn_file</span>
170
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Reloading OFAC sdn data&quot;</span>
171
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Downloading OFAC data from http://www.treas.gov/offices/enforcement/ofac/sdn&quot;</span>
172
- <span class="ruby-keyword">yield</span> <span class="ruby-string">&quot;Downloading OFAC data from http://www.treas.gov/offices/enforcement/ofac/sdn&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
173
- <span class="ruby-comment">#get the 3 data files</span>
174
- <span class="ruby-identifier">sdn</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;sdn&#39;</span>)
175
- <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&#39;http://www.treasury.gov/ofac/downloads/sdn.pip&#39;</span>)
176
-
177
- <span class="ruby-identifier">proxy_addr</span>, <span class="ruby-identifier">proxy_port</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;http_proxy&#39;</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&quot;http://&quot;</span>, <span class="ruby-string">&quot;&quot;</span>).<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/:/</span>) <span class="ruby-keyword">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;http_proxy&#39;</span>]
178
-
179
- <span class="ruby-identifier">bytes</span> = <span class="ruby-identifier">sdn</span>.<span class="ruby-identifier">write</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">Proxy</span>(<span class="ruby-identifier">proxy_addr</span>, <span class="ruby-identifier">proxy_port</span>).<span class="ruby-identifier">get</span>(<span class="ruby-identifier">uri</span>))
180
- <span class="ruby-identifier">sdn</span>.<span class="ruby-identifier">rewind</span>
181
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">bytes</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">convert_line_to_array</span>(<span class="ruby-identifier">sdn</span>.<span class="ruby-identifier">readline</span>).<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">12</span>
182
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Trouble downloading file. The url may have changed.&quot;</span>
183
- <span class="ruby-keyword">yield</span> <span class="ruby-string">&quot;Trouble downloading file. The url may have changed.&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
184
- <span class="ruby-keyword">return</span>
185
- <span class="ruby-keyword">else</span>
186
- <span class="ruby-identifier">sdn</span>.<span class="ruby-identifier">rewind</span>
187
- <span class="ruby-keyword">end</span>
188
- <span class="ruby-identifier">address</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;sdn&#39;</span>)
189
- <span class="ruby-identifier">address</span>.<span class="ruby-identifier">write</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">Proxy</span>(<span class="ruby-identifier">proxy_addr</span>, <span class="ruby-identifier">proxy_port</span>).<span class="ruby-identifier">get</span>(<span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&#39;http://www.treasury.gov/ofac/downloads/add.pip&#39;</span>)))
190
- <span class="ruby-identifier">address</span>.<span class="ruby-identifier">rewind</span>
191
- <span class="ruby-identifier">alt</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;sdn&#39;</span>)
192
- <span class="ruby-identifier">alt</span>.<span class="ruby-identifier">write</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">Proxy</span>(<span class="ruby-identifier">proxy_addr</span>, <span class="ruby-identifier">proxy_port</span>).<span class="ruby-identifier">get</span>(<span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">&#39;http://www.treasury.gov/ofac/downloads/alt.pip&#39;</span>)))
193
- <span class="ruby-identifier">alt</span>.<span class="ruby-identifier">rewind</span>
194
-
195
- <span class="ruby-keyword">if</span> <span class="ruby-constant">OfacSdn</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">OfacSdn</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>)
196
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;Converting file to csv format for Mysql import. This could take several minutes.&quot;</span>
197
- <span class="ruby-keyword">yield</span> <span class="ruby-string">&quot;Converting file to csv format for Mysql import. This could take several minutes.&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
198
-
199
- <span class="ruby-identifier">csv_file</span> = <span class="ruby-identifier">convert_to_flattened_csv</span>(<span class="ruby-identifier">sdn</span>, <span class="ruby-identifier">address</span>, <span class="ruby-identifier">alt</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">status</span><span class="ruby-operator">|</span>
200
- <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>
201
- <span class="ruby-keyword">end</span>
202
-
203
- <span class="ruby-identifier">bulk_mysql_update</span>(<span class="ruby-identifier">csv_file</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">status</span><span class="ruby-operator">|</span>
204
- <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>
205
- <span class="ruby-keyword">end</span>
206
- <span class="ruby-keyword">else</span>
207
- <span class="ruby-identifier">active_record_file_load</span>(<span class="ruby-identifier">sdn</span>, <span class="ruby-identifier">address</span>, <span class="ruby-identifier">alt</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">status</span><span class="ruby-operator">|</span>
208
- <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>
209
- <span class="ruby-keyword">end</span>
210
- <span class="ruby-keyword">end</span>
211
-
212
- <span class="ruby-identifier">sdn</span>.<span class="ruby-identifier">close</span>
213
- <span class="ruby-ivar">@address</span>.<span class="ruby-identifier">close</span>
214
- <span class="ruby-ivar">@alt</span>.<span class="ruby-identifier">close</span>
215
- <span class="ruby-keyword">end</span></pre>
216
- </div><!-- load_current_sdn_file-source -->
217
-
218
- </div>
219
-
220
-
221
-
222
-
223
- </div><!-- load_current_sdn_file-method -->
224
-
225
-
226
- </section><!-- public-class-method-details -->
227
-
228
- </section><!-- 5Buntitled-5D -->
229
-
230
- </div><!-- documentation -->
231
-
232
-
233
- <footer id="validator-badges">
234
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
235
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
236
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
237
- </footer>
238
-
@@ -1,323 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>README - ofac 2.0.1</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
-
47
- <div id="table-of-contents">
48
- <nav class="section">
49
- <h3 class="section-header">Table of Contents</h3>
50
- <ul>
51
- <li><a href="#label-ofac">ofac</a>
52
- <li><a href="#label-DESCRIPTION%3A">DESCRIPTION:</a>
53
- <li><a href="#label-FEATURES%3A">FEATURES:</a>
54
- <li><a href="#label-SYNOPSIS%3A">SYNOPSIS:</a>
55
- <li><a href="#label-REQUIREMENTS%3A">REQUIREMENTS:</a>
56
- <li><a href="#label-INSTALL%3A">INSTALL:</a>
57
- <li><a href="#label-Rails+2.0+-+use+version+1.3.2+or+earlier">Rails 2.0 - use version 1.3.2 or earlier</a>
58
- <li><a href="#label-Rails+3.0+%26+4.0">Rails 3.0 &amp; 4.0</a>
59
- <li><a href="#label-Add+the+gem+to+your+Gemfile%3A">Add the gem to your Gemfile:</a>
60
- <li><a href="#label-Run+the+Bundler+install+command">Run the Bundler install command</a>
61
- <li><a href="#label-Copyright">Copyright</a>
62
- </ul>
63
- </nav>
64
- </div>
65
-
66
-
67
- <div id="project-metadata">
68
- <nav id="fileindex-section" class="section project-section">
69
- <h3 class="section-header">Pages</h3>
70
-
71
- <ul>
72
-
73
- <li class="file"><a href="./README_rdoc.html">README</a>
74
-
75
- </ul>
76
- </nav>
77
-
78
- <nav id="classindex-section" class="section project-section">
79
- <h3 class="section-header">Class and Module Index</h3>
80
-
81
- <ul class="link-list">
82
-
83
- <li><a href="./CreateOfacSdns.html">CreateOfacSdns</a>
84
-
85
- <li><a href="./Ofac.html">Ofac</a>
86
-
87
- <li><a href="./OfacMatch.html">OfacMatch</a>
88
-
89
- <li><a href="./OfacMigration.html">OfacMigration</a>
90
-
91
- <li><a href="./OfacMigration/Generators.html">OfacMigration::Generators</a>
92
-
93
- <li><a href="./OfacMigration/Generators/BuildGenerator.html">OfacMigration::Generators::BuildGenerator</a>
94
-
95
- <li><a href="./OfacSdn.html">OfacSdn</a>
96
-
97
- <li><a href="./OfacSdnLoader.html">OfacSdnLoader</a>
98
-
99
- <li><a href="./String.html">String</a>
100
-
101
- </ul>
102
- </nav>
103
-
104
- </div>
105
- </nav>
106
-
107
- <div id="documentation" class="description">
108
-
109
- <h1 id="label-ofac">ofac<span><a href="#label-ofac">&para;</a> <a href="#documentation">&uarr;</a></span></h1>
110
- <ul><li>
111
- <p><a href="http://kevintyll.github.com/ofac">kevintyll.github.com/ofac</a></p>
112
- </li><li>
113
- <p><a href="http://www.drexel-labs.com">www.drexel-labs.com</a></p>
114
- </li><li>
115
- <p><a
116
- href="http://www.treas.gov/offices/enforcement/ofac/sdn/index.shtml">www.treas.gov/offices/enforcement/ofac/sdn/index.shtml</a></p>
117
- </li></ul>
118
-
119
- <h2 id="label-DESCRIPTION%3A">DESCRIPTION:<span><a href="#label-DESCRIPTION%3A">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
120
-
121
- <p>ofac is a ruby gem that tries to find a match of a person&#39;s name and
122
- address against the Office of Foreign Assets Control&#39;s Specially
123
- Designated Nationals list…the so called terrorist watch list.</p>
124
-
125
- <p>This gem, like the ssn_validator gem, started as a need for the company I
126
- work for, Clarity Services Inc. We decided once again to create a gem out
127
- of it and share it with the community. Much thanks goes to the management
128
- at Clarity Services Inc. for allowing this code to be open sourced. Thanks
129
- also to Larry Berland at Clarity Services Inc. The matching logic in the
130
- ofac_match.rb file was derived from his work.</p>
131
-
132
- <h2 id="label-FEATURES%3A">FEATURES:<span><a href="#label-FEATURES%3A">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
133
-
134
- <p>Creates a score, 1 - 100, based on how well the name, address and city
135
- match the data on the SDN list. Since we have to match on strings, the
136
- likely hood of an exact match are virtually nil. So we&#39;ve created an
137
- algorithm that creates a score. The better the match, the higher the
138
- score. A score of 100 would be a perfect match.</p>
139
-
140
- <p>The score is calculated by adding up the weightings of each part that is
141
- matched. So if only name is matched, then the max score is the weight for
142
- <code>:name</code> which is 60</p>
143
-
144
- <p>It&#39;s possible to get partial matches, which will add partial weight to
145
- the score. If there is not a match on the element as it is passed in, then
146
- each word element gets broken down and matches are tried on each partial
147
- element. The weighting is distrubuted equally for each partial that is
148
- matched.</p>
149
-
150
- <p>If exact matches are not made, then a sounds like match is attempted. Any
151
- match made by sounds like is given 75% of it&#39;s weight to the score.
152
- Example:</p>
153
-
154
- <p>If you are trying to match the name Kevin Tyll and there is a record for
155
- Smith, Kevin in the database, then we will try to match both Kevin and Tyll
156
- separately, with each element Smith and Kevin. Since only Kevin will find
157
- a match, and there were 2 elements in the searched name, the score will be
158
- added by half the weighting for <code>:name</code>. So since the weight
159
- for <code>:name</code> is 60, then we will add 30 to the score.</p>
160
-
161
- <p>If you are trying to match the name Kevin Gregory Tyll and there is a
162
- record for Tyll, Kevin in the database, then we will try to match Kevin and
163
- Gregory and Tyll separately, with each element Tyll and Kevin. Since both
164
- Kevin and Tyll will find a match, and there were 3 elements in the searched
165
- name, the score will be added by 2/3 the weighting for <code>:name</code>.
166
- So since the weight for <code>:name</code> is 60, then we will add 40 to
167
- the score.</p>
168
-
169
- <p>If you are trying to match the name Kevin Tyll and there is a record for
170
- Kevin Gregory Tyll in the database, then we will try to match Kevin and
171
- Tyll separately, with each element Tyll and Kevin and Gregory. Since both
172
- Kevin and Tyll will find a match, and there were 2 elements in the searched
173
- name, the score will be added by 2/2 the weighting for <code>:name</code>.
174
- So since the weight for <code>:name</code> is 60, then we will add 60 to
175
- the score.</p>
176
-
177
- <p>If you are trying to match the name Kevin Tyll, and there is a record for
178
- Teel, Kevin in the database, then an exact match will be found for Kevin,
179
- and a sounds like match will be made for Tyll. Since there were 2 elements
180
- in the searched name, and the weight for <code>:name</code> is 60, then
181
- each element is worth 30. Since Kevin was an exact match, it will add 30,
182
- and since Tyll was a sounds like match, it will add 30 * .75. So the
183
- <code>:name</code> portion of the search will be worth 53.</p>
184
-
185
- <p>If data is in the database for city and or address, and you pass data in
186
- for these elements, the score will be reduced by 10% of the weight if there
187
- is no match or sounds like match. So if you get a match on name,
188
- you&#39;ve already got a score of 60. So if you don&#39;t pass in an
189
- address or city, or if you do, but there is no city or address info in the
190
- database, then your final score will be 60. But if you do pass in a city,
191
- say Tampa, and the city in the Database is New York, then we will deduct
192
- 10% of the weight (30 * .1) = 3 from the score since 30 is the weight for
193
- <code>:city</code>. So the final score will be 57.</p>
194
-
195
- <p>If were searching for New York, and the database had New Deli, then there
196
- would be a match on New, but not on Deli. Since there were 2 elements in
197
- the searched city, each hit is worth 15. So the match on New would add 15,
198
- but the non-match on York would subtract (15 * .1) = 1.5 from the score.
199
- So the score would be (60 + 15 - 1.5) = 74, due to rounding.</p>
200
-
201
- <p>Only <code>:city</code> and <code>:address</code> subtract from the score,
202
- No match on name simply returns 0.</p>
203
-
204
- <p>Matches for name are made for both the name and any aliases in the OFAC
205
- database.</p>
206
-
207
- <p>Matches for <code>:city</code> and <code>:address</code> will only be added
208
- to the score if there is first a match on <code>:name</code>.</p>
209
-
210
- <p>We consider a score of 60 to be reasonable as a hit.</p>
211
-
212
- <h2 id="label-SYNOPSIS%3A">SYNOPSIS:<span><a href="#label-SYNOPSIS%3A">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
213
-
214
- <p>Accepts a hash with the identity&#39;s demographic information</p>
215
-
216
- <pre class="ruby"><span class="ruby-constant">Ofac</span>.<span class="ruby-identifier">new</span>({:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Oscar Hernandez&#39;</span>, :<span class="ruby-identifier">city</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Clearwater&#39;</span>, :<span class="ruby-identifier">address</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;123 somewhere ln&#39;</span>})
217
- </pre>
218
-
219
- <p><code>:name</code> is required to get a score. If <code>:name</code> is
220
- missing, an error will not be thrown, but a score of 0 will be returned.</p>
221
-
222
- <p>The more information provided, the higher the score could be. A score of
223
- 100 would mean all fields were passed in, and all fields were 100% matches.
224
- If only the name is passed in without an address, it will be impossible to
225
- get a score of 100, even if the name matches perfectly.</p>
226
-
227
- <p>Acceptable hash keys and their weighting in score calculation:</p>
228
- <ul><li>
229
- <p><code>:name</code> (weighting = 60%) (required) This can be a person,
230
- business, or marine vessel</p>
231
- </li><li>
232
- <p><code>:address</code> (weighting = 10%)</p>
233
- </li><li>
234
- <p><code>:city</code> (weighting = 30%)</p>
235
- </li><li>
236
- <p>Instantiate the object with the identity&#39;s name, street address, and
237
- city.</p>
238
-
239
- <pre class="ruby"><span class="ruby-identifier">ofac</span> = <span class="ruby-constant">Ofac</span>.<span class="ruby-identifier">new</span>(:<span class="ruby-identifier">name</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Kevin Tyll&#39;</span>, :<span class="ruby-identifier">city</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;Clearwater&#39;</span>, :<span class="ruby-identifier">address</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;123 Somewhere Ln.&#39;</span>)
240
- </pre>
241
- </li><li>
242
- <p>Then get the score</p>
243
-
244
- <pre class="ruby"><span class="ruby-identifier">ofac</span>.<span class="ruby-identifier">score</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">score</span> <span class="ruby-value">1</span> <span class="ruby-operator">-</span> <span class="ruby-value">100</span>
245
- </pre>
246
- </li><li>
247
- <p>You can also get the list of all the partial matches with the score of each
248
- record.</p>
249
-
250
- <pre class="ruby"><span class="ruby-identifier">ofac</span>.<span class="ruby-identifier">possible_hits</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">returns</span> <span class="ruby-identifier">an</span> <span class="ruby-identifier">array</span> <span class="ruby-identifier">of</span> <span class="ruby-identifier">hashes</span>.
251
- </pre>
252
- </li></ul>
253
-
254
- <h2 id="label-REQUIREMENTS%3A">REQUIREMENTS:<span><a href="#label-REQUIREMENTS%3A">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
255
- <ul><li>
256
- <p>Rails 2.0.0 or greater</p>
257
- </li></ul>
258
-
259
- <h2 id="label-INSTALL%3A">INSTALL:<span><a href="#label-INSTALL%3A">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
260
-
261
- <h4 id="label-Rails+2.0+-+use+version+1.3.2+or+earlier">Rails 2.0 - use version 1.3.2 or earlier<span><a href="#label-Rails+2.0+-+use+version+1.3.2+or+earlier">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
262
- <ul><li>
263
- <p>To install the gem:</p>
264
-
265
- <pre>sudo gem install kevintyll-ofac</pre>
266
- </li><li>
267
- <p>To create the necessary db migration, from the command line, run:</p>
268
-
269
- <pre>script/generate ofac_migration</pre>
270
- </li><li>
271
- <p>Require the gem in your environment.rb file in the Rails::Initializer
272
- block:</p>
273
-
274
- <pre class="ruby"><span class="ruby-identifier">config</span>.<span class="ruby-identifier">gem</span> <span class="ruby-string">&#39;kevintyll-ofac&#39;</span>, :<span class="ruby-identifier">lib</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&#39;ofac&#39;</span>
275
- </pre>
276
- </li><li>
277
- <p>To load your table with the current OFAC data, from the command line, run:</p>
278
-
279
- <pre>rake ofac:update_data
280
-
281
- * The OFAC data is not updated with any regularity, but you can sign up for email notifications when the data changes at
282
- http://www.treas.gov/offices/enforcement/ofac/sdn/index.shtml.</pre>
283
- </li></ul>
284
-
285
- <h4 id="label-Rails+3.0+%26+4.0">Rails 3.0 &amp; 4.0<span><a href="#label-Rails+3.0+%26+4.0">&para;</a> <a href="#documentation">&uarr;</a></span></h4>
286
- <ul><li>
287
- <p>To create the necessary db migration, from the command line, run:</p>
288
-
289
- <pre>rails generate ofac_migration:build</pre>
290
- </li><li>
291
- <p>To add the gem to your Rails project:</p>
292
- </li></ul>
293
-
294
- <h5 id="label-Add+the+gem+to+your+Gemfile%3A">Add the gem to your Gemfile:<span><a href="#label-Add+the+gem+to+your+Gemfile%3A">&para;</a> <a href="#documentation">&uarr;</a></span></h5>
295
-
296
- <pre>gem &quot;ofac&quot;, &quot;~&gt; 2.0.0&quot;</pre>
297
-
298
- <h5 id="label-Run+the+Bundler+install+command">Run the Bundler install command<span><a href="#label-Run+the+Bundler+install+command">&para;</a> <a href="#documentation">&uarr;</a></span></h5>
299
-
300
- <pre>bundle install</pre>
301
- <ul><li>
302
- <p>To load your table with the current OFAC data, from the command line, run:</p>
303
-
304
- <pre>rake ofac:update_data
305
-
306
- * The OFAC data is not updated with any regularity, but you can sign up for email notifications when the data changes at
307
- http://www.treas.gov/offices/enforcement/ofac/sdn/index.shtml.</pre>
308
- </li></ul>
309
-
310
- <h2 id="label-Copyright">Copyright<span><a href="#label-Copyright">&para;</a> <a href="#documentation">&uarr;</a></span></h2>
311
-
312
- <p>Copyright © 2009-2013 Kevin Tyll. See LICENSE for details.</p>
313
-
314
- </div>
315
-
316
-
317
-
318
- <footer id="validator-badges">
319
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
320
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
321
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
322
- </footer>
323
-