ynab_convert 1.0.5 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58ad75b7f1c6b3093257d8ffb95068967324a621be48bc6e08063548d4a9f2bd
4
- data.tar.gz: 70bc35076e068aece838b52853f5b7f7656199b67e5b2f3ca78a4aec66037ffb
3
+ metadata.gz: '01824e596b5db266fa8e21210a6ec3bb6742f2ead99a38a9b3ad94cb05f2c8f2'
4
+ data.tar.gz: d85fe2a7025389684640282aec1ea75ec7d933aac9c3940b38839bd156c9aa12
5
5
  SHA512:
6
- metadata.gz: 56621762f02d97515a0f3ce829d5b7bfe9ffb1fe862a6b0e92197ac2b555abe84102900f7eef28f67c7c0570efdf0bc3ea8005c8adb68f9c598a7f0fba94f6e9
7
- data.tar.gz: 86a99a7d007c05b7aa3f6e6f3ed211ac009989bd8e31fefbef0db3d9a503dc765ecea825b9e1f6d237d2e26c7c59a455010f975183085037cf8bd2dcb95e8a04
6
+ metadata.gz: 2215ad54cc79274403b940459c50b287789f3c4b7df632187381d97bb99c55ba4f96df372e8bfb2087fd20eef70d0e47d2a8fd1b5d4ecc2d008826230aa74a00
7
+ data.tar.gz: a1486eb5cfba186a661e8f0458c5b78bf985093812e02f551051047b8fd45ca58266cc4b18622b5d00a3e5e17a44286cd366cf01493aab68f24f8bb9eda031a7
data/.gitignore CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ # test artifacts
14
+ *_ynab4.csv
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ynab_convert (1.0.5)
4
+ ynab_convert (1.0.8)
5
5
  i18n
6
6
  slop
7
7
 
@@ -59,22 +59,48 @@ module Processor
59
59
  end
60
60
 
61
61
  def transaction_payee(row)
62
+ raw_payee_line = [
63
+ row[headers[:payee_line_2]],
64
+ row[headers[:payee_line_3]]
65
+ ]
66
+
62
67
  # Transaction description is spread over 3 columns.
68
+ # There are two types of entries:
69
+ # 1. only the first column contains data
70
+ # 2. all three columns contain data, most of it junk
71
+ #
72
+ # Cleaning them up means dropping the first column if there is anything
73
+ # in the other columns;
74
+ # removing the CARD 00000000-0 0000 at the beginning of debit card
75
+ # payment entries;
76
+ # removing the rest of the junk appended after the worthwhile data (see
77
+ # below for details on that)
78
+ if row[headers[:payee_line_2]].nil?
79
+ # Make it an Array, for consistency
80
+ raw_payee_line = [row[headers[:payee_line_1]]]
81
+ end
82
+
83
+ concat_payee_line = raw_payee_line.join(' ')
84
+
63
85
  # Moreover, UBS thought wise to append a bunch of junk information after
64
86
  # the transaction details within the third description field. *Most* of
65
87
  # this junk starts after the meaningful data and starts with ", OF",
66
- # ", ON", ", ESR", two digits then five groups of five digits then ", TN"
67
- # so we discard it; YNAB4 being unable to automatically categorize new
68
- # transactions at the same store/payee because the payee always looks
69
- # different (thanks to the variable nature of the appended junk).
70
- # See `spec/fixtures/ubs_chequing/statement.csv` L18 and L2.
71
- junk_desc_regex = /, (O[FN]|ESR|\d{2} \d{5} \d{5} \d{5} \d{5} \d{5}, TN)/
72
-
73
- [
74
- row[headers[:payee_line_1]],
75
- row[headers[:payee_line_2]],
76
- row[headers[:payee_line_3]]
77
- ].join(' ').split(junk_desc_regex).first
88
+ # ", ON", ", ESR", ", QRR", two digits then five groups of five digits
89
+ # then ", TN" so we discard it; YNAB4 being unable to automatically
90
+ # categorize new transactions at the same store/payee because the payee
91
+ # always looks different (thanks to the variable nature of the appended
92
+ # junk).
93
+ # See `spec/fixtures/ubs_chequing/statement.csv` L2 and L18--22
94
+
95
+ # rubocop:disable Metrics/LineLength
96
+ junk_desc_regex = /,? (O[FN]|ESR|QRR|\d{2} \d{5} \d{5} \d{5} \d{5} \d{5}, TN).*/
97
+ # rubocop:enable Metrics/LineLength
98
+
99
+ # Of course, it wouldn't be complete with more junk information at the
100
+ # beginning of *some* lines (debit card payments)
101
+ debit_card_junk_regex = /CARD \d{8}\-\d \d{4} /
102
+
103
+ concat_payee_line.sub(junk_desc_regex, '').sub(debit_card_junk_regex, '')
78
104
  end
79
105
 
80
106
  def register_custom_converters
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YnabConvert
4
- VERSION = '1.0.5'
4
+ VERSION = '1.0.8'
5
5
  end
data/ynab_convert.gemspec CHANGED
@@ -13,6 +13,11 @@ Gem::Specification.new do |spec|
13
13
  spec.summary = 'Convert online banking CSV files to YNAB 4 format.'
14
14
  spec.homepage = 'https://github.com/coaxial/ynab_convert'
15
15
  spec.license = 'MIT'
16
+ spec.description = <<~DESC
17
+ Utility to convert CSV statements into the YNAB4 format for easier
18
+ transation import. Supports several banks and can easily be extended to
19
+ add more.
20
+ DESC
16
21
 
17
22
  spec.required_ruby_version = '~> 2.6'
18
23
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ynab_convert
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - coaxial
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-06 00:00:00.000000000 Z
11
+ date: 2022-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -192,7 +192,10 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- description:
195
+ description: |
196
+ Utility to convert CSV statements into the YNAB4 format for easier
197
+ transation import. Supports several banks and can easily be extended to
198
+ add more.
196
199
  email:
197
200
  - hi@64b.it
198
201
  executables: