ofx 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ *.gem
3
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in /tmp/sample.gemspec
4
+ gemspec
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ofx (0.2.7)
5
+ nokogiri
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.1.2)
11
+ nokogiri (1.4.3.1)
12
+ rspec (2.0.0)
13
+ rspec-core (= 2.0.0)
14
+ rspec-expectations (= 2.0.0)
15
+ rspec-mocks (= 2.0.0)
16
+ rspec-core (2.0.0)
17
+ rspec-expectations (2.0.0)
18
+ diff-lcs (>= 1.1.2)
19
+ rspec-mocks (2.0.0)
20
+ rspec-core (= 2.0.0)
21
+ rspec-expectations (= 2.0.0)
22
+
23
+ PLATFORMS
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ nokogiri
28
+ ofx!
29
+ rspec (>= 2.0.0)
data/Rakefile CHANGED
@@ -1,38 +1,5 @@
1
- require "rake"
2
- require "jeweler"
3
- require "spec/rake/spectask"
4
- require File.dirname(__FILE__) + "/lib/ofx/version"
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
5
3
 
6
- JEWEL = Jeweler::Tasks.new do |gem|
7
- gem.name = "ofx"
8
- gem.version = OFX::Version::STRING
9
- gem.summary = "A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2."
10
- gem.description = <<-TXT
11
- A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2.
12
-
13
- Usage:
14
-
15
- OFX("sample.ofx") do |ofx|
16
- p ofx
17
- end
18
- TXT
19
-
20
- gem.authors = ["Nando Vieira"]
21
- gem.email = "fnando.vieira@gmail.com"
22
- gem.homepage = "http://github.com/fnando/ofx"
23
-
24
- gem.has_rdoc = false
25
- gem.files = %w(Rakefile ofx.gemspec README.markdown) + Dir["{lib,spec}/**/*"]
26
-
27
- gem.add_dependency "nokogiri"
28
- end
29
-
30
- desc "Generate gemspec and build gem"
31
- task :build_gem do
32
- Rake::Task["gemspec"].invoke
33
- Rake::Task["build"].invoke
34
- end
35
-
36
- Jeweler::GemcutterTasks.new
37
-
38
- Spec::Rake::SpecTask.new {|t| t.spec_opts = ["-c", "-f s"] }
4
+ require "rspec/core/rake_task"
5
+ RSpec::Core::RakeTask.new
@@ -12,7 +12,10 @@ module OFX
12
12
  TRANSACTION_TYPES = {
13
13
  "CREDIT" => :credit,
14
14
  "DEBIT" => :debit,
15
- "OTHER" => :other
15
+ "OTHER" => :other,
16
+ "DEP" => :dep,
17
+ "XFER" => :xfer,
18
+ "CASH" => :cash
16
19
  }
17
20
 
18
21
  attr_reader :headers
@@ -48,20 +51,26 @@ module OFX
48
51
  end
49
52
 
50
53
  def build_transaction(element)
51
- amount = BigDecimal.new(element.search("trnamt").inner_text)
52
-
53
54
  OFX::Transaction.new({
54
- :amount => amount,
55
- :amount_in_pennies => (amount * 100).to_i,
55
+ :amount => build_amount(element),
56
+ :amount_in_pennies => (build_amount(element) * 100).to_i,
56
57
  :fit_id => element.search("fitid").inner_text,
57
58
  :memo => element.search("memo").inner_text,
58
59
  :payee => element.search("payee").inner_text,
59
60
  :check_number => element.search("checknum").inner_text,
60
61
  :ref_number => element.search("refnum").inner_text,
61
62
  :posted_at => build_date(element.search("dtposted").inner_text),
62
- :type => TRANSACTION_TYPES[element.search("trntype").inner_text]
63
+ :type => build_type(element)
63
64
  })
64
65
  end
66
+
67
+ def build_type(element)
68
+ TRANSACTION_TYPES[element.search("trntype").inner_text]
69
+ end
70
+
71
+ def build_amount(element)
72
+ BigDecimal.new(element.search("trnamt").inner_text)
73
+ end
65
74
 
66
75
  def build_date(date)
67
76
  _, year, month, day, hour, minutes, seconds = *date.match(/(\d{4})(\d{2})(\d{2})(?:(\d{2})(\d{2})(\d{2}))?/)
@@ -83,4 +92,4 @@ module OFX
83
92
  end
84
93
  end
85
94
  end
