kevintyll-ofac 1.1.6 → 1.1.7
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/History.txt +6 -1
- data/VERSION.yml +1 -1
- data/lib/ofac/models/ofac.rb +2 -2
- data/test/ofac_test.rb +12 -0
- metadata +2 -2
data/History.txt
CHANGED
@@ -38,4 +38,9 @@
|
|
38
38
|
== 1.1.6 2009-06-29
|
39
39
|
|
40
40
|
* 1 minor enhancement:
|
41
|
-
* Allow passing of first and last name seperately...to improve performance.
|
41
|
+
* Allow passing of first and last name seperately...to improve performance.
|
42
|
+
|
43
|
+
== 1.1.7 2009-06-30
|
44
|
+
|
45
|
+
* 1 bug fix:
|
46
|
+
* fixed error when passing a nil value into the new :first_name or :last_name hash values when initializing the Ofac object.
|
data/VERSION.yml
CHANGED
data/lib/ofac/models/ofac.rb
CHANGED
@@ -112,13 +112,13 @@ class Ofac
|
|
112
112
|
|
113
113
|
#you can pass in a full name, or specify the first and last name
|
114
114
|
if @identity[:name].kind_of?(Hash)
|
115
|
-
name_array = [@identity[:name][:first_name],@identity[:name][:last_name]]
|
115
|
+
name_array = [@identity[:name][:first_name],@identity[:name][:last_name]].compact
|
116
116
|
else
|
117
117
|
partial_name = @identity[:name].gsub(/\W/,'|')
|
118
118
|
name_array = partial_name.split('|')
|
119
119
|
end
|
120
120
|
|
121
|
-
name_array.delete_if{|n| n.size < 2}
|
121
|
+
name_array.delete_if{|n| n.strip.size < 2}
|
122
122
|
unless name_array.empty?
|
123
123
|
sql_name_partial = name_array.collect {|partial_name| "name like '%#{partial_name}%'"}.join(' or ')
|
124
124
|
sql_alt_name_partial = name_array.collect {|partial_name| "alternate_identity_name like '%#{partial_name}%'"}.join(' or ')
|
data/test/ofac_test.rb
CHANGED
@@ -12,6 +12,9 @@ class OfacTest < Test::Unit::TestCase
|
|
12
12
|
assert_equal 0, Ofac.new({:address => '123 somewhere'}).score
|
13
13
|
assert_equal 0, Ofac.new({:name => ''}).score
|
14
14
|
assert_equal 0, Ofac.new({:name => ' '}).score
|
15
|
+
assert_equal 0, Ofac.new({:name => nil}).score
|
16
|
+
assert_equal 0, Ofac.new({:name => {:first_name => '',:last_name => ' '}}).score
|
17
|
+
assert_equal 0, Ofac.new({:name => {:first_name => '',:last_name => ' '}}).score
|
15
18
|
assert_equal 0, Ofac.new({:name => 'P T'}).score
|
16
19
|
end
|
17
20
|
|
@@ -33,6 +36,15 @@ class OfacTest < Test::Unit::TestCase
|
|
33
36
|
assert_equal 30, Ofac.new({:name => {:first_name => 'Oscar', :last_name => 'de la Hernandez'}}).score
|
34
37
|
end
|
35
38
|
|
39
|
+
should "handle first or last name not given" do
|
40
|
+
assert_equal 60, Ofac.new({:name => {:first_name => 'Oscar', :last_name => ''}}).score
|
41
|
+
assert_equal 60, Ofac.new({:name => {:first_name => 'Oscar', :last_name => nil}}).score
|
42
|
+
assert_equal 60, Ofac.new({:name => {:first_name => nil, :last_name => 'Oscar'}}).score
|
43
|
+
assert_equal 60, Ofac.new({:name => {:first_name => 'Oscar'}}).score
|
44
|
+
assert_equal 60, Ofac.new({:name => {:first_name => '', :last_name => 'Oscar'}}).score
|
45
|
+
assert_equal 60, Ofac.new({:name => {:last_name => 'Oscar'}}).score
|
46
|
+
end
|
47
|
+
|
36
48
|
should "deduct scores for non matches on address and city if data is in the database" do
|
37
49
|
#if there is data for address or city in the database, and that info is passed in, then 10%
|
38
50
|
#of the weight will be deducted if there is not match or sounds like match
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kevintyll-ofac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Tyll
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|