banktools-global 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +11 -8
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +2 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +32 -3
- data/banktools-global.gemspec +5 -14
- data/lib/banktools/global/iban.rb +6 -6
- data/lib/banktools/global/version.rb +1 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f967b8f0b0bdaf9d08b043b27263f0824ab6c8b51e9b32a7880a3e9a7c3127d
|
4
|
+
data.tar.gz: a684c3960db386810020bcffc58a435c06f9509e62dd9463abaacb18d5b95bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38343b5d0a7470536849a9cb59dea203d1352b535f7efffda9f9e63f06aab570875b03dc5c3835500b9fb0dc0ff257652ef895322cff18ed25ab84bad82850a1
|
7
|
+
data.tar.gz: 065fae49bcd7bdebed65a629b2580dc4c3c9becab6213466547c3b123859b0a85c16f2fd18caee65cc4dd25432a4cb54867f2d614de9c169161d3f75df1b069e
|
data/.github/workflows/main.yml
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
name: Ruby
|
2
2
|
|
3
|
-
on: [push,pull_request]
|
3
|
+
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
build:
|
7
7
|
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby-version: ["3.0", "2.7"]
|
12
|
+
|
8
13
|
steps:
|
9
14
|
- uses: actions/checkout@v2
|
10
|
-
- name: Set up Ruby
|
15
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
11
16
|
uses: ruby/setup-ruby@v1
|
12
17
|
with:
|
13
|
-
ruby-version:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
bundle install
|
18
|
-
bundle exec rake
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
20
|
+
- name: Run tests
|
21
|
+
run: bundle exec rake
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,26 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/barsoom/barsoom_utils.git
|
3
|
+
revision: d59121c10b4ba0e996d213ad23dc1545dcd27de0
|
4
|
+
specs:
|
5
|
+
barsoom_utils (0.1.0)
|
6
|
+
|
1
7
|
PATH
|
2
8
|
remote: .
|
3
9
|
specs:
|
4
|
-
banktools-global (0.1
|
10
|
+
banktools-global (1.0.1)
|
5
11
|
|
6
12
|
GEM
|
7
13
|
remote: https://rubygems.org/
|
8
14
|
specs:
|
15
|
+
ast (2.4.2)
|
9
16
|
diff-lcs (1.4.4)
|
10
|
-
|
17
|
+
parallel (1.20.1)
|
18
|
+
parser (3.0.2.0)
|
19
|
+
ast (~> 2.4.1)
|
20
|
+
rainbow (3.0.0)
|
21
|
+
rake (13.0.6)
|
22
|
+
regexp_parser (2.1.1)
|
23
|
+
rexml (3.2.5)
|
11
24
|
rspec (3.10.0)
|
12
25
|
rspec-core (~> 3.10.0)
|
13
26
|
rspec-expectations (~> 3.10.0)
|
@@ -21,14 +34,30 @@ GEM
|
|
21
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
35
|
rspec-support (~> 3.10.0)
|
23
36
|
rspec-support (3.10.2)
|
37
|
+
rubocop (1.18.4)
|
38
|
+
parallel (~> 1.10)
|
39
|
+
parser (>= 3.0.0.0)
|
40
|
+
rainbow (>= 2.2.2, < 4.0)
|
41
|
+
regexp_parser (>= 1.8, < 3.0)
|
42
|
+
rexml
|
43
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
44
|
+
ruby-progressbar (~> 1.7)
|
45
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
46
|
+
rubocop-ast (1.8.0)
|
47
|
+
parser (>= 3.0.1.1)
|
48
|
+
ruby-progressbar (1.11.0)
|
49
|
+
unicode-display_width (2.0.0)
|
24
50
|
|
25
51
|
PLATFORMS
|
26
52
|
x86_64-darwin-20
|
53
|
+
x86_64-linux
|
27
54
|
|
28
55
|
DEPENDENCIES
|
29
56
|
banktools-global!
|
57
|
+
barsoom_utils!
|
30
58
|
rake (~> 13.0)
|
31
59
|
rspec (~> 3.0)
|
60
|
+
rubocop
|
32
61
|
|
33
62
|
BUNDLED WITH
|
34
|
-
2.2.
|
63
|
+
2.2.25
|
data/banktools-global.gemspec
CHANGED
@@ -5,30 +5,21 @@ require_relative "lib/banktools/global/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "banktools-global"
|
7
7
|
spec.version = BankTools::Global::VERSION
|
8
|
-
spec.authors = ["Henrik Nyh"]
|
9
|
-
spec.email = ["henrik@nyh.se"]
|
8
|
+
spec.authors = [ "Henrik Nyh" ]
|
9
|
+
spec.email = [ "henrik@nyh.se" ]
|
10
10
|
|
11
11
|
spec.summary = "Validate and normalize international bank account numbers like IBAN/BIC. Based on iban-tools."
|
12
12
|
spec.homepage = "https://github.com/barsoom/banktools-global"
|
13
13
|
spec.license = "MIT"
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
15
|
+
spec.metadata = { "rubygems_mfa_required" => "true" }
|
15
16
|
|
16
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
18
|
spec.metadata["source_code_uri"] = spec.homepage
|
18
|
-
spec.metadata["changelog_uri"] = "https://github.com/barsoom/banktools-global/blob/
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/barsoom/banktools-global/blob/main/README.md"
|
19
20
|
|
20
|
-
# Specify which files should be added to the gem when it is released.
|
21
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
21
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
22
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
24
23
|
end
|
25
|
-
spec.
|
26
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
27
|
-
spec.require_paths = ["lib"]
|
28
|
-
|
29
|
-
# Uncomment to register a new dependency of your gem
|
30
|
-
# spec.add_dependency "example-gem", "~> 1.0"
|
31
|
-
|
32
|
-
# For more information and examples about making a new gem, checkout our
|
33
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
24
|
+
spec.require_paths = [ "lib" ]
|
34
25
|
end
|
@@ -7,7 +7,7 @@ class BankTools::Global::IBAN
|
|
7
7
|
E = BankTools::Global::Errors
|
8
8
|
|
9
9
|
def initialize(raw)
|
10
|
-
@pre_normalized = raw.to_s.gsub(/\s/, "").
|
10
|
+
@pre_normalized = raw.to_s.gsub(/\s/, "").upcase
|
11
11
|
end
|
12
12
|
|
13
13
|
def valid?
|
@@ -30,22 +30,22 @@ class BankTools::Global::IBAN
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def normalize
|
33
|
-
|
33
|
+
@pre_normalized.gsub(/.{4}/, '\0 ').strip
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def good_checksum?
|
39
|
-
|
39
|
+
number =
|
40
40
|
(bban + country_code + check_digits).chars.map { |char|
|
41
41
|
case char
|
42
42
|
when "0".."9" then char
|
43
43
|
when "A".."Z" then (char.ord - 55).to_s
|
44
44
|
else raise "Unexpected byte '#{byte}' in IBAN '#{normalize}'!"
|
45
45
|
end
|
46
|
-
}.join
|
46
|
+
}.join.to_i
|
47
47
|
|
48
|
-
|
48
|
+
number % 97 == 1
|
49
49
|
end
|
50
50
|
|
51
51
|
def country_code
|
@@ -62,7 +62,7 @@ class BankTools::Global::IBAN
|
|
62
62
|
|
63
63
|
def rules
|
64
64
|
@@rules ||=
|
65
|
-
YAML.
|
65
|
+
YAML.safe_load(File.read(File.join(File.dirname(__FILE__), "iban_rules.yml")))
|
66
66
|
.transform_values { |h| h.merge("bban_pattern" => /\A#{h.fetch("bban_pattern")}\z/) }
|
67
67
|
end
|
68
68
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banktools-global
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email:
|
15
15
|
- henrik@nyh.se
|
16
16
|
executables: []
|
@@ -20,6 +20,7 @@ files:
|
|
20
20
|
- ".github/workflows/main.yml"
|
21
21
|
- ".gitignore"
|
22
22
|
- ".rspec"
|
23
|
+
- ".rubocop.yml"
|
23
24
|
- CHANGELOG.md
|
24
25
|
- Gemfile
|
25
26
|
- Gemfile.lock
|
@@ -39,10 +40,11 @@ homepage: https://github.com/barsoom/banktools-global
|
|
39
40
|
licenses:
|
40
41
|
- MIT
|
41
42
|
metadata:
|
43
|
+
rubygems_mfa_required: 'true'
|
42
44
|
homepage_uri: https://github.com/barsoom/banktools-global
|
43
45
|
source_code_uri: https://github.com/barsoom/banktools-global
|
44
|
-
changelog_uri: https://github.com/barsoom/banktools-global/blob/
|
45
|
-
post_install_message:
|
46
|
+
changelog_uri: https://github.com/barsoom/banktools-global/blob/main/README.md
|
47
|
+
post_install_message:
|
46
48
|
rdoc_options: []
|
47
49
|
require_paths:
|
48
50
|
- lib
|
@@ -57,8 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
59
|
- !ruby/object:Gem::Version
|
58
60
|
version: '0'
|
59
61
|
requirements: []
|
60
|
-
rubygems_version: 3.
|
61
|
-
signing_key:
|
62
|
+
rubygems_version: 3.2.28
|
63
|
+
signing_key:
|
62
64
|
specification_version: 4
|
63
65
|
summary: Validate and normalize international bank account numbers like IBAN/BIC.
|
64
66
|
Based on iban-tools.
|