bank_statement_parser 0.1.4 → 0.1.5
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56d910159a40e7a8683e52c48844705efca7795b
|
4
|
+
data.tar.gz: f569db6c623039c8151e29055437216b024cfdf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48c59ff09a3302c61e077d60215c26b38517aad25ad428b96edcbfe7e38e5750b88d6c08948e16ce481feed967f066b36d69375be87fa0ce2cf43985bb928f3a
|
7
|
+
data.tar.gz: 4a62e039f1b37fdfc15932c24328723ca52b4fa1e6b10b7b85d0090dbd8e422aa5c4c4309aa20f917831ba373acea2db6188733faf26e2d812388b8964544620
|
@@ -21,7 +21,7 @@ module BankStatementParser
|
|
21
21
|
|
22
22
|
# A bank statement
|
23
23
|
class BankStatement
|
24
|
-
attr_accessor :sort_code, :account_number, :statement_date,
|
24
|
+
attr_accessor :name, :sort_code, :account_number, :statement_date,
|
25
25
|
:opening_balance, :closing_balance, :records
|
26
26
|
|
27
27
|
# Constructor
|
@@ -36,7 +36,8 @@ module BankStatementParser
|
|
36
36
|
|
37
37
|
# Equality test
|
38
38
|
def ==(other)
|
39
|
-
super || (
|
39
|
+
super || (name == other.name &&
|
40
|
+
sort_code == other.sort_code &&
|
40
41
|
account_number == other.account_number &&
|
41
42
|
statement_date == other.statement_date &&
|
42
43
|
opening_balance == other.opening_balance &&
|
@@ -76,6 +76,14 @@ module BankStatementParser
|
|
76
76
|
#
|
77
77
|
# Partially works, but doesn't seem to be accessible from subclasses...
|
78
78
|
|
79
|
+
def name
|
80
|
+
@bank_statement.name
|
81
|
+
end
|
82
|
+
|
83
|
+
def name= name
|
84
|
+
@bank_statement.name = name
|
85
|
+
end
|
86
|
+
|
79
87
|
def sort_code
|
80
88
|
@bank_statement.sort_code
|
81
89
|
end
|
@@ -55,6 +55,16 @@ module BankStatementParser
|
|
55
55
|
logger.debug { "Found sort code and account number" }
|
56
56
|
self.sort_code = Regexp.last_match(:sort_code)
|
57
57
|
self.account_number = Regexp.last_match(:account_number)
|
58
|
+
|
59
|
+
if line =~ /^\s*(?<account_name>.+)\s+(\d{2}-\d{2}-\d{2})\s+(\d{8})\s+(\d+)\s*$/
|
60
|
+
# New-style metadata line, first field is account [holder] name
|
61
|
+
self.name = Regexp.last_match(:account_name).strip
|
62
|
+
logger.debug { "Found account holder name (2nd form): #{self.name}" }
|
63
|
+
elsif line =~ /^\s*(?<account_name>.+)\s*,\s+(\d{2}-\d{2}-\d{2})\s+(\d{8})\s*$/
|
64
|
+
# Old-style metadata line, first field is account [holder] name
|
65
|
+
self.name = Regexp.last_match(:account_name).strip
|
66
|
+
logger.debug { "Found account holder name (1st form): #{self.name}" }
|
67
|
+
end
|
58
68
|
end
|
59
69
|
end
|
60
70
|
|