ibandit 1.21.0 → 1.27.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37a15fbc4242dda50e51d295ef5e37e6ee692d5f91d43d32842c2df570213e82
4
- data.tar.gz: db530699e09d54603f27cbee4c4d6e9f254e89557ce1c41ac0cbfb8e82a58e90
3
+ metadata.gz: dbb7ed596d3a15df834ea35161a57c85cd14d1d361f11f8d003e58dcca623f49
4
+ data.tar.gz: 8e2c910c7accae21705f784d6ab312c81ab939a33e478c1b0e57eb6695f39acd
5
5
  SHA512:
6
- metadata.gz: 1a9b288596e9bddae7eab282e12f20a650bdbc74016240f56f4a7a34fa9628885070b276ac079d149a146a4cd0ac68ceb58923001edb40159bd368637b1534d2
7
- data.tar.gz: '08f3f363786871a019ebe9122d1b9fe96893823811a9578d25a652757a01d8b4e9904ae4ecf32542a2ddb856894486816429a97f65ecd7bc450158c0924de475'
6
+ metadata.gz: 0ad39f982ac65f870b4d2d70db1149d104a3092e82358b5d25ccb66274967f0e6ce142e58bbc8394a57d3f3e5107d2684e0b338e4516f4e31fd5948c14583d96
7
+ data.tar.gz: 64e740ee26986a1cc119c34901aa02ab42a0b389d9ad753149659b6396dca7aa91302f6ad6b7e8dc02ce6e0ef79a9723e7aa442c58070b9a455312ee8f94a707
@@ -7,7 +7,7 @@ jobs:
7
7
  validate:
8
8
  strategy:
9
9
  matrix:
10
- ruby-version: ["2.7", "3.0", "3.1", "3.2"]
10
+ ruby-version: ["3.1", "3.2", "3.3", "3.4"]
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - uses: actions/checkout@v3
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ Gemfile.lock
2
2
  .bundle
3
3
  *.gem
4
4
  .DS_Store
5
+ .idea
data/.rubocop.yml CHANGED
@@ -1,54 +1,8 @@
1
1
  inherit_from: .rubocop_todo.yml
2
+
2
3
  inherit_gem:
3
4
  gc_ruboconfig: rubocop.yml
4
- require: rubocop-rails
5
5
 
6
6
  AllCops:
7
7
  TargetRubyVersion: 3.2
8
-
9
- # Limit lines to 90 characters.
10
- Layout/LineLength:
11
- Max: 90
12
-
13
- Metrics/ClassLength:
14
- Max: 400
15
-
16
- # Avoid single-line methods.
17
- Style/SingleLineMethods:
18
- AllowIfMethodIsEmpty: true
19
-
20
- # Wants underscores in all large numbers. Pain in the ass for things like
21
- # unix timestamps.
22
- Style/NumericLiterals:
23
- Enabled: false
24
-
25
- # Wants you to use the same argument names for every reduce. This seems kinda
26
- # naff compared to naming them semantically
27
- Style/SingleLineBlockParams:
28
- Enabled: false
29
-
30
- Style/SignalException:
31
- EnforcedStyle: 'only_raise'
32
-
33
- # Wants to exclude accents from comments
34
- Style/AsciiComments:
35
- Enabled: false
36
-
37
- # Configuration parameters: CountComments.
38
- Metrics/MethodLength:
39
- Max: 25
40
-
41
- # Configuration parameters: CountComments.
42
- Metrics/ModuleLength:
43
- Max: 400
44
-
45
- Layout/DotPosition:
46
- EnforcedStyle: 'trailing'
47
-
48
- # Wants to to lock to Ruby 2.4 as specified here but as this is a public gem
49
- # this is quite aggressive.
50
- Gemspec/RequiredRubyVersion:
51
- Enabled: false
52
-
53
- Rails/Blank:
54
- Enabled: false
8
+ NewCops: enable
data/.rubocop_todo.yml CHANGED
@@ -1,77 +1,76 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2020-08-25 10:15:35 UTC using RuboCop version 0.89.1.
2
+ # `rubocop --auto-gen-config --exclude-limit 99000`
3
+ # on 2025-07-01 13:51:07 UTC using RuboCop version 1.77.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 8
10
- # Configuration parameters: IgnoredMethods.
11
- Metrics/AbcSize:
12
- Max: 25
13
-
14
- # Offense count: 2
15
- # Configuration parameters: IgnoredMethods.
16
- Metrics/CyclomaticComplexity:
17
- Max: 8
9
+ # Offense count: 1
10
+ # Configuration parameters: Severity, Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'ibandit.gemspec'
18
15
 
19
16
  # Offense count: 1
20
- # Configuration parameters: EnforcedStyleForLeadingUnderscores.
21
- # SupportedStylesForLeadingUnderscores: disallowed, required, optional
22
- Naming/MemoizedInstanceVariableName:
17
+ # Configuration parameters: LengthThreshold.
18
+ Metrics/CollectionLiteralLength:
23
19
  Exclude:
24
- - 'lib/ibandit/sweden/bank_lookup.rb'
20
+ - 'lib/ibandit/german_details_converter.rb'
25
21
 
26
22
  # Offense count: 1
27
23
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
28
- # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
24
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
29
25
  Naming/MethodParameterName:
30
26
  Exclude:
31
27
  - 'lib/ibandit/german_details_converter.rb'
32
28
 
29
+ # Offense count: 2
30
+ # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods.
31
+ # AllowedMethods: call
32
+ Naming/PredicateMethod:
33
+ Exclude:
34
+ - 'lib/ibandit/sweden/validator.rb'
35
+
33
36
  # Offense count: 1
37
+ # Configuration parameters: IgnoredMetadata.
34
38
  RSpec/DescribeClass:
35
39
  Exclude:
40
+ - '**/spec/features/**/*'
41
+ - '**/spec/requests/**/*'
42
+ - '**/spec/routing/**/*'
43
+ - '**/spec/system/**/*'
44
+ - '**/spec/views/**/*'
36
45
  - 'spec/ibandit/structure_spec.rb'
37
46
 
38
47
  # Offense count: 1
39
- # Configuration parameters: Max.
48
+ # Configuration parameters: CountAsOne.
40
49
  RSpec/ExampleLength:
41
- Exclude:
42
- - 'spec/ibandit/iban_spec.rb'
50
+ Max: 6
43
51
 
44
52
  # Offense count: 1
45
53
  RSpec/ExpectInHook:
46
54
  Exclude:
47
55
  - 'spec/ibandit/german_details_converter_spec.rb'
48
56
 
49
- # Offense count: 12
57
+ # Offense count: 15
50
58
  RSpec/MultipleExpectations:
51
59
  Max: 2
52
60
 
53
- # Offense count: 182
54
- # Configuration parameters: AllowSubject.
55
- RSpec/MultipleMemoizedHelpers:
56
- Max: 7
57
-
58
- # Offense count: 20
59
- # Configuration parameters: IgnoreSharedExamples.
61
+ # Offense count: 26
62
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
63
+ # SupportedStyles: always, named_only
60
64
  RSpec/NamedSubject:
61
65
  Exclude:
62
66
  - 'spec/ibandit/iban_spec.rb'
63
67
 
64
- # Offense count: 368
68
+ # Offense count: 188
69
+ # Configuration parameters: AllowedGroups.
65
70
  RSpec/NestedGroups:
66
- Max: 6
67
-
68
- # Offense count: 18
69
- RSpec/ScatteredSetup:
70
- Exclude:
71
- - 'spec/ibandit/iban_assembler_spec.rb'
72
- - 'spec/ibandit/iban_spec.rb'
71
+ Max: 5
73
72
 
74
- # Offense count: 13
73
+ # Offense count: 37
75
74
  RSpec/SubjectStub:
76
75
  Exclude:
77
76
  - 'spec/ibandit/iban_spec.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.4.1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ ## 1.27.0 - September 8, 2025
