ynab_convert 1.0.7 → 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: 3d04e0b626a2fc75009e2eb5aee5d7693b0c7882bc82a493380ea697df2f0dc1
4
- data.tar.gz: e79c99994f87108164b22a75a4a5fb806380bd56af092405a653d40487bdbd71
3
+ metadata.gz: '01824e596b5db266fa8e21210a6ec3bb6742f2ead99a38a9b3ad94cb05f2c8f2'
4
+ data.tar.gz: d85fe2a7025389684640282aec1ea75ec7d933aac9c3940b38839bd156c9aa12
5
5
  SHA512:
6
- metadata.gz: 0f99dbb991b1cb948579e5531e2deb2a6353fca1b16709822122c24a2afe40854e12136a8eec8c0167e807c3ce32e4d4cf659c8380fa1700654d535e3ac8e44e
7
- data.tar.gz: 250e64b972b77f55e4805ec8ba53b45bcc348bd3e2e7447dc781d5487979205a4f9d0f157730920e69d08e86f3c06618e6a1921aeb387fb994d6b08bbc642793
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.7)
4
+ ynab_convert (1.0.8)
5
5
  i18n
6
6
  slop
7
7
 
@@ -59,7 +59,29 @@ 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",
@@ -71,14 +93,14 @@ module Processor
71
93
  # See `spec/fixtures/ubs_chequing/statement.csv` L2 and L18--22
72
94
 
73
95
  # rubocop:disable Metrics/LineLength
74
- junk_desc_regex = /,? (O[FN]|ESR|QRR|\d{2} \d{5} \d{5} \d{5} \d{5} \d{5}, TN)/
96
+ junk_desc_regex = /,? (O[FN]|ESR|QRR|\d{2} \d{5} \d{5} \d{5} \d{5} \d{5}, TN).*/
75
97
  # rubocop:enable Metrics/LineLength
76
98
 
77
- [
78
- row[headers[:payee_line_1]],
79
- row[headers[:payee_line_2]],
80
- row[headers[:payee_line_3]]
81
- ].join(' ').split(junk_desc_regex).first
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, '')
82
104
  end
83
105
 
84
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.7'
4
+ VERSION = '1.0.8'
5
5
  end
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.7
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