86
- end
95
+ end
@@ -2,7 +2,7 @@ module OFX
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 7
5
+ PATCH = 8
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -1,75 +1,33 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "ofx/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{ofx}
8
- s.version = "0.2.7"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Nando Vieira"]
12
- s.date = %q{2010-06-29}
13
- s.description = %q{A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2.
6
+ s.name = "ofx"
7
+ s.version = OFX::Version::STRING
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Nando Vieira"]
10
+ s.email = ["fnando.vieira@gmail.com"]
11
+ s.homepage = "http://rubygems.org/gems/ofx"
12
+ s.summary = "A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2."
13
+ s.description = <<-TXT
14
+ A simple OFX (Open Financial Exchange) parser built on top of Nokogiri.
15
+ Currently supports OFX 1.0.2.
14
16
 
15
17
  Usage:
16
18
 
17
19
  OFX("sample.ofx") do |ofx|
18
20
  p ofx
19
21
  end
20
- }
21
- s.email = %q{fnando.vieira@gmail.com}
22
- s.extra_rdoc_files = [
23
- "README.rdoc"
24
- ]
25
- s.files = [
26
- "Rakefile",
27
- "lib/ofx.rb",
28
- "lib/ofx/account.rb",
29
- "lib/ofx/balance.rb",
30
- "lib/ofx/errors.rb",
31
- "lib/ofx/foundation.rb",
32
- "lib/ofx/parser.rb",
33
- "lib/ofx/parser/ofx102.rb",
34
- "lib/ofx/transaction.rb",
35
- "lib/ofx/version.rb",
36
- "ofx.gemspec",
37
- "spec/fixtures/avatar.gif",
38
- "spec/fixtures/invalid_version.ofx",
39
- "spec/fixtures/sample.ofx",
40
- "spec/fixtures/utf8.ofx",
41
- "spec/ofx/account_spec.rb",
42
- "spec/ofx/ofx102_spec.rb",
43
- "spec/ofx/ofx_parser_spec.rb",
44
- "spec/ofx/ofx_spec.rb",
45
- "spec/ofx/transaction_spec.rb",
46
- "spec/spec_helper.rb"
47
- ]
48
- s.homepage = %q{http://github.com/fnando/ofx}
49
- s.rdoc_options = ["--charset=UTF-8"]
50
- s.require_paths = ["lib"]
51
- s.rubygems_version = %q{1.3.6}
52
- s.summary = %q{A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2.}
53
- s.test_files = [
54
- "spec/ofx/account_spec.rb",
55
- "spec/ofx/ofx102_spec.rb",
56
- "spec/ofx/ofx_parser_spec.rb",
57
- "spec/ofx/ofx_spec.rb",
58
- "spec/ofx/transaction_spec.rb",
59
- "spec/spec_helper.rb"
60
- ]
22
+ TXT
61
23
 
62
- if s.respond_to? :specification_version then
63
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
64
- s.specification_version = 3
24
+ s.rubyforge_project = "ofx"
65
25
 
66
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
67
- s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
68
- else
69
- s.add_dependency(%q<nokogiri>, [">= 0"])
70
- end
71
- else
72
- s.add_dependency(%q<nokogiri>, [">= 0"])
73
- end
74
- end
26
+ s.files = `git ls-files`.split("\n")
27
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
28
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
29
+ s.require_paths = ["lib"]
75
30
 
31
+ s.add_dependency "nokogiri"
32
+ s.add_development_dependency "rspec", ">= 2.0.0"
33
+ end
@@ -0,0 +1,692 @@
1
+ OFXHEADER:100
2
+ DATA:OFXSGML
3
+ VERSION:102
4
+ SECURITY:NONE
5
+ ENCODING:USASCII
6
+ CHARSET:1252
7
+ COMPRESSION:NONE
8
+ OLDFILEUID:NONE
9
+ NEWFILEUID:NONE
10
+ <OFX>
11
+ <SIGNONMSGSRSV1>
12
+ <SONRS>
13
+ <STATUS>
14
+ <CODE>0</CODE>
15
+ <SEVERITY>INFO</SEVERITY>
16
+ </STATUS>
17
+ <DTSERVER>20101025
18
+ <LANGUAGE>POR
19
+ <DTACCTUP>20101025
20
+ <FI>
21
+ <ORG>Banco do Brasil S/A
22
+ <FID>001
23
+ </FI>
24
+ </SONRS>
25
+ </SIGNONMSGSRSV1>
26
+ <BANKMSGSRSV1>
27
+ <STMTTRNRS>
28
+ <TRNUID>0
29
+ <STATUS>
30
+ <CODE>0
31
+ <SEVERITY>INFO
32
+ </STATUS>
33
+ <STMTRS>
34
+ <CURDEF>BRL
35
+ <BANKACCTFROM>
36
+ <BANKID>001
37
+ <ACCTID>12345-6
38
+ <ACCTTYPE>CHECKING
39
+ </BANKACCTFROM>
40
+ <BANKTRANLIST>
41
+ <DTSTART>20100930
42
+ <DTEND>20101025
43
+ <STMTTRN>
44
+ <TRNTYPE>DEBIT
45
+ <DTPOSTED>20101001
46
+ <TRNAMT>-18.34
47
+ <FITID>2010100111834
48
+ <CHECKNUM>147021
49
+ <MEMO>COMPRA COM CART�O
50
+ </STMTTRN>
51
+ <STMTTRN>
52
+ <TRNTYPE>DEBIT
53
+ <DTPOSTED>20101001
54
+ <TRNAMT>-28.90
55
+ <FITID>2010100112890
56
+ <CHECKNUM>37345
57
+ <MEMO>D�B AUTORIZADO EM CONTA
58
+ </STMTTRN>
59
+ <STMTTRN>
60
+ <TRNTYPE>DEBIT
61
+ <DTPOSTED>20101001
62
+ <TRNAMT>-5.73
63
+ <FITID>201010011573
64
+ <CHECKNUM>91100702
65
+ <MEMO>COBRAN�A DE I.O.F.
66
+ </STMTTRN>
67
+ <STMTTRN>
68
+ <TRNTYPE>DEBIT
69
+ <DTPOSTED>20101004
70
+ <TRNAMT>-10.99
71
+ <FITID>2010100411099
72
+ <CHECKNUM>138204
73
+ <MEMO>COMPRA COM CART�O
74
+ </STMTTRN>
75
+ <STMTTRN>
76
+ <TRNTYPE>DEBIT
77
+ <DTPOSTED>20101004
78
+ <TRNAMT>-8.30
79
+ <FITID>201010041830
80
+ <CHECKNUM>149857
81
+ <MEMO>COMPRA COM CART�O
82
+ </STMTTRN>
83
+ <STMTTRN>
84
+ <TRNTYPE>DEBIT
85
+ <DTPOSTED>20101004
86
+ <TRNAMT>-12.00
87
+ <FITID>2010100411200
88
+ <CHECKNUM>246313
89
+ <MEMO>COMPRA COM CART�O
90
+ </STMTTRN>
91
+ <STMTTRN>
92
+ <TRNTYPE>DEBIT
93
+ <DTPOSTED>20101004
94
+ <TRNAMT>-11.50
95
+ <FITID>2010100411150
96
+ <CHECKNUM>369318
97
+ <MEMO>COMPRA COM CART�O
98
+ </STMTTRN>
99
+ <STMTTRN>
100
+ <TRNTYPE>DEBIT
101
+ <DTPOSTED>20101006
102
+ <TRNAMT>-18.83
103
+ <FITID>2010100611883
104
+ <CHECKNUM>36897762
105
+ <MEMO>PAGTO CART�O CR�DITO
106
+ </STMTTRN>
107
+ <STMTTRN>
108
+ <TRNTYPE>DEP
109
+ <DTPOSTED>20101006
110
+ <TRNAMT>18.83
111
+ <FITID>2010100601883
112
+ <CHECKNUM>36897762
113
+ <MEMO>ESTORNO DE D�BITO
114
+ </STMTTRN>
115
+ <STMTTRN>
116
+ <TRNTYPE>DEP
117
+ <DTPOSTED>20101007
118
+ <TRNAMT>1000.00
119
+ <FITID>201010070100000
120
+ <CHECKNUM>800544
121
+ <MEMO>DEP�SITO COMPE
122
+ </STMTTRN>
123
+ <STMTTRN>
124
+ <TRNTYPE>DEBIT
125
+ <DTPOSTED>20101007
126
+ <TRNAMT>-18.83
127
+ <FITID>2010100711883
128
+ <CHECKNUM>36897762
129
+ <MEMO>PAGTO CART�O CR�DITO
130
+ </STMTTRN>
131
+ <STMTTRN>
132
+ <TRNTYPE>XFER
133
+ <DTPOSTED>20101008
134
+ <TRNAMT>300.00
135
+ <FITID>20101008030000
136
+ <CHECKNUM>00020224
137
+ <MEMO>TRANSFER�NCIA ON LINE
138
+ </STMTTRN>
139
+ <STMTTRN>
140
+ <TRNTYPE>DEP
141
+ <DTPOSTED>20101008
142
+ <TRNAMT>500.00
143
+ <FITID>20101008050000
144
+ <CHECKNUM>421347
145
+ <MEMO>DEP�SITO COMPE
146
+ </STMTTRN>
147
+ <STMTTRN>
148
+ <TRNTYPE>DEP
149
+ <DTPOSTED>20101008
150
+ <TRNAMT>500.00
151
+ <FITID>2010100805000011
152
+ <CHECKNUM>648512
153
+ <MEMO>DEP�SITO COMPE
154
+ </STMTTRN>
155
+ <STMTTRN>
156
+ <TRNTYPE>DEBIT
157
+ <DTPOSTED>20101008
158
+ <TRNAMT>-28.28
159
+ <FITID>2010100812828
160
+ <CHECKNUM>146396
161
+ <MEMO>COMPRA COM CART�O
162
+ </STMTTRN>
163
+ <STMTTRN>
164
+ <TRNTYPE>DEBIT
165
+ <DTPOSTED>20101008
166
+ <TRNAMT>-5.90
167
+ <FITID>201010081590
168
+ <CHECKNUM>246834
169
+ <MEMO>COMPRA COM CART�O
170
+ </STMTTRN>
171
+ <STMTTRN>
172
+ <TRNTYPE>DEBIT
173
+ <DTPOSTED>20101008
174
+ <TRNAMT>-16.10
175
+ <FITID>2010100811610
176
+ <CHECKNUM>370424
177
+ <MEMO>COMPRA COM CART�O
178
+ </STMTTRN>
179
+ <STMTTRN>
180
+ <TRNTYPE>XFER
181
+ <DTPOSTED>20101008
182
+ <TRNAMT>-822.00
183
+ <FITID>20101008182200
184
+ <CHECKNUM>00048316
185
+ <MEMO>TRANSFER�NCIA ON LINE
186
+ </STMTTRN>
187
+ <STMTTRN>
188
+ <TRNTYPE>DEBIT
189
+ <DTPOSTED>20101008
190
+ <TRNAMT>-60.76
191
+ <FITID>2010100816076
192
+ <CHECKNUM>100801
193
+ <MEMO>PAGAMENTO DE T�TULO
194
+ </STMTTRN>
195
+ <STMTTRN>
196
+ <TRNTYPE>DEBIT
197
+ <DTPOSTED>20101008
198
+ <TRNAMT>-110.00
199
+ <FITID>20101008111000
200
+ <CHECKNUM>100802
201
+ <MEMO>PAGAMENTO DE T�TULO
202
+ </STMTTRN>
203
+ <STMTTRN>
204
+ <TRNTYPE>DEBIT
205
+ <DTPOSTED>20101011
206
+ <TRNAMT>-24.00
207
+ <FITID>2010101112400
208
+ <CHECKNUM>142600
209
+ <MEMO>COMPRA COM CART�O
210
+ </STMTTRN>
211
+ <STMTTRN>
212
+ <TRNTYPE>DEBIT
213
+ <DTPOSTED>20101011
214
+ <TRNAMT>-20.00
215
+ <FITID>2010101112000
216
+ <CHECKNUM>166230
217
+ <MEMO>COMPRA COM CART�O
218
+ </STMTTRN>
219
+ <STMTTRN>
220
+ <TRNTYPE>DEBIT
221
+ <DTPOSTED>20101011
222
+ <TRNAMT>-126.17
223
+ <FITID>20101011112617
224
+ <CHECKNUM>205611
225
+ <MEMO>COMPRA COM CART�O
226
+ </STMTTRN>
227
+ <STMTTRN>
228
+ <TRNTYPE>DEBIT
229
+ <DTPOSTED>20101011
230
+ <TRNAMT>-42.00
231
+ <FITID>2010101114200
232
+ <CHECKNUM>243071
233
+ <MEMO>COMPRA COM CART�O
234
+ </STMTTRN>
235
+ <STMTTRN>
236
+ <TRNTYPE>DEBIT
237
+ <DTPOSTED>20101011
238
+ <TRNAMT>-29.00
239
+ <FITID>2010101112900
240
+ <CHECKNUM>366151
241
+ <MEMO>COMPRA COM CART�O
242
+ </STMTTRN>
243
+ <STMTTRN>
244
+ <TRNTYPE>DEBIT
245
+ <DTPOSTED>20101011
246
+ <TRNAMT>-17.60
247
+ <FITID>2010101111760
248
+ <CHECKNUM>368944
249
+ <MEMO>COMPRA COM CART�O
250
+ </STMTTRN>
251
+ <STMTTRN>
252
+ <TRNTYPE>DEBIT
253
+ <DTPOSTED>20101011
254
+ <TRNAMT>-412.20
255
+ <FITID>20101011141220
256
+ <CHECKNUM>672017
257
+ <MEMO>COMPRA COM CART�O
258
+ </STMTTRN>
259
+ <STMTTRN>
260
+ <TRNTYPE>DEBIT
261
+ <DTPOSTED>20101011
262
+ <TRNAMT>-34.00
263
+ <FITID>2010101113400
264
+ <CHECKNUM>01241475
265
+ <MEMO>TARIFA PACOTE DE SERVI�OS
266
+ </STMTTRN>
267
+ <STMTTRN>
268
+ <TRNTYPE>DEBIT
269
+ <DTPOSTED>20101013
270
+ <TRNAMT>-30.18
271
+ <FITID>2010101313018
272
+ <CHECKNUM>146454
273
+ <MEMO>COMPRA COM CART�O
274
+ </STMTTRN>
275
+ <STMTTRN>
276
+ <TRNTYPE>DEBIT
277
+ <DTPOSTED>20101013
278
+ <TRNAMT>-7.19
279
+ <FITID>201010131719
280
+ <CHECKNUM>247102
281
+ <MEMO>COMPRA COM CART�O
282
+ </STMTTRN>
283
+ <STMTTRN>
284
+ <TRNTYPE>DEBIT
285
+ <DTPOSTED>20101013
286
+ <TRNAMT>-7.80
287
+ <FITID>201010131780
288
+ <CHECKNUM>367701
289
+ <MEMO>COMPRA COM CART�O
290
+ </STMTTRN>
291
+ <STMTTRN>
292
+ <TRNTYPE>XFER
293
+ <DTPOSTED>20101013
294
+ <TRNAMT>-50.96
295
+ <FITID>2010101315096
296
+ <CHECKNUM>00070756
297
+ <MEMO>TRANSFER�NCIA ON LINE
298
+ </STMTTRN>
299
+ <STMTTRN>
300
+ <TRNTYPE>DEBIT
301
+ <DTPOSTED>20101013
302
+ <TRNAMT>-61.03
303
+ <FITID>2010101316103
304
+ <CHECKNUM>101301
305
+ <MEMO>PAGAMENTO CONTA LUZ
306
+ </STMTTRN>
307
+ <STMTTRN>
308
+ <TRNTYPE>DEBIT
309
+ <DTPOSTED>20101013
310
+ <TRNAMT>-204.50
311
+ <FITID>20101013120450
312
+ <CHECKNUM>101302
313
+ <MEMO>PAGAMENTO DE T�TULO
314
+ </STMTTRN>
315
+ <STMTTRN>
316
+ <TRNTYPE>DEP
317
+ <DTPOSTED>20101014
318
+ <TRNAMT>400.00
319
+ <FITID>20101014040000
320
+ <CHECKNUM>00016279
321
+ <MEMO>COBRAN�A
322
+ </STMTTRN>
323
+ <STMTTRN>
324
+ <TRNTYPE>DEBIT
325
+ <DTPOSTED>20101014
326
+ <TRNAMT>-19.99
327
+ <FITID>2010101411999
328
+ <CHECKNUM>134048
329
+ <MEMO>COMPRA COM CART�O
330
+ </STMTTRN>
331
+ <STMTTRN>
332
+ <TRNTYPE>DEBIT
333
+ <DTPOSTED>20101014
334
+ <TRNAMT>-40.00
335
+ <FITID>2010101414000
336
+ <CHECKNUM>138633
337
+ <MEMO>COMPRA COM CART�O
338
+ </STMTTRN>
339
+ <STMTTRN>
340
+ <TRNTYPE>DEBIT
341
+ <DTPOSTED>20101014
342
+ <TRNAMT>-19.82
343
+ <FITID>2010101411982
344
+ <CHECKNUM>246442
345
+ <MEMO>COMPRA COM CART�O
346
+ </STMTTRN>
347
+ <STMTTRN>
348
+ <TRNTYPE>XFER
349
+ <DTPOSTED>20101014
350
+ <TRNAMT>-190.00
351
+ <FITID>20101014119000
352
+ <CHECKNUM>00070756
353
+ <MEMO>TRANSFER�NCIA ON LINE
354
+ </STMTTRN>
355
+ <STMTTRN>
356
+ <TRNTYPE>DEBIT
357
+ <DTPOSTED>20101014
358
+ <TRNAMT>-4.50
359
+ <FITID>201010141450
360
+ <CHECKNUM>00016279
361
+ <MEMO>D�BITO SERVI�O COBRAN�A
362
+ </STMTTRN>
363
+ <STMTTRN>
364
+ <TRNTYPE>DEBIT
365
+ <DTPOSTED>20101015
366
+ <TRNAMT>-19.54
367
+ <FITID>2010101511954
368
+ <CHECKNUM>146403
369
+ <MEMO>COMPRA COM CART�O
370
+ </STMTTRN>
371
+ <STMTTRN>
372
+ <TRNTYPE>DEBIT
373
+ <DTPOSTED>20101018
374
+ <TRNAMT>-12.80
375
+ <FITID>2010101811280
376
+ <CHECKNUM>147492
377
+ <MEMO>COMPRA COM CART�O
378
+ </STMTTRN>
379
+ <STMTTRN>
380
+ <TRNTYPE>DEBIT
381
+ <DTPOSTED>20101018
382
+ <TRNAMT>-23.05
383
+ <FITID>2010101812305
384
+ <CHECKNUM>149942
385
+ <MEMO>COMPRA COM CART�O
386
+ </STMTTRN>
387
+ <STMTTRN>
388
+ <TRNTYPE>DEBIT
389
+ <DTPOSTED>20101018
390
+ <TRNAMT>-6.80
391
+ <FITID>201010181680
392
+ <CHECKNUM>272293
393
+ <MEMO>COMPRA COM CART�O
394
+ </STMTTRN>
395
+ <STMTTRN>
396
+ <TRNTYPE>CASH
397
+ <DTPOSTED>20101018
398
+ <TRNAMT>-40.00
399
+ <FITID>2010101814000
400
+ <CHECKNUM>11783980
401
+ <MEMO>SAQUE NO TAA
402
+ </STMTTRN>
403
+ <STMTTRN>
404
+ <TRNTYPE>CASH
405
+ <DTPOSTED>20101018
406
+ <TRNAMT>-100.00
407
+ <FITID>20101018110000
408
+ <CHECKNUM>21783980
409
+ <MEMO>SAQUE NO TAA
410
+ </STMTTRN>
411
+ <STMTTRN>
412
+ <TRNTYPE>DEP
413
+ <DTPOSTED>20101019
414
+ <TRNAMT>400.00
415
+ <FITID>20101019040000
416
+ <CHECKNUM>00012545
417
+ <MEMO>COBRAN�A
418
+ </STMTTRN>
419
+ <STMTTRN>
420
+ <TRNTYPE>DEBIT
421
+ <DTPOSTED>20101019
422
+ <TRNAMT>-14.64
423
+ <FITID>2010101911464
424
+ <CHECKNUM>146476
425
+ <MEMO>COMPRA COM CART�O
426
+ </STMTTRN>
427
+ <STMTTRN>
428
+ <TRNTYPE>DEBIT
429
+ <DTPOSTED>20101019
430
+ <TRNAMT>-4.84
431
+ <FITID>201010191484
432
+ <CHECKNUM>246931
433
+ <MEMO>COMPRA COM CART�O
434
+ </STMTTRN>
435
+ <STMTTRN>
436
+ <TRNTYPE>DEBIT
437
+ <DTPOSTED>20101019
438
+ <TRNAMT>-16.10
439
+ <FITID>2010101911610
440
+ <CHECKNUM>373982
441
+ <MEMO>COMPRA COM CART�O
442
+ </STMTTRN>
443
+ <STMTTRN>
444
+ <TRNTYPE>DEBIT
445
+ <DTPOSTED>20101019
446
+ <TRNAMT>-4.50
447
+ <FITID>201010191450
448
+ <CHECKNUM>00012545
449
+ <MEMO>D�BITO SERVI�O COBRAN�A
450
+ </STMTTRN>
451
+ <STMTTRN>
452
+ <TRNTYPE>DEBIT
453
+ <DTPOSTED>20101019
454
+ <TRNAMT>-149.05
455
+ <FITID>20101019114905
456
+ <CHECKNUM>101901
457
+ <MEMO>PAGTO CONTA TELEFONE
458
+ </STMTTRN>
459
+ <STMTTRN>
460
+ <TRNTYPE>DEBIT
461
+ <DTPOSTED>20101020
462
+ <TRNAMT>-10.18
463
+ <FITID>2010102011018
464
+ <CHECKNUM>146249
465
+ <MEMO>COMPRA COM CART�O
466
+ </STMTTRN>
467
+ <STMTTRN>
468
+ <TRNTYPE>DEBIT
469
+ <DTPOSTED>20101020
470
+ <TRNAMT>-16.60
471
+ <FITID>2010102011660
472
+ <CHECKNUM>266347
473
+ <MEMO>COMPRA COM CART�O
474
+ </STMTTRN>
475
+ <STMTTRN>
476
+ <TRNTYPE>DEBIT
477
+ <DTPOSTED>20101020
478
+ <TRNAMT>-274.25
479
+ <FITID>20101020127425
480
+ <CHECKNUM>102001
481
+ <MEMO>PAGAMENTO DE T�TULO
482
+ </STMTTRN>
483
+ <STMTTRN>
484
+ <TRNTYPE>DEP
485
+ <DTPOSTED>20101021
486
+ <TRNAMT>2083.33
487
+ <FITID>201010210208333
488
+ <CHECKNUM>40929489
489
+ <MEMO>DESBLOQUEIO DE DEP�SITO
490
+ </STMTTRN>
491
+ <STMTTRN>
492
+ <TRNTYPE>DEP
493
+ <DTPOSTED>20101021
494
+ <TRNAMT>2546.07
495
+ <FITID>201010210254607
496
+ <CHECKNUM>20380391
497
+ <MEMO>DESBLOQUEIO DE DEP�SITO
498
+ </STMTTRN>
499
+ <STMTTRN>
500
+ <TRNTYPE>DEP
501
+ <DTPOSTED>20101021
502
+ <TRNAMT>1720.59
503
+ <FITID>201010210172059
504
+ <CHECKNUM>20380425
505
+ <MEMO>DESBLOQUEIO DE DEP�SITO
506
+ </STMTTRN>
507
+ <STMTTRN>
508
+ <TRNTYPE>DEP
509
+ <DTPOSTED>20101021
510
+ <TRNAMT>3000.00
511
+ <FITID>201010210300000
512
+ <CHECKNUM>13200184
513
+ <MEMO>DESBLOQUEIO DE DEP�SITO
514
+ </STMTTRN>
515
+ <STMTTRN>
516
+ <TRNTYPE>DEP
517
+ <DTPOSTED>20101022
518
+ <TRNAMT>825.00
519
+ <FITID>20101022082500
520
+ <CHECKNUM>35900150
521
+ <MEMO>DEP�SITO ONLINE
522
+ </STMTTRN>
523
+ <STMTTRN>
524
+ <TRNTYPE>DEBIT
525
+ <DTPOSTED>20101022
526
+ <TRNAMT>-9.40
527
+ <FITID>201010221940
528
+ <CHECKNUM>152718
529
+ <MEMO>COMPRA COM CART�O
530
+ </STMTTRN>
531
+ <STMTTRN>
532
+ <TRNTYPE>DEBIT
533
+ <DTPOSTED>20101022
534
+ <TRNAMT>-75.90
535
+ <FITID>2010102217590
536
+ <CHECKNUM>171210
537
+ <MEMO>COMPRA COM CART�O
538
+ </STMTTRN>
539
+ <STMTTRN>
540
+ <TRNTYPE>DEBIT
541
+ <DTPOSTED>20101022
542
+ <TRNAMT>-29.90
543
+ <FITID>2010102212990
544
+ <CHECKNUM>261902
545
+ <MEMO>COMPRA COM CART�O
546
+ </STMTTRN>
547
+ <STMTTRN>
548
+ <TRNTYPE>CASH
549
+ <DTPOSTED>20101022
550
+ <TRNAMT>-100.00
551
+ <FITID>20101022110000
552
+ <CHECKNUM>81783980
553
+ <MEMO>SAQUE NO TAA
554
+ </STMTTRN>
555
+ <STMTTRN>
556
+ <TRNTYPE>XFER
557
+ <DTPOSTED>20101022
558
+ <TRNAMT>-52.00
559
+ <FITID>2010102215200
560
+ <CHECKNUM>00070756
561
+ <MEMO>TRANSFER�NCIA ON LINE
562
+ </STMTTRN>
563
+ <STMTTRN>
564
+ <TRNTYPE>DEBIT
565
+ <DTPOSTED>20101022
566
+ <TRNAMT>-812.99
567
+ <FITID>20101022181299
568
+ <CHECKNUM>102201
569
+ <MEMO>PAGAMENTO DE T�TULO
570
+ </STMTTRN>
571
+ <STMTTRN>
572
+ <TRNTYPE>DEBIT
573
+ <DTPOSTED>20101022
574
+ <TRNAMT>-465.66
575
+ <FITID>20101022146566
576
+ <CHECKNUM>102202
577
+ <MEMO>PAGAMENTO DE T�TULO
578
+ </STMTTRN>
579
+ <STMTTRN>
580
+ <TRNTYPE>DEBIT
581
+ <DTPOSTED>20101022
582
+ <TRNAMT>-387.36
583
+ <FITID>20101022138736
584
+ <CHECKNUM>102203
585
+ <MEMO>PAGAMENTO DE T�TULO
586
+ </STMTTRN>
587
+ <STMTTRN>
588
+ <TRNTYPE>DEBIT
589
+ <DTPOSTED>20101025
590
+ <TRNAMT>-40.00
591
+ <FITID>2010102514000
592
+ <CHECKNUM>102501
593
+ <MEMO>PAGAMENTO DE T�TULO
594
+ </STMTTRN>
595
+ <STMTTRN>
596
+ <TRNTYPE>DEBIT
597
+ <DTPOSTED>20101025
598
+ <TRNAMT>-10.63
599
+ <FITID>2010102511063
600
+ <CHECKNUM>147859
601
+ <MEMO>COMPRA COM CART�O
602
+ </STMTTRN>
603
+ <STMTTRN>
604
+ <TRNTYPE>DEBIT
605
+ <DTPOSTED>20101025
606
+ <TRNAMT>-6.30
607
+ <FITID>201010251630
608
+ <CHECKNUM>154134
609
+ <MEMO>COMPRA COM CART�O
610
+ </STMTTRN>
611
+ <STMTTRN>
612
+ <TRNTYPE>XFER
613
+ <DTPOSTED>20101025
614
+ <TRNAMT>-100.00
615
+ <FITID>20101025110000
616
+ <CHECKNUM>00070756
617
+ <MEMO>TRANSFER�NCIA ON LINE
618
+ </STMTTRN>
619
+ <STMTTRN>
620
+ <TRNTYPE>DEBIT
621
+ <DTPOSTED>20101025
622
+ <TRNAMT>-76.80
623
+ <FITID>2010102517680
624
+ <CHECKNUM>283102
625
+ <MEMO>COMPRA COM CART�O
626
+ </STMTTRN>
627
+ <STMTTRN>
628
+ <TRNTYPE>CASH
629
+ <DTPOSTED>20101025
630
+ <TRNAMT>-70.00
631
+ <FITID>2010102517000
632
+ <CHECKNUM>41783972
633
+ <MEMO>SAQUE NO TAA
634
+ </STMTTRN>
635
+ <STMTTRN>
636
+ <TRNTYPE>DEBIT
637
+ <DTPOSTED>20101025
638
+ <TRNAMT>-9.76
639
+ <FITID>201010251976
640
+ <CHECKNUM>244487
641
+ <MEMO>COMPRA COM CART�O
642
+ </STMTTRN>
643
+ <STMTTRN>
644
+ <TRNTYPE>DEBIT
645
+ <DTPOSTED>20101025
646
+ <TRNAMT>-27.12
647
+ <FITID>2010102512712
648
+ <CHECKNUM>102502
649
+ <MEMO>PAGAMENTO DE T�TULO
650
+ </STMTTRN>
651
+ <STMTTRN>
652
+ <TRNTYPE>DEBIT
653
+ <DTPOSTED>20101025
654
+ <TRNAMT>-82.03
655
+ <FITID>2010102518203
656
+ <CHECKNUM>102503
657
+ <MEMO>PAGTO CONTA TELEFONE
658
+ </STMTTRN>
659
+ <STMTTRN>
660
+ <TRNTYPE>DEBIT
661
+ <DTPOSTED>20101025
662
+ <TRNAMT>-87.27
663
+ <FITID>2010102518727
664
+ <CHECKNUM>102504
665
+ <MEMO>PAGTO CONTA TELEFONE
666
+ </STMTTRN>
667
+ <STMTTRN>
668
+ <TRNTYPE>DEBIT
669
+ <DTPOSTED>20101025
670
+ <TRNAMT>-69.90
671
+ <FITID>2010102516990
672
+ <CHECKNUM>102505
673
+ <MEMO>PAGTO CONTA TELEFONE
674
+ </STMTTRN>
675
+ <STMTTRN>
676
+ <TRNTYPE>XFER
677
+ <DTPOSTED>20101025
678
+ <TRNAMT>-142.00
679
+ <FITID>20101025114200
680
+ <CHECKNUM>00014207
681
+ <MEMO>TRANSFER�NCIA ON LINE
682
+ </STMTTRN>
683
+ </BANKTRANLIST>
684
+ <LEDGERBAL>
685
+ <BALAMT>6529.19
686
+ <DTASOF>20101025
687
+ </LEDGERBAL>
688
+ <MKTGINFO>Banco do Brasil, esse parceiro � todo seu.
689
+ </STMTRS>
690
+ </STMTTRNRS>
691
+ </BANKMSGSRSV1>
692
+ </OFX>
@@ -1,4 +1,4 @@
1
- require "spec/spec_helper"
1
+ require "spec_helper"
2
2
 
3
3
  describe OFX::Account do
4
4
  before do
@@ -1,4 +1,4 @@
1
- require "spec/spec_helper"
1
+ require "spec_helper"
2
2
 
3
3
  describe OFX::Parser::OFX102 do
4
4
  before do
@@ -1,4 +1,4 @@
1
- require "spec/spec_helper"
1
+ require "spec_helper"
2
2
 
3
3
  describe OFX::Parser do
4
4
  before do
@@ -1,4 +1,4 @@
1
- require "spec/spec_helper"
1
+ require "spec_helper"
2
2
 
3
3
  describe OFX do
4
4
  describe "#OFX" do
@@ -1,4 +1,4 @@
1
- require "spec/spec_helper"
1
+ require "spec_helper"
2
2
 
3
3
  describe OFX::Transaction do
4
4
  before do
@@ -104,4 +104,30 @@ describe OFX::Transaction do
104
104
  @transaction.ref_number.should == "101.901"
105
105
  end
106
106
  end
107
- end
107
+
108
+ context "with other types" do
109
+
110
+ before do
111
+ @ofx = OFX::Parser::Base.new("spec/fixtures/bb.ofx")
112
+ @parser = @ofx.parser
113
+ @account = @parser.account
114
+ end
115
+
116
+ it "should return dep" do
117
+ @transaction = @account.transactions[8]
118
+ @transaction.type.should == :dep
119
+ end
120
+
121
+ it "should return xfer" do
122
+ @transaction = @account.transactions[17]
123
+ @transaction.type.should == :xfer
124
+ end
125
+
126
+ it "should return cash" do
127
+ @transaction = @account.transactions[44]
128
+ @transaction.type.should == :cash
129
+ end
130
+
131
+ end
132
+
133
+ end
@@ -1,14 +1,9 @@
1
- require "rubygems"
2
- require "spec"
3
-
4
- $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
5
-
6
1
  require "ofx"
7
2
 
8
- Spec::Matchers.define :have_key do |key|
3
+ RSpec::Matchers.define :have_key do |key|
9
4
  match do |hash|
10
- hash.respond_to?(:keys) &&
5
+ hash.respond_to?(:keys) &&
11
6
  hash.keys.kind_of?(Array) &&
12
7
  hash.keys.include?(key)
13
8
  end
14
- end
9
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 7
9
- version: 0.2.7
8
+ - 8
9
+ version: 0.2.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nando Vieira
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-29 00:00:00 -03:00
17
+ date: 2010-10-30 00:00:00 -02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: nokogiri
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
@@ -29,8 +30,24 @@ dependencies:
29
30
  version: "0"
30
31
  type: :runtime
31
32
  version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rspec
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 0
44
+ - 0
45
+ version: 2.0.0
46
+ type: :development
47
+ version_requirements: *id002
32
48
  description: |
33
- A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2.
49
+ A simple OFX (Open Financial Exchange) parser built on top of Nokogiri.
50
+ Currently supports OFX 1.0.2.
34
51
 
35
52
  Usage:
36
53
 
@@ -38,14 +55,19 @@ description: |
38
55
  p ofx
39
56
  end
40
57
 
41
- email: fnando.vieira@gmail.com
58
+ email:
59
+ - fnando.vieira@gmail.com
42
60
  executables: []
43
61
 
44
62
  extensions: []
45
63
 
46
- extra_rdoc_files:
47
- - README.rdoc
64
+ extra_rdoc_files: []
65
+
48
66
  files:
67
+ - .gitignore
68
+ - Gemfile
69
+ - Gemfile.lock
70
+ - README.rdoc
49
71
  - Rakefile
50
72
  - lib/ofx.rb
51
73
  - lib/ofx/account.rb
@@ -58,6 +80,7 @@ files:
58
80
  - lib/ofx/version.rb
59
81
  - ofx.gemspec
60
82
  - spec/fixtures/avatar.gif
83
+ - spec/fixtures/bb.ofx
61
84
  - spec/fixtures/invalid_version.ofx
62
85
  - spec/fixtures/sample.ofx
63
86
  - spec/fixtures/utf8.ofx
@@ -67,17 +90,17 @@ files:
67
90
  - spec/ofx/ofx_spec.rb
68
91
  - spec/ofx/transaction_spec.rb
69
92
  - spec/spec_helper.rb
70
- - README.rdoc
71
93
  has_rdoc: true
72
- homepage: http://github.com/fnando/ofx
94
+ homepage: http://rubygems.org/gems/ofx
73
95
  licenses: []
74
96
 
75
97
  post_install_message:
76
- rdoc_options:
77
- - --charset=UTF-8
98
+ rdoc_options: []
99
+
78
100
  require_paths:
79
101
  - lib
80
102
  required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
81
104
  requirements:
82
105
  - - ">="
83
106
  - !ruby/object:Gem::Version
@@ -85,6 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
108
  - 0
86
109
  version: "0"
87
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
88
112
  requirements:
89
113
  - - ">="
90
114
  - !ruby/object:Gem::Version
@@ -93,12 +117,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
117
  version: "0"
94
118
  requirements: []
95
119
 
96
- rubyforge_project:
97
- rubygems_version: 1.3.6
120
+ rubyforge_project: ofx
121
+ rubygems_version: 1.3.7
98
122
  signing_key:
99
123
  specification_version: 3
100
124
  summary: A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2.
101
125
  test_files:
126
+ - spec/fixtures/avatar.gif
127
+ - spec/fixtures/bb.ofx
128
+ - spec/fixtures/invalid_version.ofx
129
+ - spec/fixtures/sample.ofx
130
+ - spec/fixtures/utf8.ofx
102
131
  - spec/ofx/account_spec.rb
103
132
  - spec/ofx/ofx102_spec.rb
104
133
  - spec/ofx/ofx_parser_spec.rb