banktools-se 2.6.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.markdown +2 -2
- data/lib/banktools-se/ocr.rb +3 -3
- data/lib/banktools-se/version.rb +1 -1
- data/spec/ocr_spec.rb +9 -7
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38e5cf121c7e7407651ad63a42019ea082955b08
|
4
|
+
data.tar.gz: ce68adf193356960407508086df268b5dbc1e270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6bdae6a9abf7e6dd2ea17ffacfee12752374e5ae83f58310bfac8c4a78125b849a9daa13f862e5623ce914da28601f84378de3f0bc2bb7cea0ca7187aea9bf2
|
7
|
+
data.tar.gz: 902b07121e7aaad2450f9171092b4356ba5d283f9622c24ed34678b352c20daceca0b111d26ec69ba5767c0d5ac52b3fa4889b424c79632629c62d33c06f6355
|
data/CHANGELOG.md
ADDED
data/README.markdown
CHANGED
@@ -117,9 +117,9 @@ Possible improvements to make:
|
|
117
117
|
|
118
118
|
## Also see
|
119
119
|
|
120
|
-
* [BankTools::DE (German)](https://github.com/barsoom/banktools-de)
|
121
|
-
* [iban-tools](https://github.com/iulianu/iban-tools)
|
122
120
|
* [Bankgirocentral documentation](https://www.bankgirot.se/kundservice/handbocker/)
|
121
|
+
* [Our other BankTools](https://github.com/barsoom?q=banktools)
|
122
|
+
* [iban-tools](https://github.com/iulianu/iban-tools)
|
123
123
|
|
124
124
|
|
125
125
|
## Credits and license
|
data/lib/banktools-se/ocr.rb
CHANGED
@@ -64,8 +64,8 @@ module BankTools
|
|
64
64
|
ocr[0...-digits_to_chop]
|
65
65
|
end
|
66
66
|
|
67
|
-
# max_length is
|
68
|
-
def self.find_all_in_string(string, length_digit: false, pad: "", min_length: 4, max_length:
|
67
|
+
# max_length is 18, because the biggest allowed integer by default in a Postgres integer column ("bigint") is 19 digits long, as is the next (disallowed) number. Attempting some queries with longer OCRs may cause Ruby on Rails exceptions.
|
68
|
+
def self.find_all_in_string(string, length_digit: false, pad: "", min_length: 4, max_length: 18)
|
69
69
|
# First, treat the input as one long string of digits.
|
70
70
|
# E.g. "1234 and 5678" becomes "12345678".
|
71
71
|
|
@@ -88,7 +88,7 @@ module BankTools
|
|
88
88
|
|
89
89
|
# Get rid of any duplicates.
|
90
90
|
|
91
|
-
candidates.uniq
|
91
|
+
candidates = candidates.uniq
|
92
92
|
|
93
93
|
# Finally, limit these substrings to ones that are actually valid OCRs.
|
94
94
|
|
data/lib/banktools-se/version.rb
CHANGED
data/spec/ocr_spec.rb
CHANGED
@@ -121,15 +121,17 @@ describe BankTools::SE::OCR do
|
|
121
121
|
end
|
122
122
|
|
123
123
|
it "lets you configure the accepted OCR max_length" do
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
# Add a check digit to the input.
|
125
|
+
ocr_length_18 = BankTools::SE::OCR.from_number("12345678901234567")
|
126
|
+
ocr_length_19 = BankTools::SE::OCR.from_number("123456789012345678")
|
127
127
|
|
128
|
-
|
129
|
-
expect(BankTools::SE::OCR.find_all_in_string(string)).to include ocr_length_19
|
130
|
-
expect(BankTools::SE::OCR.find_all_in_string(string)).not_to include ocr_length_20
|
128
|
+
string = "#{ocr_length_18} #{ocr_length_19}"
|
131
129
|
|
132
|
-
|
130
|
+
# Default max_length is 18.
|
131
|
+
expect(BankTools::SE::OCR.find_all_in_string(string)).to include ocr_length_18
|
132
|
+
expect(BankTools::SE::OCR.find_all_in_string(string)).not_to include ocr_length_19
|
133
|
+
|
134
|
+
expect(BankTools::SE::OCR.find_all_in_string(string, max_length: 19)).to include ocr_length_18, ocr_length_19
|
133
135
|
end
|
134
136
|
|
135
137
|
it "excludes duplicates" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banktools-se
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".travis.yml"
|
78
|
+
- CHANGELOG.md
|
78
79
|
- Gemfile
|
79
80
|
- README.markdown
|
80
81
|
- Rakefile
|
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
114
|
version: '0'
|
114
115
|
requirements: []
|
115
116
|
rubyforge_project: banktools-se
|
116
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.6.11
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: Validate and normalize Swedish bank account numbers, plusgiro and bankgiro.
|