metro_2 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd854adc4eb6506c3723faddb4af8c465661ca124b45c71ee0d145c671acf4da
4
- data.tar.gz: a834b02f5e35a4525723a887acc63becdc730ac9440eedf5286480bffae2248d
3
+ metadata.gz: 53c7a7abd63b475add82aa238e4cb634767b38ca2c0f49f98422c3de53485c59
4
+ data.tar.gz: 7043dbe7604d64c8b5db6b3fa9062c2b169e701a033a27ea480ab5b2ca2fa31c
5
5
  SHA512:
6
- metadata.gz: b2a79f917988c78c2c50845d88ebe8f2d566e51d46e2efae46cad9946e2abf298c1249730b7eac3f895a33bfabd4d7e7605cf6526c0f74633914d687dafc6e3f
7
- data.tar.gz: d7bf507c8a3f7b8f845e0bb819b955028eaa62df04024790b3947fa919cf3ee8ea43d2e8c1c9ae138139e61e1fb3ead21f1190ee9f6fc60e6630f8156ffe0622
6
+ metadata.gz: 571c5c7704912cf4f984a2bb4f2c32e691afdc70a465c9b88c876b2a1fa332d93a5b62fea1b2451aff42dd9ca7ebe3953473ad41becbfddd714e77b55271bb83
7
+ data.tar.gz: 1d111fde7dd76134d9722d5ef164414c3b0b3eb46362fc76ee267b6cc55912f5a2af06ff6aaf2a372501cdf71a967d1b2b22a6986be4faa67beebe910659c488
@@ -0,0 +1,12 @@
1
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
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
11
+ Layout/LineLength:
12
+ Max: 100
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'metro_2/version'
2
4
 
3
5
  module Metro2
4
-
5
6
  PORTFOLIO_TYPE = {
6
7
  line_of_credit: 'C',
7
8
  installment: 'I',
@@ -11,6 +12,7 @@ module Metro2
11
12
  }.freeze
12
13
 
13
14
  ACCOUNT_TYPE = {
15
+ auto: '00',
14
16
  unsecured: '01',
15
17
  education: '12'
16
18
  # TODO: add other account types
@@ -24,18 +26,25 @@ module Metro2
24
26
  }.freeze
25
27
 
26
28
  SPECIAL_COMMENT_CODE = {
29
+ election_of_remedy: 'I',
30
+ paid_through_insurance: 'AB',
27
31
  partial_payment_agreement: 'AC',
28
32
  purchased_by_another_company: 'AH',
33
+ voluntarily_surrendered: 'AO',
29
34
  paid_in_full_less_than_full_balance: 'AU',
30
35
  affected_by_natural_or_declared_disaster: 'AW',
36
+ redeemed_or_reinstated_repossession: 'AZ',
37
+ involuntary_repossession: 'BI',
38
+ involuntary_repossession_obligation_satisfied: 'BJ',
39
+ involuntary_repossession_balance_owing: 'BK',
31
40
  loan_modified: 'CO',
32
- forbearance: 'CP',
41
+ forbearance: 'CP'
33
42
  # TODO: add other special comment codes
34
43
  }.freeze
35
44
 
36
45
  COMPLIANCE_CONDITION_CODE = {
37
46
  in_dispute: 'XB',
38
- previously_in_dispute_now_resolved: 'XH',
47
+ previously_in_dispute_now_resolved: 'XH'
39
48
  # TODO: add other compliance condition codes
40
49
  }.freeze
41
50
 
@@ -161,8 +170,8 @@ module Metro2
161
170
  withdrawn_ch7: 'M',
162
171
  withdrawn_ch11: 'N',
163
172
  withdrawn_ch12: 'O',
164
- withdrawn_ch13: 'P',
165
- }
173
+ withdrawn_ch13: 'P'
174
+ }.freeze
166
175
 
167
176
  # K2 Segment constants
168
177
  PURCHASED_FROM_SOLD_TO_INDICATOR = {
@@ -171,10 +180,10 @@ module Metro2
171
180
  remove_previous: 9
172
181
  }.freeze
173
182
 
174
- ALPHANUMERIC = /\A([[:alnum:]]|\s)+\z/
175
- ALPHANUMERIC_PLUS_DASH = /\A([[:alnum:]]|\s|\-)+\z/
176
- ALPHANUMERIC_PLUS_DOT_DASH_SLASH = /\A([[:alnum:]]|\s|\-|\.|\\|\/)+\z/
177
- NUMERIC = /\A\d+\.?\d*\z/
183
+ ALPHANUMERIC = /\A([[:alnum:]]|\s)+\z/.freeze
184
+ ALPHANUMERIC_PLUS_DASH = /\A([[:alnum:]]|\s|\-)+\z/.freeze
185
+ ALPHANUMERIC_PLUS_DOT_DASH_SLASH = %r{\A([[:alnum:]]|\s|\-|\.|\\|/)+\z}.freeze
186
+ NUMERIC = /\A\d+\.?\d*\z/.freeze
178
187
 
179
188
  FIXED_LENGTH = 426
180
189
 
