cmxl 0.1.2 → 0.1.3

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 17647ffc105205636501d05c46e1d1cdc83b555b
4
+ data.tar.gz: ad00025468ad564d309959ff9da3b598e1f98f92
5
+ SHA512:
6
+ metadata.gz: e9bee8eb300a2c5bd3154d02316ff627d6c51fbf0ab9f1ee030928c1a8e1f767180f4553e7f21dcf1f4dbebf14f4f53a4d3828729adf56f5602649b7aa563640
7
+ data.tar.gz: a113db66a2a5b835254d4c1b1d88f0fead6f00c0866bebfefa6f353b3114c44f4bc7bccbe1c94164e778ead94171c1fed3922ee9f89f37ecc72ede0facd12107
@@ -1,9 +1,12 @@
1
+ sudo: false
1
2
  language: ruby
2
3
  rvm:
3
4
  - 1.9.3
4
5
  - 2.0.0
5
- - 2.1.2
6
+ - 2.1.8
7
+ - 2.2.4
8
+ - 2.3.0
6
9
  - jruby
7
10
  addons:
8
11
  code_climate:
9
- repo_token: 149f0d20e17ace00c44be432a4194bc441ba805da89a7708fca0f4a2c3f2aed7
12
+ repo_token: 149f0d20e17ace00c44be432a4194bc441ba805da89a7708fca0f4a2c3f2aed7
@@ -1,3 +1,7 @@
1
+ # 0.1.3
2
+
3
+ * [BUGFIX] fixed the statement details parser. It failed in case of empty values in the SEPA details
4
+
1
5
  # 0.1.2
