Skip to content

Commit 8d6649f

Browse files
Refact parser logic to use OFX 1.0.2 for version 100 files.
1 parent e9183a9 commit 8d6649f

File tree

6 files changed

+17
-126
lines changed

6 files changed

+17
-126
lines changed

lib/ofx.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
require 'ofx/errors'
1010
require 'ofx/parser'
1111
require 'ofx/parser/ofx102'
12-
require 'ofx/parser/ofx100'
1312
require 'ofx/parser/ofx103'
1413
require 'ofx/parser/ofx211'
1514
require 'ofx/foundation'

lib/ofx/parser.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def initialize(resource)
1717
end
1818

1919
case headers["VERSION"]
20-
when /100/ then
21-
@parser = OFX100.new(:headers => headers, :body => body)
22-
when /102/ then
20+
# when /100/ then
21+
# @parser = OFX100.new(:headers => headers, :body => body)
22+
when /102|100/ then
2323
@parser = OFX102.new(:headers => headers, :body => body)
2424
when /103/ then
2525
@parser = OFX103.new(:headers => headers, :body => body)

lib/ofx/parser/ofx100.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

spec/fixtures/v100.ofx

Lines changed: 0 additions & 64 deletions
This file was deleted.

spec/ofx/ofx100_spec.rb

Lines changed: 0 additions & 51 deletions
This file was deleted.

spec/ofx/ofx_parser_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
}.to raise_error(OFX::UnsupportedFileError)
4848
end
4949

50+
it "uses 102 parser to parse version 100 ofx files" do
51+
expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')
52+
53+
ofx = OFX::Parser::Base.new(ofx_2_example('100'))
54+
expect(ofx.parser).to eql 'ofx-102-parser'
55+
end
56+
5057
it "uses 211 parser to parse version 200 ofx files" do
5158
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
5259

@@ -61,6 +68,13 @@
6168
expect(ofx.parser).to eql 'ofx-211-parser'
6269
end
6370

71+
it "uses 211 parser to parse version 220 ofx files" do
72+
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
73+
74+
ofx = OFX::Parser::Base.new(ofx_2_example('220'))
75+
expect(ofx.parser).to eql 'ofx-211-parser'
76+
end
77+
6478
describe "headers" do
6579
it "has OFXHEADER" do
6680
expect(@ofx.headers["OFXHEADER"]).to eql "100"

0 commit comments

Comments
 (0)