bank_statement_parser 0.0.6 → 0.0.7

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: fda2797823d21a6f4f8b438c59cd7eb1cfd994a0
4
- data.tar.gz: d98654067e0e2cf05300324b8b73066ea1aad925
3
+ metadata.gz: 20419cf4efafb313fb6fb1c05e155ae19ab8a2cb
4
+ data.tar.gz: 73fd424e13f01b0b24b4e61358f10e98decbf524
5
5
  SHA512:
6
- metadata.gz: 670ac0361e50588072428059ec7c2bc20d6a53e310ed9eed4a91f4fed392acec6e5fc9627f07009b24f6d0a7b126b5e2ef15e40ebb98131b04bdd86061b3b87a
7
- data.tar.gz: 8308156691543687651f998b3863bba3db5e4d875b1da7090ded53762d47efe0819250efa311a9af091f9e5516b5c6c345663cef47cce9db7da6d761a4d39378
6
+ metadata.gz: 166ee13fcb728dfe63cd5362e521a4bbbc8f0f65c5f0f16dc1727e0c989d333f31e266447ee12b1873c2e34d54bb45507f59e2759e029bcc336f4f3ac2fdc6bd
7
+ data.tar.gz: de6c49af93653c9452a5e9e970dfee3f3138b27320210e2a9835baa45d3de30c6d85258b825cd820166efbf36dde63f687bd8cb6726871d31493a2c3d3789ea8
@@ -350,6 +350,9 @@ module BankStatementParser
350
350
  paid_out.delete!(",") unless paid_out.nil?
351
351
  paid_in.delete!(",") unless paid_in.nil?
352
352
  balance = col_fragments[4]
353
+ unless balance.nil?
354
+ balance = balance.delete(",").to_f
355
+ end
353
356
 
354
357
  if !paid_out.nil? || !paid_in.nil?
355
358
  logger.debug { "Found the end of a record (group)" }
@@ -363,7 +366,8 @@ module BankStatementParser
363
366
  type: @cached_payment_type,
364
367
  credit: record_credit,
365
368
  amount: record_amount,
366
- detail: full_details)
369
+ detail: full_details,
370
+ balance: balance)
367
371
  logger.debug { "Created statement record: #{record}" }
368
372
  @records << record
369
373
 
@@ -19,20 +19,23 @@ module BankStatementParser
19
19
 
20
20
  # A bank statement record
21
21
  class StatementRecord
22
- attr_accessor :date, :type, :credit, :amount, :detail
22
+ attr_accessor :date, :type, :credit, :amount, :detail, :balance
23
23
 
24
24
  # Constructor
25
- def initialize date: nil, type: nil, credit: nil, amount: nil, detail: nil
25
+ def initialize date: nil, type: nil, credit: nil, amount: nil, detail: nil,
26
+ balance: nil
27
+
26
28
  @date = date
27
29
  @type = type
28
30
  @credit = credit
29
31
  @amount = amount
30
32
  @detail = detail
33
+ @balance = balance
31
34
  end
32
35
 
33
36
  # Stringify
34
37
  def to_s
35
- "%s:%s:%s:%f:%s" % [date, type, credit.to_s, amount, detail]
38
+ "%s:%s:%s:%f:%s:%f" % [date, type, credit.to_s, amount, detail, balance]
36
39
  end
37
40
 
38
41
  # Equality test
@@ -41,7 +44,8 @@ module BankStatementParser
41
44
  type == other.type &&
42
45
  credit == other.credit &&
43
46
  amount == other.amount &&
44
- detail = other.detail)
47
+ detail == other.detail &&
48
+ balance == other.balance)
45
49
  end
46
50
  end
47
51
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bank_statement_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Dawson