ynab_convert 2.0.0 → 2.0.1

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: 142532dddc82b58043e383e388306801471835c48004fd55b7804709a545999c
4
- data.tar.gz: e7de2e56779760e27e41a3cf3bcbaf265bd66377a80525ad00f7133b57c1b05a
3
+ metadata.gz: b10705667e423e280b312986f423664a84450c6d7aa9f47e8cd99063b8c653c7
4
+ data.tar.gz: 87563fa9a29b8a01145e6406d713114ad275a2f33ab9b27c64bc771a4379f34e
5
5
  SHA512:
6
- metadata.gz: a4e37509faa4be4db330876e0c6af4bb2deb0927b4bb4aa8feb9b1943a69690d8765087cfe72ebeb49161b708999253e7443f5b3275f5cfc42bc3f23e93232cf
7
- data.tar.gz: 4a0eb0cee6a35847ba39d747f6343c39c5cb0750ca8347f9af0ad70fb3d8382ac5e098bbb6b47c8d931b1d095d4829442fd0315b697d6005003ccc8aa7685638
6
+ metadata.gz: 2cd94babe8d7aef861dcfc84d85ba0401b5807af87a3df4c17724663f69ec0d756288929f80089ce7e083068e0d7cc2de4fa45df6767651dbb4929797d59006a
7
+ data.tar.gz: 11562fdf39e805dce87016f28b5f442a5de8716dbda6a5e06d7f0b7208f1ee84f08cdae17908de72c418b221d71a561a34e584b0c2ab7d29c604b19c1b57cc9e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ynab_convert (2.0.0)
4
+ ynab_convert (2.0.1)
5
5
  i18n
6
6
  slop
7
7
  timecop
data/README.md CHANGED
@@ -28,7 +28,6 @@ latest one on 2019-12-01.
28
28
  ---|---|---|---
29
29
  `example` | Example Bank | N/A | Reference processor implementation, not a real institution
30
30
  `n26` | N26 | [n26.com](n26.com) | N26 CSV statements, will convert EUR amounts to CHF (hardcoded for now)
31
- `revolut` | Revolut Ltd | [revolut.com](https://www.revolut.com/) | The processor isn't aware of currencies. Make sure the statements processed with `revolut` are in the same currency that your YNAB is in
32
31
  `ubs_chequing` | UBS Switzerland (private banking) | [ubs.ch](https://ubs.ch) | Private chequing and joint accounts
33
32
  `ubs_credit` | UBS Switzerland (credit cards) | [ubs.ch](https://ubs.ch) | Both MasterCard and Visa
34
33
  `wise` | Wise (Transferwise) cards | [wise.com](https://wise.com) | Performs currency conversion (hardcoded to CHF for now)
@@ -124,9 +123,14 @@ Or add `byebug` or `pry` statements in the code (works with guard and with rspec
124
123
  If there is no processor for your financial institution, you can contribute one
125
124
  to the project.
126
125
 
127
- There is a commented example processor located at
128
- `lib/ynab_convert/processors/example_processor.rb`. Looking at the other,
129
- real-world processors in that directory can also help.
126
+ Looking at the other, real-world processors in `lib/processors` is helpful.
127
+
128
+ Note that if the processor name's case cannot be camel cased from its lowercase
129
+ string, it will need to be added manually in `lib/ynab_convert.rb` in the
130
+ `processor_class_name` method. For instance, the USB Chequing processor is
131
+ called with `-i ubs_chequing` from the command line. That makes the gem try to
132
+ use `Processors::UbsChequing` as the processor class, but it's actually called
133
+ `Processors::UBSChequing`.
130
134
 
131
135
  Be sure to add tests to your processor as well before you make a PR.
132
136
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YnabConvert
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1'
5
5
  end
data/lib/ynab_convert.rb CHANGED
@@ -6,6 +6,9 @@ require 'ynab_convert/logger'
6
6
  require 'core_extensions/string'
7
7
  require 'byebug' if ENV['YNAB_CONVERT_DEBUG']
8
8
 
9
+ # FIXME: The architecture in here is not the greatest... It should be
10
+ # redesigned entirely.
11
+
9
12
  # The application
10
13
  module YnabConvert
11
14
  # Metadata about the gem
@@ -99,7 +102,22 @@ module YnabConvert
99
102
  end
100
103
 
101
104
  def processor_class_name
102
- "Processors::#{@options[:institution].camel_case}"
105
+ # Processor class names don't always match camelcasing the `-i` argument
106
+ # from the command line. For those classes that don't, a lookup is
107
+ # performed to find the proper class name.
108
+ institution = @options[:institution].to_sym
109
+ institution_to_classname = {
110
+ ubs_chequing: 'UBSChequing',
111
+ ubs_credit: 'UBSCredit'
112
+ }
113
+
114
+ classname = institution_to_classname.fetch(institution) do |el|
115
+ # If the class name is "regular", it will be found by camelcasing the
116
+ # name passed as the `-i` argument from the command line.
117
+ el.to_s.camel_case
118
+ end
119
+
120
+ "Processors::#{classname}"
103
121
  end
104
122
 
105
123
  def processor
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ynab_convert
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - coaxial