camt 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,71 @@
1
+ RSpec.describe Camt::Transaction do
2
+
3
+ let(:filename) { "camt.xml" }
4
+ let(:file) { Camt::File.parse(::File.expand_path("../sample_files/" << filename, __FILE__)) }
5
+ let(:doc) { file.doc.tap { |doc| doc.remove_namespaces! } }
6
+ let(:node) { doc.xpath('//BkToCstmrStmt/Stmt/Ntry')[1] }
7
+ let(:country_code) { "NL" }
8
+
9
+ subject { described_class.new(node, country_code) }
10
+
11
+ describe "#execution_date" do
12
+ let(:expected) { Date.parse("2013-04-02") }
13
+
14
+ it "has the value from the parsed file" do
15
+ expect(subject.execution_date).to eq expected
16
+ end
17
+ end
18
+
19
+ describe "#effective_date" do
20
+ let(:expected) { Date.parse("2013-04-02") }
21
+
22
+ it "has the value from the parsed file" do
23
+ expect(subject.effective_date).to eq expected
24
+ end
25
+ end
26
+
27
+ describe "#transfer_type" do
28
+ let(:expected) { {proprietary_code: "N654", proprietary_issuer: "ABNAMRO"} }
29
+
30
+ it "has the value from the parsed file" do
31
+ expect(subject.transfer_type).to eq expected
32
+ end
33
+ end
34
+
35
+ describe "#transferred_amount" do
36
+ let(:expected) { 1.0 }
37
+
38
+ it "has the value from the parsed file" do
39
+ expect(subject.transferred_amount).to eq expected
40
+ end
41
+ end
42
+
43
+ describe "#transaction_details" do
44
+ let :expected do
45
+ [{
46
+ :messages => ["OMSCHRIJVING"],
47
+ :references => ["NOTPROVIDED"],
48
+ :party => {
49
+ :remote_owner => "NAAM",
50
+ :remote_owner_country => nil,
51
+ :remote_owner_address => nil,
52
+ :remote_account => "NL46ABNA0499998748",
53
+ :remote_bank_bic => "ABNANL2A"
54
+ }
55
+ }]
56
+ end
57
+
58
+ it "has the value from the parsed file" do
59
+ expect(subject.transaction_details).to eq expected
60
+ end
61
+ end
62
+
63
+ describe "#purpose" do
64
+ let(:expected) { "/TRTP/SEPA OVERBOEKING/IBAN/NL46ABNA0499998748/BIC/" \
65
+ "ABNANL2A/NAME/NAAM/REMI/OMSCHRIJVING/EREF/NOTPROVIDED" }
66
+
67
+ it "has the value from the parsed file" do
68
+ expect(subject.purpose).to eq expected
69
+ end
70
+ end
71
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reinier de Lange
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-27 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description: A gem for parsing CAMT.053 files
56
84
  email:
57
85
  - r.j.delange@nedforce.nl
@@ -60,20 +88,35 @@ extensions: []
60
88
  extra_rdoc_files: []
61
89
  files:
62
90
  - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
63
93
  - Gemfile
64
94
  - LICENSE.txt
65
95
  - README.md
66
96
  - Rakefile
67
97
  - camt.gemspec
68
98
  - lib/camt.rb
99
+ - lib/camt/amount.rb
69
100
  - lib/camt/file.rb
70
- - lib/camt/object_extension.rb
71
101
  - lib/camt/parser.rb
102
+ - lib/camt/statement.rb
103
+ - lib/camt/transaction.rb
72
104
  - lib/camt/version.rb
73
- - test/files/camt.xml
74
- - test/test_helper.rb
75
- - test/unit/camt/file_test.rb
76
- - test/unit/camt/parser_test.rb
105
+ - spec/amount_spec.rb
106
+ - spec/file_spec.rb
107
+ - spec/integration/camt.xml_spec.rb
108
+ - spec/integration/camt_germany_01.xml_spec.rb
109
+ - spec/integration/camt_switzerland_01.xml_spec.rb
110
+ - spec/integration/camt_switzerland_02.xml_spec.rb
111
+ - spec/sample_files/camt.xml
112
+ - spec/sample_files/camt_error.xml
113
+ - spec/sample_files/camt_germany_01.xml
114
+ - spec/sample_files/camt_switzerland_01.xml
115
+ - spec/sample_files/camt_switzerland_02.xml
116
+ - spec/spec_helper.rb
117
+ - spec/statement_spec.rb
118
+ - spec/support/camt.053_integration.rb
119
+ - spec/transaction_spec.rb
77
120
  homepage: ''
78
121
  licenses:
79
122
  - MIT
@@ -94,12 +137,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
137
  version: '0'
95
138
  requirements: []
96
139
  rubyforge_project:
97
- rubygems_version: 2.2.2
140
+ rubygems_version: 2.4.2
98
141
  signing_key:
99
142
  specification_version: 4
100
143
  summary: A gem for parsing CAMT.053 file
101
144
  test_files:
102
- - test/files/camt.xml
103
- - test/test_helper.rb
104
- - test/unit/camt/file_test.rb
105
- - test/unit/camt/parser_test.rb
145
+ - spec/amount_spec.rb
146
+ - spec/file_spec.rb
147
+ - spec/integration/camt.xml_spec.rb
148
+ - spec/integration/camt_germany_01.xml_spec.rb
149
+ - spec/integration/camt_switzerland_01.xml_spec.rb
150
+ - spec/integration/camt_switzerland_02.xml_spec.rb
151
+ - spec/sample_files/camt.xml
152
+ - spec/sample_files/camt_error.xml
153
+ - spec/sample_files/camt_germany_01.xml
154
+ - spec/sample_files/camt_switzerland_01.xml
155
+ - spec/sample_files/camt_switzerland_02.xml
156
+ - spec/spec_helper.rb
157
+ - spec/statement_spec.rb
158
+ - spec/support/camt.053_integration.rb
159
+ - spec/transaction_spec.rb
@@ -1,11 +0,0 @@
1
- unless Object.respond_to?(:try)
2
- class Object
3
- def try(*a, &b)
4
- if a.empty? && block_given?
5
- yield self
6
- else
7
- public_send(*a, &b) if respond_to?(a.first)
8
- end
9
- end
10
- end
11
- end
@@ -1,3 +0,0 @@
1
- require 'test/unit'
2
- require 'camt'
3
- require 'debugger'
@@ -1,23 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Camt
4
- class FileTest < Test::Unit::TestCase
5
-
6
- def setup
7
- @file = Camt::File.parse (::File.dirname(__FILE__) + '/../../files/camt.xml')
8
- end
9
-
10
- def test_should_have_messages
11
- assert @file.messages.any?
12
- end
13
-
14
- def test_should_have_statements
15
- assert @file.statements.any?
16
- end
17
-
18
- def test_should_have_transactions
19
- assert @file.transactions.any?
20
- end
21
-
22
- end
23
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Camt
4
- class ParserTest < Test::Unit::TestCase
5
-
6
- end
7
- end