@@ -189,14 +198,14 @@ module Metro2
189
198
  # Left justified and blank-filled
190
199
  val = val.to_s
191
200
 
192
- return ' ' * required_length if val.empty?
201
+ return ' ' * required_length if val.empty?
193
202
 
194
203
  unless !!(val =~ permitted_chars)
195
- raise ArgumentError.new("Content (#{val}) contains invalid characters in field '#{name}'")
204
+ raise ArgumentError, "Content (#{val}) contains invalid characters in field '#{name}'"
196
205
  end
197
206
 
198
207
  if val.size > required_length
199
- val[0..(required_length-1)]
208
+ val[0..(required_length - 1)]
200
209
  else
201
210
  val + (' ' * (required_length - val.size))
202
211
  end
@@ -205,7 +214,7 @@ module Metro2
205
214
  def self.numeric_to_metro2(val, required_length,
206
215
  is_monetary: false, name: nil, possible_values: nil)
207
216
  unless possible_values.nil? || possible_values.include?(val)
208
- raise ArgumentError.new("field #{name} has unsupported value: #{val}")
217
+ raise ArgumentError, "field #{name} has unsupported value: #{val}"
209
218
  end
210
219
 
211
220
  # Right justified and zero-filled
@@ -213,17 +222,15 @@ module Metro2
213
222
 
214
223
  return '0' * required_length if val.empty?
215
224
 
216
- unless !!(val =~ Metro2::NUMERIC)
217
- raise ArgumentError.new("field (#{val}) must be numeric")
218
- end
225
+ raise ArgumentError, "field (#{val}) must be numeric" unless !!(val =~ Metro2::NUMERIC)
219
226
 
220
227
  decimal_index = val.index('.')
221
228
  val = val[0..(decimal_index - 1)] if decimal_index
222
229
 
223
230
  # any value above 1 billion gets set to 999,999,999
224
- return '9' * required_length if is_monetary && val.to_f >= 1000000000
231
+ return '9' * required_length if is_monetary && val.to_f >= 1_000_000_000
225
232
  if val.size > required_length
226
- raise ArgumentError.new("numeric field (#{val}) is too long (max #{required_length})")
233
+ raise ArgumentError, "numeric field (#{val}) is too long (max #{required_length})"
227
234
  end
228
235
 
229
236
  ('0' * (required_length - val.size)) + val
@@ -237,5 +244,5 @@ require 'metro_2/metro2_file'
237
244
  require 'metro_2/records/record'
238
245
 
239
246
  Dir.new(File.dirname(__FILE__) + '/metro_2/records').each do |file|
240
- require('metro_2/records/' + File.basename(file)) if File.extname(file) == ".rb"
247
+ require('metro_2/records/' + File.basename(file)) if File.extname(file) == '.rb'
241
248
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Metro2
2
- VERSION = "1.2.3"
4
+ VERSION = '1.2.4'
3
5
 
4
6
  def self.version_string
5
7
  str = VERSION.split('.')
@@ -1,24 +1,25 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'metro_2/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "metro_2"
8
+ spec.name = 'metro_2'
8
9
  spec.version = Metro2::VERSION
9
- spec.authors = ["Brian Mascarenhas"]
10
- spec.email = ["brian@upstart.com"]
11
- spec.summary = "Create Metro 2 format files for credit reporting"
12
- spec.description = "Create Metro 2 format files for credit reporting"
13
- spec.homepage = ""
14
- spec.license = "MIT"
10
+ spec.authors = ['Brian Mascarenhas']
11
+ spec.email = ['brian@upstart.com']
12
+ spec.summary = 'Create Metro 2 format files for credit reporting'
13
+ spec.description = 'Create Metro 2 format files for credit reporting'
14
+ spec.homepage = ''
15
+ spec.license = 'MIT'
15
16
 
16
17
  spec.files = `git ls-files -z`.split("\x0")
17
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
20
21
 
21
- spec.add_development_dependency "bundler", "~> 1.6"
22
- spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_development_dependency "rspec", "~> 2.13"
22
+ spec.add_development_dependency 'bundler', '~> 2.1'
23
+ spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'rspec', '~> 2.13'
24
25
  end
@@ -32,7 +32,7 @@ describe Metro2::Records::HeaderSegment do
32
32
  '123 Report Dr Address CA 91111'.ljust(96, ' '),
33
33
  '5555555555',
34
34
  'Upstart Engineer metro 2 gem'.ljust(40, ' '),
35
- '01203',
35
+ '01204',
36
36
  ' ' * 156
37
37
  ]
38
38
  header_str = @header.to_metro2
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.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Mascarenhas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-19 00:00:00.000000000 Z
11
+ date: 2020-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '2.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
63
  - ".rspec"
64
+ - ".rubocop.yml"
64
65
  - Gemfile
65
66
  - LICENSE.txt
66
67
  - README.md
@@ -99,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
100
  - !ruby/object:Gem::Version
100
101
  version: '0'
101
102
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.7.6
103
+ rubygems_version: 3.0.1
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Create Metro 2 format files for credit reporting