ynab_convert 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +8 -4
- data/lib/ynab_convert/version.rb +1 -1
- data/lib/ynab_convert.rb +19 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b10705667e423e280b312986f423664a84450c6d7aa9f47e8cd99063b8c653c7
         | 
| 4 | 
            +
              data.tar.gz: 87563fa9a29b8a01145e6406d713114ad275a2f33ab9b27c64bc771a4379f34e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2cd94babe8d7aef861dcfc84d85ba0401b5807af87a3df4c17724663f69ec0d756288929f80089ce7e083068e0d7cc2de4fa45df6767651dbb4929797d59006a
         | 
| 7 | 
            +
              data.tar.gz: 11562fdf39e805dce87016f28b5f442a5de8716dbda6a5e06d7f0b7208f1ee84f08cdae17908de72c418b221d71a561a34e584b0c2ab7d29c604b19c1b57cc9e
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        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 | 
            -
             | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 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 |  | 
    
        data/lib/ynab_convert/version.rb
    CHANGED
    
    
    
        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 | 
            -
                   | 
| 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
         |