cmxl 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.mdown +5 -0
- data/lib/cmxl/field.rb +1 -1
- data/lib/cmxl/version.rb +1 -1
- data/spec/fields/unknown_spec.rb +21 -5
- data/spec/fixtures/mt940.txt +1 -0
- data/spec/mt940_parsing_spec.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5e0a335b0d8a997acf80ab578362f77f08880b0d7258f3c3af365b71eb53925
|
4
|
+
data.tar.gz: b2d3c8dd9925866da29d27cc43457652f2fdf377bcd1080feb87d654a88b37e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa0be57b4e8643e1a20f4bb276d7953eb7cc3f16cc3c89286b5ca6fa7e2a9b285b1358424f6904d086315907d1ba77f2d89616980a82bb4360f162e91eaf2477
|
7
|
+
data.tar.gz: 2990c106239b3f65c35abdc662af7afdba0ba4d539e1e9f3838179d5f238e1b72fbf43b82743bce5a060b291a4a9f28031f3bc4aba9e39f76c155d178d1f1b83
|
data/CHANGELOG.mdown
CHANGED
data/lib/cmxl/field.rb
CHANGED
@@ -47,7 +47,7 @@ module Cmxl
|
|
47
47
|
# Cmxl::Field.parse(':60F:C031002PLN40000,00') #=> returns an AccountBalance instance
|
48
48
|
#
|
49
49
|
def self.parse(line)
|
50
|
-
if line =~ /\A:(\
|
50
|
+
if line =~ /\A:(\w{2,2})(\w)?:(.*)\z/m
|
51
51
|
tag = Regexp.last_match(1)
|
52
52
|
modifier = Regexp.last_match(2)
|
53
53
|
content = Regexp.last_match(3).delete("\r").gsub(/\n\z/, '') # remove trailing line break to prevent empty field parsing
|
data/lib/cmxl/version.rb
CHANGED
data/spec/fields/unknown_spec.rb
CHANGED
@@ -1,8 +1,24 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
describe 'Unknown fields' do
|
4
|
+
context 'numerical fields' do
|
5
|
+
subject { Cmxl::Field.parse(':42F:C140908EUR000000000136,02') }
|
6
|
+
it { expect(subject.tag).to eql('42') }
|
7
|
+
it { expect(subject.source).to eql('C140908EUR000000000136,02') }
|
8
|
+
it { expect(subject.to_h).to eql(tag: '42', modifier: 'F', source: 'C140908EUR000000000136,02') }
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'alphanumerical fields w/ modifier' do
|
12
|
+
subject { Cmxl::Field.parse(':NSF:SomethingSomethingDarkSide') }
|
13
|
+
it { expect(subject.tag).to eql('NS') }
|
14
|
+
it { expect(subject.source).to eql('SomethingSomethingDarkSide') }
|
15
|
+
it { expect(subject.to_h).to eql(tag: 'NS', modifier: 'F', source: 'SomethingSomethingDarkSide') }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'alphanumerical fields wo/ modifier' do
|
19
|
+
subject { Cmxl::Field.parse(':FO:oBar') }
|
20
|
+
it { expect(subject.tag).to eql('FO') }
|
21
|
+
it { expect(subject.source).to eql('oBar') }
|
22
|
+
it { expect(subject.to_h).to eql(tag: 'FO', modifier: nil, source: 'oBar') }
|
23
|
+
end
|
8
24
|
end
|
data/spec/fixtures/mt940.txt
CHANGED
data/spec/mt940_parsing_spec.rb
CHANGED
@@ -57,6 +57,8 @@ describe 'parsing a statement' do
|
|
57
57
|
it { expect(subject.transactions.first.bic).to eql('10600076') }
|
58
58
|
it { expect(subject.transactions.first.iban).to eql('PL08106000760000777777777777') }
|
59
59
|
it { expect(subject.transactions.first.sepa).to eql({}) }
|
60
|
+
|
61
|
+
it { expect(subject.field('NS').to_h).to eql({tag: 'NS', modifier: 'F', source: 'HelloWorld'}) }
|
60
62
|
end
|
61
63
|
|
62
64
|
context 'statement separator as used by most banks' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmxl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bumann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
- !ruby/object:Gem::Version
|
197
197
|
version: '0'
|
198
198
|
requirements: []
|
199
|
-
rubygems_version: 3.0.
|
199
|
+
rubygems_version: 3.0.2
|
200
200
|
signing_key:
|
201
201
|
specification_version: 4
|
202
202
|
summary: Cmxl is your friendly MT940 bank statement parser
|