2
-
3
- * [BUGFIX] fixed the statement details parser. It failed in case of empty values in the details
6
+
7
+ * [BUGFIX] fixed the statement details parser. It failed in case of empty values in the sub fields
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/railslove/cmxl.svg?branch=master)](https://travis-ci.org/railslove/cmxl)
2
+
1
3
  # Cmxl - your friendly ruby MT940 parser
2
4
 
3
5
  At [Railslove](http://railslove.com) we build a lot of financial applications and work on integrating applications with banks and banking functionality.
@@ -23,7 +23,7 @@ module Cmxl
23
23
 
24
24
  def sepa
25
25
  if self.information =~ /([A-Z]{4})\+/
26
- Hash[*self.information.split(/([A-Z]{4})\+/).reject(&:empty?)]
26
+ Hash[*self.information.split(/([A-Z]{4})\+/)[1..-1]]
27
27
  else
28
28
  {}
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Cmxl
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -8,14 +8,14 @@ describe Cmxl::Fields::StatementDetails do
8
8
  it { expect(subject.transaction_code).to eql('171') }
9
9
  it { expect(subject.seperator).to eql('?') }
10
10
  it { expect(subject.description).to eql('SEPA LASTSCHRIFT KUNDE') }
11
- it { expect(subject.information).to eql('EREF+TRX-0A4A47C3-F846-4729-8A1B-5DF620FMREF+CAC97D2144174318AC18D9BF815BD4FBCRED+DE98ZZZ09999999999SVWZ+FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F') }
11
+ it { expect(subject.information).to eql('KREF+EREF+TRX-0A4A47C3-F846-4729-8A1B-5DF620FMREF+CAC97D2144174318AC18D9BF815BD4FBCRED+DE98ZZZ09999999999SVWZ+FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F') }
12
12
  it { expect(subject.bic).to eql('HYVEDEMMXXX' ) }
13
13
  it { expect(subject.name).to eql('Peter Pan') }
14
14
  it { expect(subject.iban).to eql('HUkkbbbsssskcccccccccccccccx') }
15
15
  it { expect(subject.sub_fields).to eql({
16
16
  "00" => "SEPA LASTSCHRIFT KUNDE",
17
17
  "10" => "281",
18
- "20" => "EREF+TRX-0A4A47C3-F846-4729",
18
+ "20" => "KREF+EREF+TRX-0A4A47C3-F846-4729",
19
19
  "21" => "-8A1B-5DF620F",
20
20
  "22" => "MREF+CAC97D2144174318AC18D9",
21
21
  "23" => "BF815BD4FB",
@@ -29,13 +29,47 @@ describe Cmxl::Fields::StatementDetails do
29
29
  "34" => "171"
30
30
  }) }
31
31
  it { expect(subject.sepa).to eql({
32
+ "KREF" => "",
32
33
  "CRED" => "DE98ZZZ09999999999",
33
34
  "EREF" => "TRX-0A4A47C3-F846-4729-8A1B-5DF620F",
34
35
  "MREF" => "CAC97D2144174318AC18D9BF815BD4FB",
35
36
  "SVWZ" => "FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F"
36
37
  }) }
37
38
 
38
- it { expect(subject.to_h).to eql({'bic'=>"HYVEDEMMXXX", 'iban'=>"HUkkbbbsssskcccccccccccccccx", 'name' => "Peter Pan", 'sepa' => {"EREF"=>"TRX-0A4A47C3-F846-4729-8A1B-5DF620F", "MREF"=>"CAC97D2144174318AC18D9BF815BD4FB", "CRED"=>"DE98ZZZ09999999999", "SVWZ"=>"FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F"}, 'information' => "EREF+TRX-0A4A47C3-F846-4729-8A1B-5DF620FMREF+CAC97D2144174318AC18D9BF815BD4FBCRED+DE98ZZZ09999999999SVWZ+FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F", 'description' => "SEPA LASTSCHRIFT KUNDE", 'sub_fields' => {"00"=>"SEPA LASTSCHRIFT KUNDE", "10"=>"281", "20"=>"EREF+TRX-0A4A47C3-F846-4729", "21"=>"-8A1B-5DF620F", "22"=>"MREF+CAC97D2144174318AC18D9", "23"=>"BF815BD4FB", "24"=>"CRED+DE98ZZZ09999999999", "25"=>"SVWZ+FOO TRX-0A4A47C3-F84", "26"=>"6-4729-8A1B-5DF620F", "30"=>"HYVEDEMMXXX", "31"=>"HUkkbbbsssskcccccccccccccccx", "32"=>"Peter Pan", "34"=>"171", "99" => ""}, 'transaction_code' => "171", 'details' => "?00SEPA LASTSCHRIFT KUNDE?10281?20EREF+TRX-0A4A47C3-F846-4729?21-8A1B-5DF620F?22MREF+CAC97D2144174318AC18D9?23BF815BD4FB?24CRED+DE98ZZZ09999999999?25SVWZ+FOO TRX-0A4A47C3-F84?266-4729-8A1B-5DF620F?30HYVEDEMMXXX?31HUkkbbbsssskcccccccccccccccx?32Peter Pan?99?34171"}) }
39
+ it {
40
+ expect(subject.to_h).to eql({
41
+ 'bic'=>"HYVEDEMMXXX",
42
+ 'iban'=>"HUkkbbbsssskcccccccccccccccx",
43
+ 'name' => "Peter Pan",
44
+ 'sepa' => {
45
+ "KREF"=>"",
46
+ "EREF"=>"TRX-0A4A47C3-F846-4729-8A1B-5DF620F",
47
+ "MREF"=>"CAC97D2144174318AC18D9BF815BD4FB",
48
+ "CRED"=>"DE98ZZZ09999999999",
49
+ "SVWZ"=>"FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F"
50
+ },
51
+ 'information' => "KREF+EREF+TRX-0A4A47C3-F846-4729-8A1B-5DF620FMREF+CAC97D2144174318AC18D9BF815BD4FBCRED+DE98ZZZ09999999999SVWZ+FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F",
52
+ 'description' => "SEPA LASTSCHRIFT KUNDE",
53
+ 'sub_fields' => {
54
+ "00"=>"SEPA LASTSCHRIFT KUNDE",
55
+ "10"=>"281",
56
+ "20"=>"KREF+EREF+TRX-0A4A47C3-F846-4729",
57
+ "21"=>"-8A1B-5DF620F",
58
+ "22"=>"MREF+CAC97D2144174318AC18D9",
59
+ "23"=>"BF815BD4FB",
60
+ "24"=>"CRED+DE98ZZZ09999999999",
61
+ "25"=>"SVWZ+FOO TRX-0A4A47C3-F84",
62
+ "26"=>"6-4729-8A1B-5DF620F",
63
+ "30"=>"HYVEDEMMXXX",
64
+ "31"=>"HUkkbbbsssskcccccccccccccccx",
65
+ "32"=>"Peter Pan",
66
+ "34"=>"171",
67
+ "99" => ""
68
+ },
69
+ 'transaction_code' => "171",
70
+ 'details' => "?00SEPA LASTSCHRIFT KUNDE?10281?20KREF+EREF+TRX-0A4A47C3-F846-4729?21-8A1B-5DF620F?22MREF+CAC97D2144174318AC18D9?23BF815BD4FB?24CRED+DE98ZZZ09999999999?25SVWZ+FOO TRX-0A4A47C3-F84?266-4729-8A1B-5DF620F?30HYVEDEMMXXX?31HUkkbbbsssskcccccccccccccccx?32Peter Pan?99?34171"}
71
+ )
72
+ }
39
73
  it { expect(subject.to_hash).to eql(subject.to_h) }
40
74
  end
41
75
 
@@ -1 +1 @@
1
- :86:171?00SEPA LASTSCHRIFT KUNDE?10281?20EREF+TRX-0A4A47C3-F846-4729?21-8A1B-5DF620F?22MREF+CAC97D2144174318AC18D9?23BF815BD4FB?24CRED+DE98ZZZ09999999999?25SVWZ+FOO TRX-0A4A47C3-F84?266-4729-8A1B-5DF620F?30HYVEDEMMXXX?31HUkkbbbsssskcccccccccccccccx?32Peter Pan?99?34171
1
+ :86:171?00SEPA LASTSCHRIFT KUNDE?10281?20KREF+EREF+TRX-0A4A47C3-F846-4729?21-8A1B-5DF620F?22MREF+CAC97D2144174318AC18D9?23BF815BD4FB?24CRED+DE98ZZZ09999999999?25SVWZ+FOO TRX-0A4A47C3-F84?266-4729-8A1B-5DF620F?30HYVEDEMMXXX?31HUkkbbbsssskcccccccccccccccx?32Peter Pan?99?34171
@@ -12,7 +12,54 @@ describe Cmxl::Transaction do
12
12
  it { expect(subject.amount).to eql(1.62)}
13
13
  it { expect(subject.statement_line.amount).to eql(1.62)}
14
14
  it { expect(subject.amount_in_cents).to eql(162)}
15
- it { expect(subject.to_h).to eql({"date"=>Date.new(2014,9,1), "sha" => "3c5e65aa3d3878b06b58b6f1ae2f3693004dfb04e3ab7119a1c1244e612293da", "entry_date"=>Date.new(2014,9,2), "funds_code"=>"D", "currency_letter"=>"R", "amount"=>1.62, "swift_code"=>"NTRF", "reference"=>"0000549855700010", "bank_reference"=>"025498557/000001", "amount_in_cents"=>162, "sign"=>-1, "debit"=>true, "credit"=>false, "bic"=>"HYVEDEMMXXX", "iban"=>"HUkkbbbsssskcccccccccccccccx", "name"=>"Peter Pan", "sepa"=>{"EREF"=>"TRX-0A4A47C3-F846-4729-8A1B-5DF620F", "MREF"=>"CAC97D2144174318AC18D9BF815BD4FB", "CRED"=>"DE98ZZZ09999999999", "SVWZ"=>"FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F"}, "information"=>"EREF+TRX-0A4A47C3-F846-4729-8A1B-5DF620FMREF+CAC97D2144174318AC18D9BF815BD4FBCRED+DE98ZZZ09999999999SVWZ+FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F", "description"=>"SEPA LASTSCHRIFT KUNDE", "sub_fields"=>{"00"=>"SEPA LASTSCHRIFT KUNDE", "10"=>"281", "20"=>"EREF+TRX-0A4A47C3-F846-4729", "21"=>"-8A1B-5DF620F", "22"=>"MREF+CAC97D2144174318AC18D9", "23"=>"BF815BD4FB", "24"=>"CRED+DE98ZZZ09999999999", "25"=>"SVWZ+FOO TRX-0A4A47C3-F84", "26"=>"6-4729-8A1B-5DF620F", "30"=>"HYVEDEMMXXX", "31"=>"HUkkbbbsssskcccccccccccccccx", "32"=>"Peter Pan", "99" => "", "34"=>"171"}, "transaction_code"=>"171", "details"=>"?00SEPA LASTSCHRIFT KUNDE?10281?20EREF+TRX-0A4A47C3-F846-4729?21-8A1B-5DF620F?22MREF+CAC97D2144174318AC18D9?23BF815BD4FB?24CRED+DE98ZZZ09999999999?25SVWZ+FOO TRX-0A4A47C3-F84?266-4729-8A1B-5DF620F?30HYVEDEMMXXX?31HUkkbbbsssskcccccccccccccccx?32Peter Pan?99?34171"}) }
15
+ it { expect(subject.to_h).to eql(
16
+ {
17
+ "date" => Date.new(2014,9,1),
18
+ "sha" => "3c5e65aa3d3878b06b58b6f1ae2f3693004dfb04e3ab7119a1c1244e612293da",
19
+ "entry_date" => Date.new(2014,9,2),
20
+ "funds_code" => "D",
21
+ "currency_letter" => "R",
22
+ "amount" => 1.62,
23
+ "swift_code" => "NTRF",
24
+ "reference" => "0000549855700010",
25
+ "bank_reference" => "025498557/000001",
26
+ "amount_in_cents" => 162,
27
+ "sign" => -1,
28
+ "debit" => true,
29
+ "credit" => false,
30
+ "bic" => "HYVEDEMMXXX",
31
+ "iban" => "HUkkbbbsssskcccccccccccccccx",
32
+ "name" => "Peter Pan",
33
+ "sepa" => {
34
+ "KREF" => "",
35
+ "EREF" => "TRX-0A4A47C3-F846-4729-8A1B-5DF620F",
36
+ "MREF" => "CAC97D2144174318AC18D9BF815BD4FB",
37
+ "CRED" => "DE98ZZZ09999999999",
38
+ "SVWZ" => "FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F"
39
+ },
40
+ "information" => "KREF+EREF+TRX-0A4A47C3-F846-4729-8A1B-5DF620FMREF+CAC97D2144174318AC18D9BF815BD4FBCRED+DE98ZZZ09999999999SVWZ+FOO TRX-0A4A47C3-F846-4729-8A1B-5DF620F",
41
+ "description" => "SEPA LASTSCHRIFT KUNDE",
42
+ "sub_fields" => {
43
+ "00" => "SEPA LASTSCHRIFT KUNDE",
44
+ "10" => "281",
45
+ "20" => "KREF+EREF+TRX-0A4A47C3-F846-4729",
46
+ "21" => "-8A1B-5DF620F",
47
+ "22" => "MREF+CAC97D2144174318AC18D9",
48
+ "23" => "BF815BD4FB",
49
+ "24" => "CRED+DE98ZZZ09999999999",
50
+ "25" => "SVWZ+FOO TRX-0A4A47C3-F84",
51
+ "26" => "6-4729-8A1B-5DF620F",
52
+ "30" => "HYVEDEMMXXX",
53
+ "31" => "HUkkbbbsssskcccccccccccccccx",
54
+ "32" => "Peter Pan",
55
+ "99" => "",
56
+ "34" => "171"
57
+ },
58
+ "transaction_code" => "171",
59
+ "details" => "?00SEPA LASTSCHRIFT KUNDE?10281?20KREF+EREF+TRX-0A4A47C3-F846-4729?21-8A1B-5DF620F?22MREF+CAC97D2144174318AC18D9?23BF815BD4FB?24CRED+DE98ZZZ09999999999?25SVWZ+FOO TRX-0A4A47C3-F84?266-4729-8A1B-5DF620F?30HYVEDEMMXXX?31HUkkbbbsssskcccccccccccccccx?32Peter Pan?99?34171"
60
+ }
61
+ )
62
+ }
16
63
  end
17
64
 
18
65
  context 'without details' do
@@ -23,6 +70,7 @@ describe Cmxl::Transaction do
23
70
  it { expect(subject.entry_date).to eql(Date.new(2014,9,2))}
24
71
  it { expect(subject.amount).to eql(1.62)}
25
72
  it { expect(subject.amount_in_cents).to eql(162)}
26
- it { expect(subject.to_h).to eql({"date"=>Date.new(2014,9,1), "sha" => "3c5e65aa3d3878b06b58b6f1ae2f3693004dfb04e3ab7119a1c1244e612293da", "entry_date"=>Date.new(2014,9,2), "funds_code"=>"D", "currency_letter"=>"R", "amount"=>1.62, "swift_code"=>"NTRF", "reference"=>"0000549855700010", "bank_reference"=>"025498557/000001", "amount_in_cents"=>162, "sign"=>-1, "debit"=>true, "credit"=>false}) }
73
+ it { expect(subject.to_h).to eql({"date" => Date.new(2014,9,1),
74
+ "sha" => "3c5e65aa3d3878b06b58b6f1ae2f3693004dfb04e3ab7119a1c1244e612293da", "entry_date"=>Date.new(2014,9,2), "funds_code"=>"D", "currency_letter"=>"R", "amount"=>1.62, "swift_code"=>"NTRF", "reference"=>"0000549855700010", "bank_reference"=>"025498557/000001", "amount_in_cents"=>162, "sign"=>-1, "debit"=>true, "credit"=>false}) }
27
75
  end
28
76
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmxl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Michael Bumann
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-10-13 00:00:00.000000000 Z
11
+ date: 2016-02-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.5'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.5'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '3.0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '3.0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rchardet19
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Cmxl provides an friendly, extensible and customizable parser for the
@@ -83,8 +74,8 @@ executables: []
83
74
  extensions: []
84
75
  extra_rdoc_files: []
85
76
  files:
86
- - .gitignore
87
- - .travis.yml
77
+ - ".gitignore"
78
+ - ".travis.yml"
88
79
  - CHANGELOG.mdown
89
80
  - Gemfile
90
81
  - LICENSE.txt
@@ -133,29 +124,28 @@ files:
133
124
  homepage: https://github.com/railslove/cmxl
134
125
  licenses:
135
126
  - MIT
136
- post_install_message: ! "Thanks for using Cmxl - your friendly MT940 parser!\nWe hope
127
+ metadata: {}
128
+ post_install_message: "Thanks for using Cmxl - your friendly MT940 parser!\nWe hope
137
129
  we can make dealing with MT940 files a bit more fun. :) \nPlease create an issue
138
130
  on github if anything is not as expected.\n\n"
139
131
  rdoc_options: []
140
132
  require_paths:
141
133
  - lib
142
134
  required_ruby_version: !ruby/object:Gem::Requirement
143
- none: false
144
135
  requirements:
145
- - - ! '>='
136
+ - - ">="
146
137
  - !ruby/object:Gem::Version
147
138
  version: '0'
148
139
  required_rubygems_version: !ruby/object:Gem::Requirement
149
- none: false
150
140
  requirements:
151
- - - ! '>='
141
+ - - ">="
152
142
  - !ruby/object:Gem::Version
153
143
  version: '0'
154
144
  requirements: []
155
145
  rubyforge_project:
156
- rubygems_version: 1.8.23.2
146
+ rubygems_version: 2.4.5.1
157
147
  signing_key:
158
- specification_version: 3
148
+ specification_version: 4
159
149
  summary: Cmxl is your friendly MT940 bank statement parser
160
150
  test_files:
161
151
  - spec/field_spec.rb