rbankgiro 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +24 -0
- data/Rakefile +27 -0
- data/VERSION +1 -0
- data/lib/rbankgiro.rb +3 -3
- data/rbankgiro.gemspec +54 -0
- data/test/fixtures/corrupt_header_09_02_27.txt +7 -0
- data/test/fixtures/file_format_error_09_02_27.txt +7 -0
- data/test/fixtures/missing_transaction_09_02_27.txt +6 -0
- data/test/fixtures/one_too_many_transactions_09_02_27.txt +8 -0
- data/test/fixtures/one_transaction_09_02_27.txt +7 -0
- data/test/test_transactions.rb +1 -1
- metadata +16 -4
data/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2009, Johan Eckerström
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of rbankgiro nor the
|
12
|
+
names of its contributors may be used to endorse or promote products
|
13
|
+
derived from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY Johan Eckerström ''AS IS'' AND ANY
|
16
|
+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gemspec|
|
8
|
+
gemspec.name = "rbankgiro"
|
9
|
+
gemspec.summary = "Parse Bankgiro transaction files"
|
10
|
+
gemspec.description = "Parsing transaction files from swedish Bankgiro central"
|
11
|
+
gemspec.email = "johan@duh.se"
|
12
|
+
gemspec.homepage = "http://github.com/jage/rbankgiro"
|
13
|
+
gemspec.authors = ["Johan Eckerström"]
|
14
|
+
#gemspec.files = FileList['lib/rbankgiro.rb']
|
15
|
+
gemspec.has_rdoc = false
|
16
|
+
end
|
17
|
+
rescue LoadError
|
18
|
+
$stderr.puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
Rake::TestTask.new(:test) do |test|
|
22
|
+
test.libs << 'lib' << 'test'
|
23
|
+
test.pattern = 'test/**/test_*.rb'
|
24
|
+
test.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
task :default => :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.3
|
data/lib/rbankgiro.rb
CHANGED
@@ -42,7 +42,7 @@ module Rbankgiro
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def sum
|
45
|
-
self.collect {|t| t.amount }.
|
45
|
+
self.collect {|t| t.amount }.inject {|s,n| s + n }
|
46
46
|
end
|
47
47
|
|
48
48
|
def inspect
|
@@ -94,7 +94,7 @@ module Rbankgiro
|
|
94
94
|
raise FileFormatError
|
95
95
|
end
|
96
96
|
|
97
|
-
raise PartSumError
|
97
|
+
raise PartSumError unless payments_sum == self.collect {|t| t.amount }.inject {|s,n| s + n }
|
98
98
|
raise TransactionCountError unless number_of_transactions.to_i == self.length
|
99
99
|
when '90'
|
100
100
|
# Total payment check
|
@@ -108,7 +108,7 @@ module Rbankgiro
|
|
108
108
|
raise FileFormatError
|
109
109
|
end
|
110
110
|
|
111
|
-
raise PartSumError
|
111
|
+
raise PartSumError unless payments_sum == self.collect {|t| t.amount }.inject {|s,n| s + n }
|
112
112
|
raise TransactionCountError unless number_of_transactions.to_i == self.length
|
113
113
|
else
|
114
114
|
# Should be handled by previous cases, if it goes here something is wrong
|
data/rbankgiro.gemspec
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{rbankgiro}
|
8
|
+
s.version = "0.1.3"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Johan Eckerstr\303\266m"]
|
12
|
+
s.date = %q{2009-12-06}
|
13
|
+
s.description = %q{Parsing transaction files from swedish Bankgiro central}
|
14
|
+
s.email = %q{johan@duh.se}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"LICENSE",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"lib/rbankgiro.rb",
|
23
|
+
"rbankgiro.gemspec",
|
24
|
+
"test/fixtures/corrupt_header_09_02_27.txt",
|
25
|
+
"test/fixtures/file_format_error_09_02_27.txt",
|
26
|
+
"test/fixtures/missing_transaction_09_02_27.txt",
|
27
|
+
"test/fixtures/one_too_many_transactions_09_02_27.txt",
|
28
|
+
"test/fixtures/one_transaction_09_02_27.txt",
|
29
|
+
"test/helper.rb",
|
30
|
+
"test/test_transaction.rb",
|
31
|
+
"test/test_transactions.rb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://github.com/jage/rbankgiro}
|
34
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.3.5}
|
37
|
+
s.summary = %q{Parse Bankgiro transaction files}
|
38
|
+
s.test_files = [
|
39
|
+
"test/helper.rb",
|
40
|
+
"test/test_transaction.rb",
|
41
|
+
"test/test_transactions.rb"
|
42
|
+
]
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
49
|
+
else
|
50
|
+
end
|
51
|
+
else
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
data/test/test_transactions.rb
CHANGED
@@ -35,7 +35,7 @@ class TestTransactions < Test::Unit::TestCase
|
|
35
35
|
|
36
36
|
def test_transaction_count_error
|
37
37
|
assert_raise(Rbankgiro::TransactionCountError) do
|
38
|
-
Rbankgiro::Transactions.new(fixture_file_path('
|
38
|
+
Rbankgiro::Transactions.new(fixture_file_path('one_too_many_transactions_09_02_27.txt'), '53090965')
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbankgiro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Johan Eckerstr\xC3\xB6m"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-06 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -19,10 +19,22 @@ executables: []
|
|
19
19
|
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
24
|
files:
|
25
|
+
- LICENSE
|
26
|
+
- Rakefile
|
27
|
+
- VERSION
|
25
28
|
- lib/rbankgiro.rb
|
29
|
+
- rbankgiro.gemspec
|
30
|
+
- test/fixtures/corrupt_header_09_02_27.txt
|
31
|
+
- test/fixtures/file_format_error_09_02_27.txt
|
32
|
+
- test/fixtures/missing_transaction_09_02_27.txt
|
33
|
+
- test/fixtures/one_too_many_transactions_09_02_27.txt
|
34
|
+
- test/fixtures/one_transaction_09_02_27.txt
|
35
|
+
- test/helper.rb
|
36
|
+
- test/test_transaction.rb
|
37
|
+
- test/test_transactions.rb
|
26
38
|
has_rdoc: true
|
27
39
|
homepage: http://github.com/jage/rbankgiro
|
28
40
|
licenses: []
|