ynab_convert 1.0.3 → 1.0.6

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: 2af241f007b8495197a8971ffbf3b3efe0dda41411c56a3543452dfea50fd03e
4
- data.tar.gz: ac7c2614c064e005524c808dd62bddbbaaa8e8395bea6a02b0bf4ef45960133f
3
+ metadata.gz: 697f0d80eaec169e83bea48407e9d00c1b000a362aaa6147160be65bafef72a7
4
+ data.tar.gz: 8e45ffa5ec9094c54057ebba3f241c00764fc0e256ec19bdfa0d9395f590a156
5
5
  SHA512:
6
- metadata.gz: 3f96f0a1839d1bc4111f8f53aeac6f7b503155f65b03e2ccd113e0847baa8637beeef7aeae182538b3f6f4cd5caf5a462b568b0ffae5a42f24062722c4a51cf7
7
- data.tar.gz: 4f17efacff3b4b5cb62df38997863bad691b41a4f26d5a27ef3b7bfaa93072f217f4a824f11dd6e462ba422f862991e5ae14990e7f5f8c8879f49a7deba91274
6
+ metadata.gz: 8150a18508c46b6267b38ccf56ff6b542e82df49100c4fff164959a24445a36e8271cfca6bd07abbc583f76d372bfc77f9ab830a88dd9e37eb5d95af15ab6ef5
7
+ data.tar.gz: 7490a9741e4bf27fd21e526fe4aff6c777cca8882f64a9558ceb698f16b7c080f92ae24ebf136a21c3768f5e76077c4ccbe6536a81cdc0cd0dec1453e279a40d
data/.travis.yml CHANGED
@@ -3,12 +3,12 @@ language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
5
  - 2.6
6
+ - 2.7
6
7
  before_install: gem install bundler
7
8
 
8
9
  jobs:
9
10
  include:
10
11
  - stage: test
11
- rvm: 2.6
12
12
  script: echo "Running tests for $(ruby -v)..." && bundle exec rake ci
13
13
  - stage: gem release
14
14
  rvm: 2.6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ynab_convert (1.0.3)
4
+ ynab_convert (1.0.6)
5
5
  i18n
6
6
  slop
7
7
 
data/bin/ynab_convert CHANGED
@@ -9,7 +9,6 @@ require 'ynab_convert/processors'
9
9
  require 'ynab_convert/logger'
10
10
  require 'ynab_convert/error'
11
11
  require 'slop/symbol'
12
- require 'pry'
13
12
 
14
13
  # Add mixins and run converter
15
14
  class Convert
@@ -5,7 +5,8 @@ require 'csv'
5
5
  require 'ynab_convert/logger'
6
6
 
7
7
  module Processor
8
- # Base class for a Processor, all processors must inherit from it
8
+ # Base class for a Processor, all processors must inherit from it.
9
+
9
10
  # rubocop:disable Metrics/ClassLength
10
11
  class Base
11
12
  include YnabLogger
@@ -13,8 +14,8 @@ module Processor
13
14
 
14
15
  attr_reader :loader_options
15
16
 
16
- # @option opts [String] :file Path to the CSV file to process
17
- # @option opts [Symbol] :format YNAB4 format to use, one of :flows or
17
+ # @option options [String] :file Path to the CSV file to process
18
+ # @option options [Symbol] :format YNAB4 format to use, one of :flows or
18
19
  # :amounts. :flows is useful for CSVs with separate debit and credit
19
20
  # columns, :amounts is for CSVs with only one amount columns and +/-
20
21
  # numbers. See
@@ -140,8 +141,8 @@ module Processor
140
141
  logger.debug "Will write to `#{temp_filename}'"
141
142
 
142
143
  logger.debug(loader_options)
143
- CSV.open(temp_filename, 'wb', output_options) do |converted|
144
- CSV.foreach(@file, 'rb', loader_options) do |row|
144
+ CSV.open(temp_filename, 'wb', **output_options) do |converted|
145
+ CSV.foreach(@file, 'rb', **loader_options) do |row|
145
146
  logger.debug "Parsing row: `#{row.to_h}'"
146
147
  # Some rows don't contain valid or useful data
147
148
  catch :skip_row do
@@ -2,21 +2,6 @@
2
2
 
3
3
  module Processor
4
4
  # Processes CSV files from N26
