cmxl 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cmxl/field.rb +3 -1
- data/lib/cmxl/statement.rb +9 -7
- data/lib/cmxl/transaction.rb +3 -1
- data/lib/cmxl/version.rb +1 -1
- data/spec/field_spec.rb +4 -1
- data/spec/fields/reference_spec.rb +1 -0
- data/spec/fields/statement_details_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef139423daa5f2df7f4e36f91b99cb9cc0f33a74
|
4
|
+
data.tar.gz: 3e3809a8d2fd6a073c198e42222e0545ef40d5ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82192a04913840d6ab0e37c19dbfb908a42a249178133bcd2e488441b700ab3526063b823a04e451e54c48374a8ec7a4a4c722369cb319a3a4c86173d39fa82e
|
7
|
+
data.tar.gz: c3ce22ebff413224d72061e0714b61201a422168d50d2791efe07d77af2cf4dee26e598dcb6822fe2c99a411d1fae96d198df463760526e984dcbae616b98c20
|
data/lib/cmxl/field.rb
CHANGED
data/lib/cmxl/statement.rb
CHANGED
@@ -77,15 +77,17 @@ module Cmxl
|
|
77
77
|
'reference' => reference,
|
78
78
|
'sha' => sha,
|
79
79
|
'generation_date' => generation_date,
|
80
|
-
'account_identification' => account_identification,
|
81
|
-
'opening_balance' => opening_balance,
|
82
|
-
'closing_balance' => closing_balance,
|
83
|
-
'available_balance' => available_balance,
|
84
|
-
'transactions' => transactions,
|
85
|
-
'fields' => fields
|
80
|
+
'account_identification' => account_identification.to_h,
|
81
|
+
'opening_balance' => opening_balance.to_h,
|
82
|
+
'closing_balance' => closing_balance.to_h,
|
83
|
+
'available_balance' => available_balance.to_h,
|
84
|
+
'transactions' => transactions.map(&:to_h),
|
85
|
+
'fields' => fields.map(&:to_h)
|
86
86
|
}
|
87
87
|
end
|
88
|
-
|
88
|
+
def to_hash
|
89
|
+
to_h
|
90
|
+
end
|
89
91
|
def to_json(*args)
|
90
92
|
to_h.to_json(*args)
|
91
93
|
end
|
data/lib/cmxl/transaction.rb
CHANGED
data/lib/cmxl/version.rb
CHANGED
data/spec/field_spec.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Cmxl::Field do
|
4
|
-
subject { Cmxl::Field.new('D140829EUR000000000147,64') }
|
4
|
+
subject { Cmxl::Field.new('D140829EUR000000000147,64', nil, 42) }
|
5
5
|
|
6
6
|
it { expect(Cmxl::Field.parser).to eql(/(?<details>.*)/) } # default must be set
|
7
7
|
|
8
|
+
it { expect(subject.to_h).to eql({'tag' => 42, 'details' => 'D140829EUR000000000147,64'}) }
|
9
|
+
it { expect(subject.to_hash).to eql(subject.to_h) }
|
10
|
+
|
8
11
|
it { expect(subject.to_amount('123.')).to eql(123.00) }
|
9
12
|
it { expect(subject.to_amount('123.1')).to eql(123.10) }
|
10
13
|
it { expect(subject.to_amount('123.11')).to eql(123.11) }
|
@@ -9,4 +9,5 @@ describe Cmxl::Fields::Reference do
|
|
9
9
|
it { expect(subject.statement_identifier).to eql('D') }
|
10
10
|
it { expect(subject.additional_number).to eql('049') }
|
11
11
|
it { expect(subject.to_h).to eql({"tag" => '20', "statement_identifier"=>"D", "date"=> Date.new(2014,9,2), "additional_number"=>"049", "reference"=>"D140902049"}) }
|
12
|
+
it { expect(subject.to_hash).to eql(subject.to_h) }
|
12
13
|
end
|
@@ -35,6 +35,7 @@ describe Cmxl::Fields::StatementDetails do
|
|
35
35
|
}) }
|
36
36
|
|
37
37
|
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"}, '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?34171"}) }
|
38
|
+
it { expect(subject.to_hash).to eql(subject.to_h) }
|
38
39
|
end
|
39
40
|
|
40
41
|
end
|