budgetcrmod 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51b952374d995bedfedab50af519862104a7ee1056a72043a1759f7197f57331
4
- data.tar.gz: c0624eea270b06dbad63456e5b92c2f2bd4d6ad4f9dc4d6f1a4c8ff47108cb37
3
+ metadata.gz: 564f811bf31f0c1cdf6ad1a8854c7a8735d480ac5b079a9da6aea8e9c4647cbf
4
+ data.tar.gz: d3839555241d6862be8ea4a7d8ea486759212d159fdafc3b1e152bcce6449375
5
5
  SHA512:
6
- metadata.gz: 1c17613d1be4629cfcaa10564a36ae6df45f1c23bc6f7ae132b1acec040d2a61a2d3161dd7260a4c0f6f470669c566ede97e3e77893a105366c63c7746fc9393
7
- data.tar.gz: e2210b83b2829b057cac88bf83f3444806d2fdb7397f49f0096e9fb447ed163c0e6c0456f2154b83aafa99c01a4d0a3c6b26f7991a952fe56f7e74b6774cad20
6
+ metadata.gz: 21f3c06fc81c93ace4ffd67702dc994fcce662e23d48fd768bb59ad7773f2ec1880213c3ceeac48a0ce3880496cadba39ab950f1d182432f982f7d3182202354
7
+ data.tar.gz: 249f92fbe9e1ab28ff32c69f3591141504ae0f1f38908895d5755e17f304a63974d555762c5faa7ce81b731603549c920cf190beec020f26682a0ea7d08d3177
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: budgetcrmod 0.5.0 ruby lib
5
+ # stub: budgetcrmod 0.5.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "budgetcrmod".freeze
9
- s.version = "0.5.0"
9
+ s.version = "0.5.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Edmund Highcock".freeze]
14
- s.date = "2020-02-08"
14
+ s.date = "2020-02-09"
15
15
  s.description = "A CodeRunner module to help you do your budget".freeze
16
16
  s.email = "edmundhighcock@users.sourceforge.net".freeze
17
17
  s.extra_rdoc_files = [
@@ -84,11 +84,22 @@ class CodeRunner
84
84
  end
85
85
  if data[0] =~ /^\d{2} \w{3} \d\d,/ # BarclayCard format
86
86
  data.unshift 'date,description,type,user,expensetype,withdrawal,withdrawal'
87
+ elsif data[0] == ""
88
+ data.shift
87
89
  end
88
90
 
91
+
92
+
89
93
  @first_line_string = data[0].dup
94
+ separator = case @first_line_string
95
+ when /Bokf.*ringsdag;Belopp;/
96
+ ";"
97
+ else
98
+ ","
99
+ end
100
+ puts "Separator is: " + separator
90
101
  data = data.map do |line|
91
- matches = line.scan(Regexp.new("((?:#{DOUBLE_STRING}|[^,])*)(?:,|$)"))
102
+ matches = line.scan(Regexp.new("((?:#{DOUBLE_STRING}|[^#{separator}])*)(?:#{separator}|$)"))
92
103
  pp matches
93
104
  matches.flatten
94
105
  end
@@ -158,6 +169,8 @@ class CodeRunner
158
169
  [:date,:description,:type,:dummy,:dummy, :withdrawal, :withdrawal]
159
170
  when /Datum,Transaktion,Kategori,Belopp,Saldo/ # Nordea.se privat, Belopp is positive when the asset increases
160
171
  [:date,:description,:dummy,:deposit,:balance]
172
+ when /Bokföringsdag;Belopp;Avsändare;Mottagare;Namn;Rubrik;Saldo;Valuta/ # Nordea new
173
+ [:date,:deposit,:dummy,:dummy,:dummy,:description,:balance,:dummy]
161
174
  when /Bokföringsdatum,Transaktionsreferens,Mottagare,Belopp,Valuta/ # Forex.se privat, Belopp is positive when the asset increases
162
175
  [:date,:description,:dummy,:deposit,:dummy]
163
176
  when /Datum,Text,Belopp/ #Ecster Credit Card
@@ -170,6 +183,8 @@ class CodeRunner
170
183
  [:date,:deposit,:dummy,:description,:dummy,:balance,:dummy,:dummy,:dummy,:dummy,:dummy]
171
184
  when /"TransferWise ID",Date,Amount,Currency,Description,"Payment Reference","Running Balance","Exchange From","Exchange To","Exchange Rate","Payer Name","Payee Name","Payee Account Number",Merchant,"Total fees"/ #TransferWise New
172
185
  [:dummy,:date,:deposit,:dummy,:description,:description2,:balance,:dummy,:dummy,:dummy,:dummy,:dummy,:dummy,:dummy,:dummy]
186
+ else
187
+ raise "unknown data format for #@id: #@first_line_string, #{@data.slice(0,[4,@data.size].min)}"
173
188
  end
174
189
  end
175
190
 
@@ -202,6 +217,7 @@ class CodeRunner
202
217
  #next if @runner.cache[:data].include? dataset and Date.parse(dataset[0]) > Date.parse("1/1/2013")
203
218
  #next if @runner.component_run_list.map{|k,v| v.instance_variable_get(:@dataset)}.include? dataset # and Date.parse(dataset[0]) > Date.parse("1/1/2013")
204
219
  next if @first_line_string =~ /^Datum/ and dataset[1] =~ /Reservation/
220
+ next if @first_line_string =~ /Bokf/ and dataset[0] =~ /Invalid/
205
221
  h = {}
206
222
  h[:withdrawal] = 0.0
207
223
  h[:deposit] = 0.0
@@ -213,7 +229,7 @@ class CodeRunner
213
229
  value = Date.parse value if res == :date
214
230
  if [:deposit, :withdrawal, :balance].include? res
215
231
  case @first_line_string
216
- when /^Datum/i # we are dealing with European numbers
232
+ when /^Datum/i, /Bokföringsdag;Belopp;/ # we are dealing with European numbers
217
233
  value = value.gsub(/[." ]/, '')
218
234
  value = value.sub(/[,]/, '.')
219
235
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: budgetcrmod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Highcock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-08 00:00:00.000000000 Z
11
+ date: 2020-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coderunner