ofx 0.3.6 → 0.3.8
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 +4 -4
- data/lib/ofx/parser.rb +1 -3
- data/lib/ofx/version.rb +1 -1
- data/lib/ofx.rb +0 -1
- data/spec/ofx/ofx_parser_spec.rb +38 -16
- metadata +30 -4
- data/lib/ofx/parser/ofx103.rb +0 -7
- data/spec/ofx/ofx103_spec.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 390b59aff79c7a69d32b1344a63e6041c1131bbc98a45d8ac1557a172dea58bc
|
4
|
+
data.tar.gz: 2b3555e7617f797df7ecf2938a73e24e57638bec8f57ff5c5d317544bcd9bf78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 960600058ef4b603ae95d35e0eadb4a60bbb8beb15b62164538f69e40b605e7dadeca048979b69ffce4608b642a826c34f59c5d5f04597cc815d38262b901c23
|
7
|
+
data.tar.gz: 106edb48e04d6882752085bcc569b03685506e6e4a27d4e3d4e629374060e9e374f89e0cbd8ee27f81ee335c84b15eccd37541a12844ae0da689ba6b29729ea3
|
data/lib/ofx/parser.rb
CHANGED
@@ -17,10 +17,8 @@ module OFX
|
|
17
17
|
end
|
18
18
|
|
19
19
|
case headers["VERSION"]
|
20
|
-
when /100|102/ then
|
20
|
+
when /100|102|103/ then
|
21
21
|
@parser = OFX102.new(:headers => headers, :body => body)
|
22
|
-
when /103/ then
|
23
|
-
@parser = OFX103.new(:headers => headers, :body => body)
|
24
22
|
when /200|202|211|220/ then
|
25
23
|
@parser = OFX211.new(:headers => headers, :body => body)
|
26
24
|
else
|
data/lib/ofx/version.rb
CHANGED
data/lib/ofx.rb
CHANGED
data/spec/ofx/ofx_parser_spec.rb
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe OFX::Parser do
|
4
|
+
def ofx_example_to(version)
|
5
|
+
<<~OFX_CONTENT
|
6
|
+
<?xml version="1.0" encoding="US-ASCII"?>
|
7
|
+
|
8
|
+
<?OFX OFXHEADER="200" VERSION="#{version}" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>"
|
9
|
+
|
10
|
+
<OFX>
|
11
|
+
</OFX>
|
12
|
+
OFX_CONTENT
|
13
|
+
end
|
14
|
+
|
4
15
|
before do
|
5
16
|
@ofx = OFX::Parser::Base.new("spec/fixtures/sample.ofx")
|
6
17
|
end
|
@@ -47,30 +58,50 @@ describe OFX::Parser do
|
|
47
58
|
}.should raise_error(OFX::UnsupportedFileError)
|
48
59
|
end
|
49
60
|
|
50
|
-
it "
|
61
|
+
it "should use 102 parser to parse version 100 ofx files" do
|
62
|
+
expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')
|
63
|
+
|
64
|
+
ofx = OFX::Parser::Base.new(ofx_example_to('100'))
|
65
|
+
expect(ofx.parser).to eql 'ofx-102-parser'
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should use 102 parser to parse version 102 ofx files" do
|
69
|
+
expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')
|
70
|
+
|
71
|
+
ofx = OFX::Parser::Base.new(ofx_example_to('102'))
|
72
|
+
expect(ofx.parser).to eql 'ofx-102-parser'
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should use 102 parser to parse version 103 ofx files" do
|
51
76
|
expect(OFX::Parser::OFX102).to receive(:new).and_return('ofx-102-parser')
|
52
77
|
|
53
|
-
ofx = OFX::Parser::Base.new(
|
78
|
+
ofx = OFX::Parser::Base.new(ofx_example_to('103'))
|
54
79
|
expect(ofx.parser).to eql 'ofx-102-parser'
|
55
80
|
end
|
56
81
|
|
57
|
-
it "
|
82
|
+
it "should use 211 parser to parse version 200 ofx files" do
|
58
83
|
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
|
59
84
|
|
60
|
-
ofx = OFX::Parser::Base.new(
|
85
|
+
ofx = OFX::Parser::Base.new(ofx_example_to('200'))
|
61
86
|
ofx.parser.should == 'ofx-211-parser'
|
62
87
|
end
|
63
88
|
|
64
89
|
it "should use 211 parser to parse version 202 ofx files" do
|
65
90
|
OFX::Parser::OFX211.stub(:new).and_return('ofx-211-parser')
|
66
|
-
ofx = OFX::Parser::Base.new(
|
91
|
+
ofx = OFX::Parser::Base.new(ofx_example_to('202'))
|
92
|
+
ofx.parser.should == 'ofx-211-parser'
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should use 211 parser to parse version 211 ofx files" do
|
96
|
+
OFX::Parser::OFX211.stub(:new).and_return('ofx-211-parser')
|
97
|
+
ofx = OFX::Parser::Base.new(ofx_example_to('211'))
|
67
98
|
ofx.parser.should == 'ofx-211-parser'
|
68
99
|
end
|
69
100
|
|
70
|
-
it "
|
101
|
+
it "should use 211 parser to parse version 220 ofx files" do
|
71
102
|
expect(OFX::Parser::OFX211).to receive(:new).and_return('ofx-211-parser')
|
72
103
|
|
73
|
-
ofx = OFX::Parser::Base.new(
|
104
|
+
ofx = OFX::Parser::Base.new(ofx_example_to('220'))
|
74
105
|
expect(ofx.parser).to eql 'ofx-211-parser'
|
75
106
|
end
|
76
107
|
|
@@ -124,13 +155,4 @@ describe OFX::Parser do
|
|
124
155
|
@ofx.headers.size.should be(9)
|
125
156
|
end
|
126
157
|
end
|
127
|
-
|
128
|
-
def ofx_2_example(version)
|
129
|
-
<<-EndOfx
|
130
|
-
<?xml version="1.0" encoding="US-ASCII"?>
|
131
|
-
<?OFX OFXHEADER="200" VERSION="#{version}" SECURITY="NONE" OLDFILEUID="NONE" NEWFILEUID="NONE"?>"
|
132
|
-
<OFX>
|
133
|
-
</OFX>
|
134
|
-
EndOfx
|
135
|
-
end
|
136
158
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ofx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-06-
|
12
|
+
date: 2025-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -73,6 +73,34 @@ dependencies:
|
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3.10'
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: erb
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 4.0.4
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.0.4
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: stringio
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.1.7
|
97
|
+
type: :runtime
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.1.7
|
76
104
|
description: |
|
77
105
|
A simple OFX (Open Financial Exchange) parser built on top of Nokogiri.
|
78
106
|
Currently supports OFX 102, 200 and 211.
|
@@ -98,7 +126,6 @@ files:
|
|
98
126
|
- lib/ofx/foundation.rb
|
99
127
|
- lib/ofx/parser.rb
|
100
128
|
- lib/ofx/parser/ofx102.rb
|
101
|
-
- lib/ofx/parser/ofx103.rb
|
102
129
|
- lib/ofx/parser/ofx211.rb
|
103
130
|
- lib/ofx/sign_on.rb
|
104
131
|
- lib/ofx/statement.rb
|
@@ -107,7 +134,6 @@ files:
|
|
107
134
|
- lib/ofx/version.rb
|
108
135
|
- spec/ofx/account_spec.rb
|
109
136
|
- spec/ofx/ofx102_spec.rb
|
110
|
-
- spec/ofx/ofx103_spec.rb
|
111
137
|
- spec/ofx/ofx211_spec.rb
|
112
138
|
- spec/ofx/ofx_parser_spec.rb
|
113
139
|
- spec/ofx/ofx_spec.rb
|
data/lib/ofx/parser/ofx103.rb
DELETED
data/spec/ofx/ofx103_spec.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe OFX::Parser::OFX103 do
|
4
|
-
before do
|
5
|
-
@ofx = OFX::Parser::Base.new("spec/fixtures/v103.ofx")
|
6
|
-
@parser = @ofx.parser
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should have a version" do
|
10
|
-
OFX::Parser::OFX103::VERSION.should == "1.0.3"
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should set headers" do
|
14
|
-
@parser.headers.should == @ofx.headers
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should trim trailing whitespace from headers" do
|
18
|
-
headers = OFX::Parser::OFX103.parse_headers("VERSION:103 ")
|
19
|
-
headers["VERSION"].should == "103"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should set body" do
|
23
|
-
@parser.body.should == @ofx.body
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should set account" do
|
27
|
-
@parser.account.should be_a_kind_of(OFX::Account)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should set account" do
|
31
|
-
@parser.sign_on.should be_a_kind_of(OFX::SignOn)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should set statements" do
|
35
|
-
@parser.statements.size.should == 1
|
36
|
-
@parser.statements.first.should be_a_kind_of(OFX::Statement)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should know about all transaction types" do
|
40
|
-
valid_types = [
|
41
|
-
'CREDIT', 'DEBIT', 'INT', 'DIV', 'FEE', 'SRVCHG', 'DEP', 'ATM', 'POS', 'XFER',
|
42
|
-
'CHECK', 'PAYMENT', 'CASH', 'DIRECTDEP', 'DIRECTDEBIT', 'REPEATPMT', 'OTHER', 'IN', 'OUT'
|
43
|
-
]
|
44
|
-
valid_types.sort.should == OFX::Parser::OFX103::TRANSACTION_TYPES.keys.sort
|
45
|
-
|
46
|
-
valid_types.each do |transaction_type|
|
47
|
-
transaction_type.downcase.to_sym.should equal OFX::Parser::OFX103::TRANSACTION_TYPES[transaction_type]
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|