mt940_parser 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +29 -0
- data/.github/workflows/tests.yml +22 -0
- data/.rubocop.yml +61 -0
- data/.tool-versions +1 -0
- data/README.md +2 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/mt940/version.rb +1 -1
- data/lib/mt940.rb +7 -3
- data/lib/mt940_parser.rb +3 -0
- data/mt940_parser.gemspec +8 -6
- data/test/test_mt940.rb +4 -1
- metadata +23 -4
- data/.travis.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c10c25af0fbeca4a9f993982b9d6836c93f97a7689aad0437f6d7c296db76627
|
4
|
+
data.tar.gz: e374fb82f872046d4928c56356e80d26f2aaf2d3ee987ce73ca97b3b8a97f7b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f2e1879aa0385913ae9d5d1144e55104c94d0eb7195ce5a8cb63a61b5c7121f97371f365fe473c6d30b825d8756102fd4f1f79b5708189d4de4256d993a4fe1
|
7
|
+
data.tar.gz: e41928d11934d6d2419850bc8792b26f96eda4de933bba63e8caa67034751f211965ff1ca588a8a6d5ded3e8b0acd7937f4ee779bcf337911bd6ea9f02413cb1
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# based on https://github.com/rails/rails/blob/4a78dcb/.github/workflows/rubocop.yml
|
2
|
+
|
3
|
+
name: rubocop linting
|
4
|
+
|
5
|
+
on: [push, pull_request]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 2.7
|
17
|
+
- name: Cache gems
|
18
|
+
uses: actions/cache@v1
|
19
|
+
with:
|
20
|
+
path: vendor/bundle
|
21
|
+
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
|
22
|
+
restore-keys: |
|
23
|
+
${{ runner.os }}-rubocop-
|
24
|
+
- name: Install gems
|
25
|
+
run: |
|
26
|
+
bundle config path vendor/bundle
|
27
|
+
bundle install --jobs 4 --retry 3
|
28
|
+
- name: Run rubocop
|
29
|
+
run: bundle exec rubocop --lint
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: tests
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby: [ '2.7', 'ruby-head', 'jruby-head' ]
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
- name: Install dependencies
|
20
|
+
run: bundle install --jobs 4
|
21
|
+
- name: Test with Rake
|
22
|
+
run: bundle exec rake
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# usage: `rubocop --lint`
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
NewCops: enable
|
5
|
+
|
6
|
+
# disable some linters that are not so likely to indicate bugs
|
7
|
+
|
8
|
+
Lint/AmbiguousAssignment:
|
9
|
+
Enabled: false
|
10
|
+
Lint/AmbiguousBlockAssociation:
|
11
|
+
Enabled: false
|
12
|
+
Lint/AmbiguousOperator:
|
13
|
+
Enabled: false
|
14
|
+
Lint/AmbiguousRegexpLiteral:
|
15
|
+
Enabled: false
|
16
|
+
Lint/AssignmentInCondition:
|
17
|
+
Enabled: false
|
18
|
+
Lint/ConstantDefinitionInBlock:
|
19
|
+
Enabled: false
|
20
|
+
Lint/ConstantResolution:
|
21
|
+
Enabled: false
|
22
|
+
Lint/DuplicateBranch:
|
23
|
+
Enabled: false
|
24
|
+
Lint/EmptyBlock:
|
25
|
+
Enabled: false
|
26
|
+
Lint/EmptyClass:
|
27
|
+
Enabled: false
|
28
|
+
Lint/EmptyConditionalBody:
|
29
|
+
Enabled: false
|
30
|
+
Lint/EmptyExpression:
|
31
|
+
Enabled: false
|
32
|
+
Lint/EmptyFile:
|
33
|
+
Enabled: false
|
34
|
+
Lint/EmptyWhen:
|
35
|
+
Enabled: false
|
36
|
+
Lint/EnsureReturn:
|
37
|
+
Enabled: false
|
38
|
+
Lint/Loop:
|
39
|
+
Enabled: false
|
40
|
+
Lint/MissingSuper:
|
41
|
+
Enabled: false
|
42
|
+
Lint/MixedRegexpCaptureTypes:
|
43
|
+
Enabled: false
|
44
|
+
Lint/NumberConversion:
|
45
|
+
Enabled: false
|
46
|
+
Lint/ParenthesesAsGroupedExpression:
|
47
|
+
Enabled: false
|
48
|
+
Lint/RedundantStringCoercion:
|
49
|
+
Enabled: false
|
50
|
+
Lint/ShadowedArgument:
|
51
|
+
Enabled: false
|
52
|
+
Lint/ShadowedException:
|
53
|
+
Enabled: false
|
54
|
+
Lint/ShadowingOuterLocalVariable:
|
55
|
+
Enabled: false
|
56
|
+
Lint/SuppressedException:
|
57
|
+
Enabled: false
|
58
|
+
Lint/UnusedBlockArgument:
|
59
|
+
Enabled: false
|
60
|
+
Lint/UnusedMethodArgument:
|
61
|
+
Enabled: false
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.1.0
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/mt940_parser.svg)](http://badge.fury.io/rb/mt940_parser)
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/mt940_parser.svg)](http://badge.fury.io/rb/mt940_parser)
|
2
|
+
[![Build Status](https://github.com/betterplace/mt940_parser/workflows/tests/badge.svg)](https://github.com/betterplace/mt940_parser/actions)
|
2
3
|
|
3
4
|
# mt940_parser
|
4
5
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.4
|
data/lib/mt940/version.rb
CHANGED
data/lib/mt940.rb
CHANGED
@@ -14,8 +14,10 @@ class MT940
|
|
14
14
|
|
15
15
|
class << self
|
16
16
|
|
17
|
+
LINE = /^:(\d{2})(\w)?:(.*)$/
|
18
|
+
|
17
19
|
def for(line)
|
18
|
-
if line.match(
|
20
|
+
if line.match(LINE)
|
19
21
|
number, modifier, content = $1, $2, $3
|
20
22
|
klass = {
|
21
23
|
'20' => Job,
|
@@ -34,7 +36,9 @@ class MT940
|
|
34
36
|
|
35
37
|
klass.new(modifier, content)
|
36
38
|
else
|
37
|
-
raise Errors::WrongLineFormatError,
|
39
|
+
raise Errors::WrongLineFormatError,
|
40
|
+
"Wrong line format does not match #{LINE.inspect}. Got: "\
|
41
|
+
"#{line.dump[0...80]}#{'[...]' if line.dump.size > 80}"
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
@@ -276,7 +280,7 @@ class MT940
|
|
276
280
|
raw_sheets = new_text.split(/^-\s*\r\n/).map do |sheet|
|
277
281
|
sheet.gsub(/\r\n(?!:\d{2}\w?:)/, '')
|
278
282
|
end
|
279
|
-
|
283
|
+
raw_sheets.map { |raw_sheet| parse_sheet(raw_sheet) }
|
280
284
|
end
|
281
285
|
|
282
286
|
private
|
data/lib/mt940_parser.rb
ADDED
data/mt940_parser.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: mt940_parser 1.5.
|
2
|
+
# stub: mt940_parser 1.5.4 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "mt940_parser".freeze
|
6
|
-
s.version = "1.5.
|
6
|
+
s.version = "1.5.4"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Thies C. Arntzen".freeze, "Phillip Oertel".freeze]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2022-05-27"
|
12
12
|
s.description = "Ruby library that parses account statements in the SWIFT MT940 format.".freeze
|
13
13
|
s.email = "developers@betterplace.org".freeze
|
14
|
-
s.extra_rdoc_files = ["README.md".freeze, "lib/mt940.rb".freeze, "lib/mt940/customer_statement_message.rb".freeze, "lib/mt940/errors.rb".freeze, "lib/mt940/version.rb".freeze]
|
15
|
-
s.files = [".document".freeze, ".
|
14
|
+
s.extra_rdoc_files = ["README.md".freeze, "lib/mt940.rb".freeze, "lib/mt940/customer_statement_message.rb".freeze, "lib/mt940/errors.rb".freeze, "lib/mt940/version.rb".freeze, "lib/mt940_parser.rb".freeze]
|
15
|
+
s.files = [".document".freeze, ".github/workflows/lint.yml".freeze, ".github/workflows/tests.yml".freeze, ".gitignore".freeze, ".rubocop.yml".freeze, ".specification".freeze, ".tool-versions".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "docs/0E0Y00DNY.pdf".freeze, "docs/FinTS_4.0_Formals.pdf".freeze, "docs/FinTS_4.0_Messages_Finanzdatenformate.pdf".freeze, "docs/MT940_Deutschland_Structure2002.pdf".freeze, "docs/SEPA_20MT940__Schnittstellenbeschreibung.pdf".freeze, "docs/mt940.pdf".freeze, "docs/swift_mt940_942.pdf".freeze, "docs/uebersicht_der_geschaeftsvorfallcodes_und_buchungs_textschluessel.pdf".freeze, "lib/mt940.rb".freeze, "lib/mt940/customer_statement_message.rb".freeze, "lib/mt940/errors.rb".freeze, "lib/mt940/version.rb".freeze, "lib/mt940_parser.rb".freeze, "mt940_parser.gemspec".freeze, "test/fixtures/amount_formats.txt".freeze, "test/fixtures/amount_formats.yml".freeze, "test/fixtures/colon_in_descriptor.txt".freeze, "test/fixtures/colon_in_descriptor.yml".freeze, "test/fixtures/currency_in_25.txt".freeze, "test/fixtures/currency_in_25.yml".freeze, "test/fixtures/empty_86.txt".freeze, "test/fixtures/empty_86.yml".freeze, "test/fixtures/empty_entry_date.txt".freeze, "test/fixtures/empty_entry_date.yml".freeze, "test/fixtures/empty_line.txt".freeze, "test/fixtures/empty_line.yml".freeze, "test/fixtures/missing_crlf_at_end.txt".freeze, "test/fixtures/missing_crlf_at_end.yml".freeze, "test/fixtures/sepa_mt9401.txt".freeze, "test/fixtures/sepa_mt9401.yml".freeze, "test/fixtures/sepa_snippet.txt".freeze, "test/fixtures/sepa_snippet_broken.txt".freeze, "test/fixtures/with_binary_character.txt".freeze, "test/fixtures/with_binary_character.yml".freeze, "test/test_account_identifier.rb".freeze, "test/test_customer_statement_message.rb".freeze, "test/test_helper.rb".freeze, "test/test_mt940.rb".freeze]
|
16
16
|
s.homepage = "http://github.com/betterplace/mt940_parser".freeze
|
17
17
|
s.licenses = ["MIT".freeze]
|
18
18
|
s.rdoc_options = ["--title".freeze, "Mt940Parser - MT940 parses account statements in the SWIFT MT940 format.".freeze, "--main".freeze, "README.md".freeze]
|
19
|
-
s.rubygems_version = "3.
|
19
|
+
s.rubygems_version = "3.3.3".freeze
|
20
20
|
s.summary = "MT940 parses account statements in the SWIFT MT940 format.".freeze
|
21
21
|
s.test_files = ["test/test_account_identifier.rb".freeze, "test/test_customer_statement_message.rb".freeze, "test/test_helper.rb".freeze, "test/test_mt940.rb".freeze]
|
22
22
|
|
@@ -27,8 +27,10 @@ Gem::Specification.new do |s|
|
|
27
27
|
if s.respond_to? :add_runtime_dependency then
|
28
28
|
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
29
29
|
s.add_development_dependency(%q<test-unit>.freeze, [">= 0"])
|
30
|
+
s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
|
30
31
|
else
|
31
32
|
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
32
33
|
s.add_dependency(%q<test-unit>.freeze, [">= 0"])
|
34
|
+
s.add_dependency(%q<rubocop>.freeze, [">= 0"])
|
33
35
|
end
|
34
36
|
end
|
data/test/test_mt940.rb
CHANGED
@@ -9,8 +9,11 @@ class TestMt940 < Test::Unit::TestCase
|
|
9
9
|
data = MT940.parse(IO.read(file))
|
10
10
|
|
11
11
|
generated_structure_file = file.gsub(/.txt$/, ".yml")
|
12
|
+
# ruby 3.1 / psych 4 disallows loading classes from YAML by default
|
13
|
+
load_method = YAML.respond_to?(:unsafe_load_file) ? :unsafe_load_file : :load_file
|
12
14
|
|
13
|
-
assert_equal YAML
|
15
|
+
assert_equal YAML.send(load_method, generated_structure_file).to_yaml,
|
16
|
+
data.to_yaml
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mt940_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thies C. Arntzen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gem_hadar
|
@@ -39,6 +39,20 @@ dependencies:
|
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rubocop
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
42
56
|
description: Ruby library that parses account statements in the SWIFT MT940 format.
|
43
57
|
email: developers@betterplace.org
|
44
58
|
executables: []
|
@@ -49,11 +63,15 @@ extra_rdoc_files:
|
|
49
63
|
- lib/mt940/customer_statement_message.rb
|
50
64
|
- lib/mt940/errors.rb
|
51
65
|
- lib/mt940/version.rb
|
66
|
+
- lib/mt940_parser.rb
|
52
67
|
files:
|
53
68
|
- ".document"
|
69
|
+
- ".github/workflows/lint.yml"
|
70
|
+
- ".github/workflows/tests.yml"
|
54
71
|
- ".gitignore"
|
72
|
+
- ".rubocop.yml"
|
55
73
|
- ".specification"
|
56
|
-
- ".
|
74
|
+
- ".tool-versions"
|
57
75
|
- Gemfile
|
58
76
|
- LICENSE
|
59
77
|
- README.md
|
@@ -71,6 +89,7 @@ files:
|
|
71
89
|
- lib/mt940/customer_statement_message.rb
|
72
90
|
- lib/mt940/errors.rb
|
73
91
|
- lib/mt940/version.rb
|
92
|
+
- lib/mt940_parser.rb
|
74
93
|
- mt940_parser.gemspec
|
75
94
|
- test/fixtures/amount_formats.txt
|
76
95
|
- test/fixtures/amount_formats.yml
|
@@ -119,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
138
|
- !ruby/object:Gem::Version
|
120
139
|
version: '0'
|
121
140
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
141
|
+
rubygems_version: 3.3.3
|
123
142
|
signing_key:
|
124
143
|
specification_version: 4
|
125
144
|
summary: MT940 parses account statements in the SWIFT MT940 format.
|
data/.travis.yml
DELETED