ynab_convert 2.0.0 → 2.0.4

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: f6fb40d39bcae5a21d257b552d80d5c71b501980001957c669b9e8acb08bfdb2
4
+ data.tar.gz: b63d021d9863957894ec818bc325c91dce46137c05baf281902ec63e7d7deecb
5
5
  SHA512:
6
- metadata.gz: a4e37509faa4be4db330876e0c6af4bb2deb0927b4bb4aa8feb9b1943a69690d8765087cfe72ebeb49161b708999253e7443f5b3275f5cfc42bc3f23e93232cf
7
- data.tar.gz: 4a0eb0cee6a35847ba39d747f6343c39c5cb0750ca8347f9af0ad70fb3d8382ac5e098bbb6b47c8d931b1d095d4829442fd0315b697d6005003ccc8aa7685638
6
+ metadata.gz: 785a31e077df3ee9e4e0343144ecc87d185b0cc345272723eced2661d29cce2489560192d6e7efd12fdf361327ea5ad7e876cd5ec10e40025be052b9fed6fa3f
7
+ data.tar.gz: 0f97b6358e6280e8a40aefdae8a7349e9cf0e512df491cfdb86e5c3eb6c6d384753f6af18d6d2667e5d661025c6e7bd334de63da1d6d4d31738973c04f92d1bf
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: ruby
3
+
4
+ on:
5
+ push:
6
+ branches: [master]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ publish:
13
+ name: Build + Publish
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ packages: write
17
+ contents: read
18
+
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
25
+ - name: Run tests
26
+ run: bundle exec rake ci
27
+ - name: Publish to RubyGems
28
+ run: |
29
+ mkdir -p $HOME/.gem
30
+ touch $HOME/.gem/credentials
31
+ chmod 0600 $HOME/.gem/credentials
32
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33
+ gem build *.gemspec
34
+ gem push *.gem
35
+ env:
36
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: ruby
3
+
4
+ on:
5
+ push:
6
+ branches: [master]
7
+ pull_request:
8
+ branches: [master]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ ruby-version: ["2.6", "2.7"]
19
+
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - name: Set up Ruby
23
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
24
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
25
+ # uses: ruby/setup-ruby@v1
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby-version }}
29
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
30
+ - name: Run tests
31
+ run: bundle exec rake ci
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.4)
5
5
  i18n
6
6
  slop
7
7
  timecop
@@ -15,7 +15,7 @@ GEM
15
15
  backport (1.1.2)
16
16
  byebug (11.0.1)
17
17
  coderay (1.1.2)
18
- concurrent-ruby (1.1.9)
18
+ concurrent-ruby (1.1.10)
19
19
  crack (0.4.5)
20
20
  rexml
21
21
  diff-lcs (1.3)
@@ -114,7 +114,7 @@ GEM
114
114
  json (>= 1.8, < 3)
115
115
  simplecov-html (~> 0.10.0)
116
116
  simplecov-html (0.10.2)
117
- slop (4.9.1)
117
+ slop (4.9.2)
118
118
  solargraph (0.37.2)
119
119
  backport (~> 1.1)
120
120
  bundler (>= 1.17.2)
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
 
@@ -8,7 +8,7 @@ module APIClients
8
8
  class CurrencyAPI < APIClient
9
9
  # The days that are missing from the API's otherwise normally available
10
10
  # range
11
- MISSING_DAYS = { '2021-09-14' => true }.freeze
11
+ MISSING_DAYS = { '2021-09-14' => true, '2022-05-01' => true }.freeze
12
12
 
13
13
  def initialize
14
14
  api_base_path = 'https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/'
@@ -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.4'
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,14 +1,14 @@
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.4
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-20 00:00:00.000000000 Z
11
+ date: 2022-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -261,13 +261,14 @@ executables:
261
261
  extensions: []
262
262
  extra_rdoc_files: []
263
263
  files:
264
+ - ".github/workflows/publish.yml"
265
+ - ".github/workflows/test.yml"
264
266
  - ".gitignore"
265
267
  - ".rspec"
266
268
  - ".rubocop.yml"
267
269
  - ".ruby-gemset"
268
270
  - ".ruby-version"
269
271
  - ".solargraph.yml"
270
- - ".travis.yml"
271
272
  - Gemfile
272
273
  - Gemfile.lock
273
274
  - Guardfile
@@ -342,7 +343,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
343
  - !ruby/object:Gem::Version
343
344
  version: '0'
344
345
  requirements: []
345
- rubygems_version: 3.0.8
346
+ rubygems_version: 3.0.3
346
347
  signing_key:
347
348
  specification_version: 4
348
349
  summary: Convert online banking CSV files to YNAB 4 format.
data/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6
6
- - 2.7
7
- before_install: gem install bundler
8
-
9
- jobs:
10
- include:
11
- - stage: test
12
- script: echo "Running tests for $(ruby -v)..." && bundle exec rake ci
13
- - stage: gem release
14
- rvm: 2.6
15
- script: echo "Publishing to rubygems.org..."
16
- deploy:
17
- provider: rubygems
18
- gem: ynab_convert
19
- api_key: $RUBYGEMS_API_KEY
20
- on: master