2
+
3
+ - Update BLZ data - BLZ_20250908
4
+
5
+ ## 1.26.1 - July 4, 2025
6
+
7
+ - Gracefully fail validation for NZ accounts if no account number is provided
8
+
9
+ ## 1.26.0 - July 1, 2025
10
+
11
+ - Update BLZ data - BLZ_20250609
12
+
13
+ ## 1.25.0 - February 18, 2025
14
+
15
+ - `SE` pseudo-ibans no longer fail validation due to the `ZZ` check digit.
16
+
17
+ ## 1.24.0 - February 18, 2025
18
+
19
+ - Fix validation for SE IBANs where the account number starts with a 0 and the clearing number is not included in the IBAN
20
+
21
+ ## 1.23.0 - February 14, 2025
22
+
23
+ - Fix validation for SE IBANs for clearing code 3300 where the account number starts with a 0
24
+
25
+ ## 1.22.0 - January 22, 2025
26
+
27
+ - Remove support for Ruby < 3.1, add support for Ruby >= 3.4
28
+ - Update BLZ2 data - BLZ_20241209
29
+ - Update IBAN structures for `BE`, `ES`, `XK`.
30
+ - Add partial support for `SO`, `NI`, `FK`, `OM`, `YE` IBANs.
31
+
1
32
  ## 1.21.0 - August 6, 2024
2
33
 
3
34
  - Canada, Financial Institution number - allow 3 digits
data/Gemfile CHANGED
@@ -3,3 +3,13 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ group :development, :test do
8
+ gem "gc_ruboconfig", "~> 5.0"
9
+ gem "nokogiri", "~> 1.6"
10
+ gem "pry", "~> 0.13"
11
+ gem "pry-byebug", "~> 3.10"
12
+ gem "rspec", "~> 3.12"
13
+ gem "rspec-its", "~> 1.2"
14
+ gem "sax-machine", "~> 1.3"
15
+ end
@@ -1,42 +1,44 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Script for parsing the Bankleitzahl file (BLZ2.xml) from the Deutsche Bundesbank.
5
+ require "yaml"
6
+ require "sax-machine"
7
+
8
+ class BLZRecord
9
+ include SAXMachine
10
+ element "BLZ", as: :bank_code
11
+ element "Merkmal", as: :primary_record
12
+ element "PruefZiffMeth", as: :check_digit_rule
13
+ element "IBANRegel", as: :iban_rule
14
+ end
2
15
 
3
- # Script for parsing the Bankleitzahl file (BLZ2.txt) from the Deutsche
4
- # Bundesbank.
5
- require 'yaml'
6
-
7
- BLZ_FIELDS = {
8
- bank_code: { position: 0, length: 8 },
9
- primary_record: { position: 8, length: 1 },
10
- check_digit_rule: { position: 150, length: 2 },
11
- iban_rule: { position: 168, length: 6 }
12
- }.freeze
13
-
14
- def parse_line(line)
15
- BLZ_FIELDS.each_with_object({}) do |(field, details), hash|
16
- hash[field] = line.slice(details[:position], details[:length])
17
- end
16
+ class BLZFile
17
+ include SAXMachine
18
+ elements "BLZEintrag", as: :records, class: BLZRecord
18
19
  end
19
20
 
20
21
  def get_iban_rules(blz2_file)
21
- blz2_file.each_with_object({}) do |line, hash|
22
- bank_details = parse_line(line)
23
-
24
- next if bank_details.delete(:primary_record) == '2'
22
+ BLZFile.parse(blz2_file).records.each_with_object({}) do |bank_details, hash|
23
+ next if bank_details.primary_record == "2"
25
24
 
26
- hash[bank_details.delete(:bank_code)] = bank_details
25
+ hash[bank_details.bank_code] = {
26
+ check_digit_rule: bank_details.check_digit_rule,
27
+ iban_rule: bank_details.iban_rule,
28
+ }
27
29
  end
28
30
  end
29
31
 
30
32
  # Only parse the files if this file is run as an executable (not required in,
31
33
  # as it is in the specs)
32
34
  if __FILE__ == $PROGRAM_NAME
33
- blz2_file = File.open(File.expand_path('../../data/raw/BLZ2.txt', __FILE__))
35
+ blz2_file = File.read(File.expand_path("../data/raw/BLZ2.xml", __dir__))
34
36
  iban_rules = get_iban_rules(blz2_file)
35
37
 
36
38
  output_file_path = File.expand_path(
37
- '../../data/german_iban_rules.yml',
38
- __FILE__
39
+ "../data/german_iban_rules.yml",
40
+ __dir__,
39
41
  )
40
42
 
41
- File.open(output_file_path, 'w') { |f| f.write(iban_rules.to_yaml) }
43
+ File.open(output_file_path, "w") { |f| f.write(iban_rules.to_yaml) }
42
44
  end