apralib 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/lib/apralib/grantee.rb +7 -3
- data/lib/apralib/version.rb +1 -1
- data/spec/lib/grantee_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e1c3d9ef8c6aa739c7be8d71899aedda2282086
|
4
|
+
data.tar.gz: d953aab95c39d1f878c069d01abfaba639b2d821
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaf017863402a9d98e217dbf68058f422fbad6aa4f9e240d1021c77c683c44cbf7ac33dba80c44eb110adf7bd455631384b5b1c7dd4ea05050865d54f56007eb
|
7
|
+
data.tar.gz: b3fc8bbf5d3c8ff312698df6cbfb62a0b346cf4078f454bb290302201d2ac8e52b7542f2a2f499430ef5d40e1bcc358568a0c7237c8282218c2effccf8ac6acb
|
data/lib/apralib/grantee.rb
CHANGED
@@ -3,7 +3,7 @@ module ApraService
|
|
3
3
|
class Grantee
|
4
4
|
|
5
5
|
SSN_REGEX = /(\d{6})([-+A])(\d{3})([0-9ABCDEFHJKLMNPRSTUVWXY])/
|
6
|
-
CHECK_DIGITS = %w(0 1 2 3 4 5 6 7 8 9 A B C D E F H J K L M N P R S T U V X Y)
|
6
|
+
CHECK_DIGITS = %w(0 1 2 3 4 5 6 7 8 9 A B C D E F H J K L M N P R S T U V W X Y)
|
7
7
|
|
8
8
|
attr_accessor :first_names, :last_name, :ssn, :address, :zip
|
9
9
|
|
@@ -34,8 +34,12 @@ module ApraService
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def ssn=(ssn)
|
37
|
-
|
38
|
-
|
37
|
+
if ssn
|
38
|
+
Grantee.verify_ssn!(ssn.upcase)
|
39
|
+
self.instance_variable_set('@ssn', ssn.upcase)
|
40
|
+
else
|
41
|
+
self.instance_variable_set('@ssn', nil)
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
45
|
def self.verify_ssn!(ssn)
|
data/lib/apralib/version.rb
CHANGED
data/spec/lib/grantee_spec.rb
CHANGED
@@ -22,6 +22,28 @@ module ApraService
|
|
22
22
|
|
23
23
|
end
|
24
24
|
|
25
|
+
describe 'ssn=' do
|
26
|
+
|
27
|
+
it 'should convert the code to uppercase' do
|
28
|
+
|
29
|
+
grantee = Grantee.new
|
30
|
+
grantee.ssn = '111111-111c'
|
31
|
+
expect(grantee.ssn).to eq('111111-111C')
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should set the value to nil when passed a nil value' do
|
36
|
+
|
37
|
+
grantee = Grantee.new
|
38
|
+
grantee.ssn = '111111-111C'
|
39
|
+
grantee.ssn = nil
|
40
|
+
expect(grantee.ssn).to be_nil
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
end
|
46
|
+
|
25
47
|
end
|
26
48
|
|
27
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apralib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Sandrini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|