diff --git a/Gemfile.lock b/Gemfile.lock
index a244f6b..3c7dfb6 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -34,11 +34,11 @@ GEM
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.10)
method_source (1.1.0)
- mini_portile2 (2.8.7)
+ mini_portile2 (2.8.9)
nenv (0.3.0)
nkf (0.2.0)
- nokogiri (1.14.5)
- mini_portile2 (~> 2.8.0)
+ nokogiri (1.15.7)
+ mini_portile2 (~> 2.8.2)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
diff --git a/lib/ofx.rb b/lib/ofx.rb
index f58dcbe..defcc89 100644
--- a/lib/ofx.rb
+++ b/lib/ofx.rb
@@ -9,7 +9,6 @@
require 'ofx/errors'
require 'ofx/parser'
require 'ofx/parser/ofx102'
-require 'ofx/parser/ofx103'
require 'ofx/parser/ofx211'
require 'ofx/foundation'
require 'ofx/balance'
diff --git a/lib/ofx/parser.rb b/lib/ofx/parser.rb
index 8adadc2..7753cc8 100644
--- a/lib/ofx/parser.rb
+++ b/lib/ofx/parser.rb
@@ -17,10 +17,8 @@ def initialize(resource)
end
case headers["VERSION"]
- when /100|102/ then
+ when /100|102|103/ then
@parser = OFX102.new(:headers => headers, :body => body)
- when /103/ then
- @parser = OFX103.new(:headers => headers, :body => body)
when /200|202|211|220/ then
@parser = OFX211.new(:headers => headers, :body => body)
else
diff --git a/lib/ofx/parser/ofx103.rb b/lib/ofx/parser/ofx103.rb
deleted file mode 100644
index 13aad78..0000000
--- a/lib/ofx/parser/ofx103.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module OFX
- module Parser
- class OFX103 < OFX102
- VERSION = '1.0.3'
- end
- end
-end
diff --git a/spec/fixtures/v103.ofx b/spec/fixtures/v103.ofx
deleted file mode 100644
index d02df24..0000000
--- a/spec/fixtures/v103.ofx
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-OFXHEADER:100
-DATA:OFXSGML
-VERSION:103
-SECURITY:NONE
-ENCODING:USASCII
-CHARSET:1252
-COMPRESSION:NONE
-OLDFILEUID:NONE
-NEWFILEUID:NONE
-
-
-
-
-
- 0
- INFO
-
- 20150507164333.979[-0300:BRT]
- POR
-
- HSBC Bank Brasil S.A.
- 1
-
-
-
-
-
- 1
-
- 0
- INFO
-
-
- BRL
-
- 399
- 26215973324
- CHECKING
-
-
- 20150501
- 20150507
-
-
- PAYMENT
- 20150504120000
- 20150504120000
- -1020.88
- 201505041
- 0390003
- PAGAMENTO TITULO-CNB
- PAGAMENTO TITULO-CNB
-
-
-
- PAYMENT
- 20150505120000
- 20150505120000
- -82.10
- 201505051
- 0000000
- TAR PACOTE MENSAL
- TAR PACOTE MENSAL
-
-
-
-
- 3806.63
- 20150507164333.980[-0300:BRT]
-
-
- 3806.63
- 20150507164333.980[-0300:BRT]
-
-
-
-
-
diff --git a/spec/ofx/ofx103_spec.rb b/spec/ofx/ofx103_spec.rb
deleted file mode 100644
index aebb822..0000000
--- a/spec/ofx/ofx103_spec.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require "spec_helper"
-
-describe OFX::Parser::OFX103 do
- before do
- @ofx = OFX::Parser::Base.new("spec/fixtures/v103.ofx")
- @parser = @ofx.parser
- end
-
- it "has a version" do
- expect(OFX::Parser::OFX103::VERSION).to eql "1.0.3"
- end
-
- it "sets headers" do
- expect(@parser.headers).to eql @ofx.headers
- end
-
- it "trims trailing whitespace from headers" do
- headers = OFX::Parser::OFX103.parse_headers("VERSION:103 ")
-
- expect(headers["VERSION"]).to eql "103"
- end
-
- it "sets body" do
- expect(@parser.body).to eql @ofx.body
- end
-
- it "sets account" do
- expect(@parser.account).to be_a_kind_of(OFX::Account)
- end
-
- it "sets account" do
- expect(@parser.sign_on).to be_a_kind_of(OFX::SignOn)
- end
-
- it "sets statements" do
- expect(@parser.statements.size).to eql 1
- expect(@parser.statements.first).to be_a_kind_of(OFX::Statement)
- end
-
- it "knows about all transaction types" do
- valid_types = [
- 'CREDIT', 'DEBIT', 'INT', 'DIV', 'FEE', 'SRVCHG', 'DEP', 'ATM', 'POS', 'XFER',
- 'CHECK', 'PAYMENT', 'CASH', 'DIRECTDEP', 'DIRECTDEBIT', 'REPEATPMT', 'OTHER', 'IN', 'OUT'
- ]
- expect(valid_types.sort).to eql OFX::Parser::OFX103::TRANSACTION_TYPES.keys.sort
-
- valid_types.each do |transaction_type|
- expect(transaction_type.downcase.to_sym).to eql OFX::Parser::OFX103::TRANSACTION_TYPES[transaction_type]
- end
- end
-end
diff --git a/spec/ofx/ofx_parser_spec.rb b/spec/ofx/ofx_parser_spec.rb
index 91bf8e4..32a916e 100644
--- a/spec/ofx/ofx_parser_spec.rb
+++ b/spec/ofx/ofx_parser_spec.rb
@@ -1,6 +1,17 @@
require "spec_helper"
describe OFX::Parser do
+ def ofx_example_to(version)
+ <<~OFX_CONTENT
+
+
+ "
+
+
+
+ OFX_CONTENT
+ end
+
before do
@ofx = OFX::Parser::Base.new("spec/fixtures/sample.ofx")
end
@@ -50,28 +61,35 @@
it "uses 102 parser to parse version 100 ofx files" do
expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')
- ofx = OFX::Parser::Base.new(ofx_2_example('100'))
+ ofx = OFX::Parser::Base.new(ofx_example_to('100'))
+ expect(ofx.parser).to eql 'ofx-102-parser'
+ end
+
+ it "uses 102 parser to parse version 103 ofx files" do
+ expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')
+
+ ofx = OFX::Parser::Base.new(ofx_example_to('103'))
expect(ofx.parser).to eql 'ofx-102-parser'
end
it "uses 211 parser to parse version 200 ofx files" do
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
- ofx = OFX::Parser::Base.new(ofx_2_example('200'))
+ ofx = OFX::Parser::Base.new(ofx_example_to('200'))
expect(ofx.parser).to eql 'ofx-211-parser'
end
it "uses 211 parser to parse version 202 ofx files" do
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
- ofx = OFX::Parser::Base.new(ofx_2_example('202'))
+ ofx = OFX::Parser::Base.new(ofx_example_to('202'))
expect(ofx.parser).to eql 'ofx-211-parser'
end
it "uses 211 parser to parse version 220 ofx files" do
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
- ofx = OFX::Parser::Base.new(ofx_2_example('220'))
+ ofx = OFX::Parser::Base.new(ofx_example_to('220'))
expect(ofx.parser).to eql 'ofx-211-parser'
end
@@ -125,13 +143,4 @@
expect(@ofx.headers.size).to be(9)
end
end
-
- def ofx_2_example(version)
- <<-EndOfx
-
-"
-
-
- EndOfx
- end
end