5
- #
6
- # An example of how to implement a custom processor
7
- # Processes CSV files with this format:
8
- # <<~ROWS
9
- # "Date","Payee","Memo","Outflow","Inflow"
10
- # "23/12/2019","coaxial","","1000000.00",""
11
- # "30/12/2019","Santa","","50000.00",""
12
- # "02/02/2020","Someone Else","","45.00",""
13
- # ROWS
14
- # The file name for the processor should be the institution name in
15
- # camel case. It's ok to skip "Bank" or "Credit Union" when naming the file
16
- # if it's redundant. For instance, this parser is for "Example Bank" but it's
17
- # named "example.rb", its corresponding spec is
18
- # "spec/example_processor_spec.rb" and its fixture would be
19
- # "spec/fixtures/example.csv"
20
5
  class N26 < Processor::Base
21
6
  # @option options [String] :file Path to the CSV file to process
22
7
  def initialize(options)
@@ -59,12 +59,26 @@ module Processor
59
59
  end
60
60
 
61
61
  def transaction_payee(row)
62
- # Transaction description is spread over 3 columns
62
+ # Transaction description is spread over 3 columns.
63
+ # Moreover, UBS thought wise to append a bunch of junk information after
64
+ # the transaction details within the third description field. *Most* of
65
+ # this junk starts after the meaningful data and starts with ", OF",
66
+ # ", ON", ", ESR", ", QRR", two digits then five groups of five digits
67
+ # then ", TN" so we discard it; YNAB4 being unable to automatically
68
+ # categorize new transactions at the same store/payee because the payee
69
+ # always looks different (thanks to the variable nature of the appended
70
+ # junk).
71
+ # See `spec/fixtures/ubs_chequing/statement.csv` L2 and L18--22
72
+
73
+ # 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)/
75
+ # rubocop:enable Metrics/LineLength
76
+
63
77
  [
64
78
  row[headers[:payee_line_1]],
65
79
  row[headers[:payee_line_2]],
66
80
  row[headers[:payee_line_3]]
67
- ].join(' ')
81
+ ].join(' ').split(junk_desc_regex).first
68
82
  end
69
83
 
70
84
  def register_custom_converters
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YnabConvert
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.6'
5
5
  end
data/lib/ynab_convert.rb CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'ynab_convert/version'
4
4
  require 'slop'
5
- require 'pry'
6
5
  require 'ynab_convert/logger'
7
6
  require 'core_extensions/string.rb'
8
7
 
data/ynab_convert.gemspec CHANGED
@@ -13,6 +13,21 @@ 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
21
+
22
+ spec.required_ruby_version = '~> 2.6'
23
+
24
+ spec.metadata = {
25
+ 'bug_tracker_uri' => 'https://github.com/coaxial/ynab_convert/issues',
26
+ 'documentation_uri' => 'https://rubydoc.info/github/coaxial/ynab_convert/master',
27
+ 'homepage_uri' => 'https://github.com/coaxial/ynab_convert',
28
+ 'source_code_uri' => 'https://github.com/coaxial/ynab_convert'
29
+ }
30
+ spec.post_install_message = 'Happy budgetting!'
16
31
 
17
32
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
33
  # to allow pushing to a single host or delete this section to allow pushing to any host.
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.3
4
+ version: 1.0.6
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-05 00:00:00.000000000 Z
11
+ date: 2022-03-06 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:
@@ -236,18 +239,20 @@ homepage: https://github.com/coaxial/ynab_convert
236
239
  licenses:
237
240
  - MIT
238
241
  metadata:
239
- allowed_push_host: https://rubygems.org
242
+ bug_tracker_uri: https://github.com/coaxial/ynab_convert/issues
243
+ documentation_uri: https://rubydoc.info/github/coaxial/ynab_convert/master
240
244
  homepage_uri: https://github.com/coaxial/ynab_convert
241
245
  source_code_uri: https://github.com/coaxial/ynab_convert
242
- post_install_message:
246
+ allowed_push_host: https://rubygems.org
247
+ post_install_message: Happy budgetting!
243
248
  rdoc_options: []
244
249
  require_paths:
245
250
  - lib
246
251
  required_ruby_version: !ruby/object:Gem::Requirement
247
252
  requirements:
248
- - - ">="
253
+ - - "~>"
249
254
  - !ruby/object:Gem::Version
250
- version: '0'
255
+ version: '2.6'
251
256
  required_rubygems_version: !ruby/object:Gem::Requirement
252
257
  requirements:
253
258
  - - ">="