reckon 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- reckon (0.3.2)
4
+ reckon (0.3.4)
5
5
  chronic (>= 0.3.0)
6
6
  fastercsv (>= 1.5.1)
7
7
  highline (>= 1.5.2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.4
data/lib/reckon/app.rb CHANGED
@@ -173,7 +173,8 @@ module Reckon
173
173
  def date_for(index)
174
174
  value = columns[date_column_index][index]
175
175
  value = [$1, $2, $3].join("/") if value =~ /^(\d{4})(\d{2})(\d{2})\d+\[\d+\:GMT\]$/ # chase format
176
- value = [$3, $2, $1].join("/") if value =~ /^(\d{2})\.(\d{2})\.(\d{4})$/ # chase format
176
+ value = [$3, $2, $1].join("/") if value =~ /^(\d{2})\.(\d{2})\.(\d{4})$/ # german format
177
+ value = [$3, $2, $1].join("/") if value =~ /^(\d{2})\-(\d{2})\-(\d{4})$/ # nordea format
177
178
  begin
178
179
  guess = Chronic.parse(value, :context => :past)
179
180
  if guess.to_i < 953236800 && value =~ /\//
data/reckon.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{reckon}
6
- s.version = "0.3.3"
6
+ s.version = "0.3.4"
7
7
  s.authors = ["Andrew Cantino"]
8
8
  s.email = %q{andrew@iterationlabs.com}
9
9
  s.homepage = %q{https://github.com/cantino/reckon}
@@ -13,6 +13,7 @@ describe Reckon::App do
13
13
  @two_money_columns = Reckon::App.new(:string => TWO_MONEY_COLUMNS_BANK)
14
14
  @simple_csv = Reckon::App.new(:string => SIMPLE_CSV)
15
15
  @german_date = Reckon::App.new(:string => GERMAN_DATE_EXAMPLE)
16
+ @danish_kroner_nordea = Reckon::App.new(:string => DANISH_KRONER_NORDEA_EXAMPLE, :csv_separator => ';', :comma_separates_cents => true)
16
17
  end
17
18
 
18
19
  it "should be in testing mode" do
@@ -47,6 +48,7 @@ describe Reckon::App do
47
48
  @some_other_bank.money_column_indices.should == [3]
48
49
  @two_money_columns.money_column_indices.should == [3, 4]
49
50
  @harder_date_example_csv.money_column_indices.should == [1]
51
+ @danish_kroner_nordea.money_column_indices.should == [3]
50
52
  end
51
53
 
52
54
  it "should detect the date column" do
@@ -54,6 +56,7 @@ describe Reckon::App do
54
56
  @some_other_bank.date_column_index.should == 1
55
57
  @two_money_columns.date_column_index.should == 0
56
58
  @harder_date_example_csv.date_column_index.should == 0
59
+ @danish_kroner_nordea.date_column_index.should == 0
57
60
  end
58
61
 
59
62
  it "should consider all other columns to be description columns" do
@@ -61,6 +64,7 @@ describe Reckon::App do
61
64
  @some_other_bank.description_column_indices.should == [0, 2]
62
65
  @two_money_columns.description_column_indices.should == [1, 2, 5]
63
66
  @harder_date_example_csv.description_column_indices.should == [2, 3, 4, 5, 6, 7]
67
+ @danish_kroner_nordea.description_column_indices.should == [1, 2, 4]
64
68
  end
65
69
  end
66
70
 
@@ -85,6 +89,12 @@ describe Reckon::App do
85
89
  @two_money_columns.money_for(2).should == -800
86
90
  @two_money_columns.money_for(3).should == -88.55
87
91
  @two_money_columns.money_for(4).should == 88.55
92
+ @danish_kroner_nordea.money_for(0).should == -48.00
93
+ @danish_kroner_nordea.money_for(1).should == -79.00
94
+ @danish_kroner_nordea.money_for(2).should == 497.90
95
+ @danish_kroner_nordea.money_for(3).should == -995.00
96
+ @danish_kroner_nordea.money_for(4).should == -3452.90
97
+ @danish_kroner_nordea.money_for(5).should == -655.00
88
98
  end
89
99
 
90
100
  it "should handle the comma_separates_cents option correctly" do
@@ -105,6 +115,9 @@ describe Reckon::App do
105
115
  @german_date.date_for(1).year.should == Time.parse("2009/12/24").year
106
116
  @german_date.date_for(1).month.should == Time.parse("2009/12/24").month
107
117
  @german_date.date_for(1).day.should == Time.parse("2009/12/24").day
118
+ @danish_kroner_nordea.date_for(0).year.should == Time.parse("2012/11/16").year
119
+ @danish_kroner_nordea.date_for(0).month.should == Time.parse("2012/11/16").month
120
+ @danish_kroner_nordea.date_for(0).day.should == Time.parse("2012/11/16").day
108
121
  end
109
122
  end
110
123
 
@@ -184,4 +197,14 @@ describe Reckon::App do
184
197
  24.12.2009,BLARG R SH 456930,"","",+$327.49,"$1,826.06"
185
198
  24.12.2009,Check - 0000000112,112,-$800.00,"","$1,498.57"
186
199
  CSV
200
+
201
+ DANISH_KRONER_NORDEA_EXAMPLE = (<<-CSV).strip
202
+ 16-11-2012;Dankort-nota DSB Kobenhavn 15149;16-11-2012;-48,00;26550,33
203
+ 26-10-2012;Dankort-nota Ziggy Cafe 19471;26-10-2012;-79,00;26054,54
204
+ 22-10-2012;Dankort-nota H&M Hennes & M 10681;23-10-2012;497,90;25433,54
205
+ 12-10-2012;Visa kob DKK 995,00 WWW.ASOS.COM 00000 ;12-10-2012;-995,00;27939,54
206
+ 12-09-2012;Dankort-nota B.J. TRADING E 14660;12-09-2012;-3452,90;26164,80
207
+ 27-08-2012;Dankort-nota MATAS - 20319 18230;27-08-2012;-655,00;21127,45
208
+ CSV
209
+
187
210
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reckon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-13 00:00:00.000000000 Z
12
+ date: 2013-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 1.8.23
141
+ rubygems_version: 1.8.25
142
142
  signing_key:
143
143
  specification_version: 3
144
144
  summary: Utility for interactively converting and labeling CSV files for the Ledger