metro_2 1.2.4 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -11
- data/CHANGELOG.md +10 -0
- data/Repositoryowner.md +4 -0
- data/lib/metro_2/records/base_segment.rb +9 -0
- data/lib/metro_2/records/j2_segment.rb +29 -0
- data/lib/metro_2/version.rb +1 -1
- data/lib/metro_2.rb +9 -3
- data/spec/records/base_segment_spec.rb +25 -0
- data/spec/records/j2_segment_spec.rb +53 -0
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33d09451de186d977c60654d332ab9831e0979d53ab1a7b5beba96df3a8a76c6
|
4
|
+
data.tar.gz: b42db26ee9811cb5f61b97e99380a0e454f8afa7ea1f6d83418076fb0dd410fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd3ef594e3e4c01dd6421aefd0604c37778ac37afc0f14805d194d70f60f81db1a541df211854e4cd3623f646137b5e03ac65d5741d55bd8e3bf944144fc6d8d
|
7
|
+
data.tar.gz: 8c73316d2270919e12eee6687f4a7544cd896b636460c3c463bb929e26d503e1104be35492f1b8d6010d6af1db39ea41cf2baf262257d18be78c2f182daac874
|
data/.rubocop.yml
CHANGED
@@ -1,12 +1,4 @@
|
|
1
|
-
|
2
|
-
# configuration file. It makes it possible to enable/disable
|
3
|
-
# certain cops (checks) and to alter their behavior if they accept
|
4
|
-
# any parameters. The file can be placed either in your home
|
5
|
-
# directory or in some project directory.
|
6
|
-
#
|
7
|
-
# RuboCop will start looking for the configuration file in the directory
|
8
|
-
# where the inspected file is and continue its way up to the root directory.
|
9
|
-
#
|
10
|
-
# See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
|
1
|
+
---
|
11
2
|
Layout/LineLength:
|
12
|
-
Max:
|
3
|
+
Max: 120
|
4
|
+
Description: Limit lines to 120 characters
|
data/CHANGELOG.md
ADDED
data/Repositoryowner.md
ADDED
@@ -61,11 +61,20 @@ module Metro2::Records
|
|
61
61
|
@k2_segment
|
62
62
|
end
|
63
63
|
|
64
|
+
def j2_segment
|
65
|
+
@j2_segment
|
66
|
+
end
|
67
|
+
|
64
68
|
def k2_segment=(segment)
|
65
69
|
@k2_segment = segment
|
66
70
|
@appendages << @k2_segment
|
67
71
|
end
|
68
72
|
|
73
|
+
def j2_segment=(segment)
|
74
|
+
@j2_segment = segment
|
75
|
+
@appendages << @j2_segment
|
76
|
+
end
|
77
|
+
|
69
78
|
def to_metro2
|
70
79
|
@appendages.compact!
|
71
80
|
set_record_descriptor_word
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Metro2::Records
|
2
|
+
class J2Segment < Record
|
3
|
+
LENGTH = 200
|
4
|
+
|
5
|
+
@fields = []
|
6
|
+
|
7
|
+
alphanumeric_const_field :segment_identifier, 2, "J2"
|
8
|
+
alphanumeric_const_field :reserved, 1, nil # reserved - blank fill
|
9
|
+
alphanumeric_field :surname, 25, Metro2::ALPHANUMERIC_PLUS_DASH
|
10
|
+
alphanumeric_field :first_name, 20, Metro2::ALPHANUMERIC_PLUS_DASH
|
11
|
+
alphanumeric_field :middle_name, 20, Metro2::ALPHANUMERIC_PLUS_DASH
|
12
|
+
alphanumeric_field :generation_code, 1
|
13
|
+
numeric_field :social_security_number, 9
|
14
|
+
date_field :date_of_birth
|
15
|
+
numeric_field :telephone_number, 10
|
16
|
+
alphanumeric_field :ecoa_code, 1
|
17
|
+
alphanumeric_field :consumer_information_indicator, 2
|
18
|
+
alphanumeric_field :country_code, 2
|
19
|
+
alphanumeric_field :address_1, 32, Metro2::ALPHANUMERIC_PLUS_DOT_DASH_SLASH
|
20
|
+
alphanumeric_field :address_2, 32, Metro2::ALPHANUMERIC_PLUS_DOT_DASH_SLASH
|
21
|
+
alphanumeric_field :city, 20, Metro2::ALPHANUMERIC_PLUS_DOT_DASH_SLASH
|
22
|
+
alphanumeric_field :state, 2
|
23
|
+
alphanumeric_field :postal_code, 9
|
24
|
+
alphanumeric_field :address_indicator, 1
|
25
|
+
alphanumeric_field :residence_code, 1
|
26
|
+
alphanumeric_const_field :reserved2, 2, nil # reserved - blank fill
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/lib/metro_2/version.rb
CHANGED
data/lib/metro_2.rb
CHANGED
@@ -14,14 +14,17 @@ module Metro2
|
|
14
14
|
ACCOUNT_TYPE = {
|
15
15
|
auto: '00',
|
16
16
|
unsecured: '01',
|
17
|
-
education: '12'
|
17
|
+
education: '12',
|
18
|
+
business_individual_personally_liable: '10'
|
18
19
|
# TODO: add other account types
|
19
20
|
}.freeze
|
20
21
|
|
21
22
|
ECOA_CODE = {
|
22
23
|
individual: '1',
|
23
24
|
deceased: 'X',
|
24
|
-
delete: 'Z'
|
25
|
+
delete: 'Z',
|
26
|
+
comaker_or_guarantor: '5',
|
27
|
+
business: 'W'
|
25
28
|
# TODO: add other ECOA codes
|
26
29
|
}.freeze
|
27
30
|
|
@@ -170,7 +173,10 @@ module Metro2
|
|
170
173
|
withdrawn_ch7: 'M',
|
171
174
|
withdrawn_ch11: 'N',
|
172
175
|
withdrawn_ch12: 'O',
|
173
|
-
withdrawn_ch13: 'P'
|
176
|
+
withdrawn_ch13: 'P',
|
177
|
+
dismissed: 'Q',
|
178
|
+
reaffirmed: 'R',
|
179
|
+
reaffirmation_rescinded: 'V'
|
174
180
|
}.freeze
|
175
181
|
|
176
182
|
# K2 Segment constants
|
@@ -36,9 +36,11 @@ describe Metro2::Records::BaseSegment do
|
|
36
36
|
@base.address_indicator = 'N'
|
37
37
|
@base.residence_code = 'O'
|
38
38
|
@base.k2_segment = k2_segment
|
39
|
+
@base.j2_segment = j2_segment
|
39
40
|
end
|
40
41
|
|
41
42
|
let(:k2_segment) { nil }
|
43
|
+
let(:j2_segment) { nil }
|
42
44
|
|
43
45
|
context '#to_metro2' do
|
44
46
|
let(:expected) do
|
@@ -115,6 +117,29 @@ describe Metro2::Records::BaseSegment do
|
|
115
117
|
expect(base_str[0..3].to_i).to eql(expected_length)
|
116
118
|
end
|
117
119
|
end
|
120
|
+
|
121
|
+
context 'with a J2 segment' do
|
122
|
+
let(:j2_segment) do
|
123
|
+
j2 = Metro2::Records::J2Segment.new
|
124
|
+
j2.surname = "Business Name"
|
125
|
+
j2.social_security_number = '333224444'
|
126
|
+
j2.date_of_birth = Date.new(1987, 4, 19)
|
127
|
+
j2.ecoa_code = 'W'
|
128
|
+
j2.country_code = 'US'
|
129
|
+
j2.address_1 = '742 Evergreen Terrace'
|
130
|
+
j2.city = 'Springfield'
|
131
|
+
j2.state = 'IL'
|
132
|
+
j2.postal_code = '54321'
|
133
|
+
j2
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'should output the j2 segment in its string and update set_record_descriptor_word' do
|
137
|
+
base_str = @base.to_metro2
|
138
|
+
expected_length = Metro2::Records::BaseSegment::LENGTH + Metro2::Records::J2Segment::LENGTH
|
139
|
+
expect(base_str.size).to eql(expected_length)
|
140
|
+
expect(base_str[0..3].to_i).to eql(expected_length)
|
141
|
+
end
|
142
|
+
end
|
118
143
|
end
|
119
144
|
|
120
145
|
context 'alphanumerics' do
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Metro2::Records::BaseSegment do
|
4
|
+
before do
|
5
|
+
@j2_segment = Metro2::Records::J2Segment.new
|
6
|
+
@j2_segment.surname = business_name
|
7
|
+
@j2_segment.social_security_number = "333224444"
|
8
|
+
@j2_segment.date_of_birth = Date.new(1987, 4, 19)
|
9
|
+
@j2_segment.ecoa_code = "W"
|
10
|
+
@j2_segment.country_code = 'US'
|
11
|
+
@j2_segment.address_1 = '742 Evergreen Terrace'
|
12
|
+
@j2_segment.city = 'Springfield'
|
13
|
+
@j2_segment.state = 'IL'
|
14
|
+
@j2_segment.postal_code = '54321'
|
15
|
+
end
|
16
|
+
|
17
|
+
context "#to_metro2" do
|
18
|
+
let(:expected) do
|
19
|
+
[
|
20
|
+
"J2",
|
21
|
+
" ",
|
22
|
+
business_name.to_s.ljust(25, ' '),
|
23
|
+
" " * 20,
|
24
|
+
" " * 20,
|
25
|
+
" ",
|
26
|
+
"333224444",
|
27
|
+
"04191987",
|
28
|
+
"0" * 10,
|
29
|
+
"W",
|
30
|
+
" " * 2,
|
31
|
+
"US",
|
32
|
+
"742 Evergreen Terrace".ljust(32, ' '),
|
33
|
+
" " * 32,
|
34
|
+
"Springfield".ljust(20, ' '),
|
35
|
+
"IL",
|
36
|
+
"54321".ljust(9, ' '),
|
37
|
+
" ",
|
38
|
+
" ",
|
39
|
+
" " * 2
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
context "with valid attributes set" do
|
44
|
+
let(:business_name) { "Business Name" }
|
45
|
+
|
46
|
+
it "should create output string that matches expected" do
|
47
|
+
j2_segment_str = @j2_segment.to_metro2
|
48
|
+
expect(j2_segment_str).to eql(expected.join)
|
49
|
+
expect(j2_segment_str.size).to eql(Metro2::Records::J2Segment::LENGTH)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metro_2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Mascarenhas
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -62,15 +62,18 @@ files:
|
|
62
62
|
- ".gitignore"
|
63
63
|
- ".rspec"
|
64
64
|
- ".rubocop.yml"
|
65
|
+
- CHANGELOG.md
|
65
66
|
- Gemfile
|
66
67
|
- LICENSE.txt
|
67
68
|
- README.md
|
68
69
|
- Rakefile
|
70
|
+
- Repositoryowner.md
|
69
71
|
- lib/metro_2.rb
|
70
72
|
- lib/metro_2/fields.rb
|
71
73
|
- lib/metro_2/metro2_file.rb
|
72
74
|
- lib/metro_2/records/base_segment.rb
|
73
75
|
- lib/metro_2/records/header_segment.rb
|
76
|
+
- lib/metro_2/records/j2_segment.rb
|
74
77
|
- lib/metro_2/records/k2_segment.rb
|
75
78
|
- lib/metro_2/records/record.rb
|
76
79
|
- lib/metro_2/records/trailer_segment.rb
|
@@ -78,6 +81,7 @@ files:
|
|
78
81
|
- metro_2.gemspec
|
79
82
|
- spec/records/base_segment_spec.rb
|
80
83
|
- spec/records/header_segment_spec.rb
|
84
|
+
- spec/records/j2_segment_spec.rb
|
81
85
|
- spec/records/k2_segment_spec.rb
|
82
86
|
- spec/records/trailer_segment_spec.rb
|
83
87
|
- spec/spec_helper.rb
|
@@ -85,7 +89,7 @@ homepage: ''
|
|
85
89
|
licenses:
|
86
90
|
- MIT
|
87
91
|
metadata: {}
|
88
|
-
post_install_message:
|
92
|
+
post_install_message:
|
89
93
|
rdoc_options: []
|
90
94
|
require_paths:
|
91
95
|
- lib
|
@@ -100,13 +104,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
104
|
- !ruby/object:Gem::Version
|
101
105
|
version: '0'
|
102
106
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
104
|
-
signing_key:
|
107
|
+
rubygems_version: 3.2.33
|
108
|
+
signing_key:
|
105
109
|
specification_version: 4
|
106
110
|
summary: Create Metro 2 format files for credit reporting
|
107
111
|
test_files:
|
108
112
|
- spec/records/base_segment_spec.rb
|
109
113
|
- spec/records/header_segment_spec.rb
|
114
|
+
- spec/records/j2_segment_spec.rb
|
110
115
|
- spec/records/k2_segment_spec.rb
|
111
116
|
- spec/records/trailer_segment_spec.rb
|
112
117
|
- spec/spec_helper.rb
|