ofx 0.2.9 → 0.3.4
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 +7 -0
- data/README.rdoc +12 -3
- data/Rakefile +2 -0
- data/lib/ofx/account.rb +1 -0
- data/lib/ofx/parser/ofx102.rb +158 -50
- data/lib/ofx/parser/ofx103.rb +7 -0
- data/lib/ofx/parser/ofx211.rb +40 -0
- data/lib/ofx/parser.rb +29 -30
- data/lib/ofx/sign_on.rb +8 -0
- data/lib/ofx/statement.rb +11 -0
- data/lib/ofx/status.rb +12 -0
- data/lib/ofx/transaction.rb +4 -1
- data/lib/ofx/version.rb +2 -2
- data/lib/ofx.rb +19 -12
- data/spec/ofx/account_spec.rb +96 -9
- data/spec/ofx/ofx102_spec.rb +48 -5
- data/spec/ofx/ofx103_spec.rb +50 -0
- data/spec/ofx/ofx211_spec.rb +84 -0
- data/spec/ofx/ofx_parser_spec.rb +24 -3
- data/spec/ofx/sign_on_spec.rb +27 -0
- data/spec/ofx/statement_spec.rb +131 -0
- data/spec/ofx/status_spec.rb +47 -0
- data/spec/ofx/transaction_spec.rb +70 -7
- metadata +96 -95
- data/.gitignore +0 -3
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -29
- data/ofx.gemspec +0 -31
- data/spec/fixtures/avatar.gif +0 -0
- data/spec/fixtures/bb.ofx +0 -700
- data/spec/fixtures/invalid_version.ofx +0 -308
- data/spec/fixtures/sample.ofx +0 -308
- data/spec/fixtures/utf8.ofx +0 -308
@@ -13,7 +13,7 @@ describe OFX::Transaction do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should set amount" do
|
16
|
-
@transaction.amount.should == -35.34
|
16
|
+
@transaction.amount.should == BigDecimal('-35.34')
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should cast amount to BigDecimal" do
|
@@ -37,12 +37,20 @@ describe OFX::Transaction do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should have date" do
|
40
|
-
@transaction.posted_at.should == Time.parse("2009-10-09 08:00:00")
|
40
|
+
@transaction.posted_at.should == Time.parse("2009-10-09 08:00:00 +0000")
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should have user date' do
|
44
|
+
@transaction.occurred_at.should == Time.parse("2009-09-09 08:00:00 +0000")
|
41
45
|
end
|
42
46
|
|
43
47
|
it "should have type" do
|
44
48
|
@transaction.type.should == :debit
|
45
49
|
end
|
50
|
+
|
51
|
+
it "should have sic" do
|
52
|
+
@transaction.sic.should == '5072'
|
53
|
+
end
|
46
54
|
end
|
47
55
|
|
48
56
|
context "credit" do
|
@@ -51,7 +59,7 @@ describe OFX::Transaction do
|
|
51
59
|
end
|
52
60
|
|
53
61
|
it "should set amount" do
|
54
|
-
@transaction.amount.should == 60.39
|
62
|
+
@transaction.amount.should == BigDecimal('60.39')
|
55
63
|
end
|
56
64
|
|
57
65
|
it "should set amount in pennies" do
|
@@ -71,12 +79,20 @@ describe OFX::Transaction do
|
|
71
79
|
end
|
72
80
|
|
73
81
|
it "should have date" do
|
74
|
-
@transaction.posted_at.should == Time.parse("2009-10-16 08:00:00")
|
82
|
+
@transaction.posted_at.should == Time.parse("2009-10-16 08:00:00 +0000")
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should have user date" do
|
86
|
+
@transaction.occurred_at.should == Time.parse("2009-09-16 08:00:00 +0000")
|
75
87
|
end
|
76
88
|
|
77
89
|
it "should have type" do
|
78
90
|
@transaction.type.should == :credit
|
79
91
|
end
|
92
|
+
|
93
|
+
it "should have empty sic" do
|
94
|
+
@transaction.sic.should == ''
|
95
|
+
end
|
80
96
|
end
|
81
97
|
|
82
98
|
context "with more info" do
|
@@ -93,7 +109,11 @@ describe OFX::Transaction do
|
|
93
109
|
end
|
94
110
|
|
95
111
|
it "should have date" do
|
96
|
-
@transaction.posted_at.should == Time.parse("2009-10-19 12:00:00")
|
112
|
+
@transaction.posted_at.should == Time.parse("2009-10-19 12:00:00 -0300")
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should have user date" do
|
116
|
+
@transaction.occurred_at.should == Time.parse("2009-10-17 12:00:00 -0300")
|
97
117
|
end
|
98
118
|
|
99
119
|
it "should have type" do
|
@@ -105,8 +125,17 @@ describe OFX::Transaction do
|
|
105
125
|
end
|
106
126
|
end
|
107
127
|
|
108
|
-
context "with
|
128
|
+
context "with name" do
|
129
|
+
before do
|
130
|
+
@transaction = @account.transactions[3]
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should set name" do
|
134
|
+
@transaction.name.should == "Pagto conta telefone"
|
135
|
+
end
|
136
|
+
end
|
109
137
|
|
138
|
+
context "with other types" do
|
110
139
|
before do
|
111
140
|
@ofx = OFX::Parser::Base.new("spec/fixtures/bb.ofx")
|
112
141
|
@parser = @ofx.parser
|
@@ -132,7 +161,41 @@ describe OFX::Transaction do
|
|
132
161
|
@transaction = @account.transactions[0]
|
133
162
|
@transaction.type.should == :check
|
134
163
|
end
|
135
|
-
|
136
164
|
end
|
137
165
|
|
166
|
+
context "decimal values using a comma" do
|
167
|
+
before do
|
168
|
+
@ofx = OFX::Parser::Base.new("spec/fixtures/santander.ofx")
|
169
|
+
@parser = @ofx.parser
|
170
|
+
@account = @parser.account
|
171
|
+
end
|
172
|
+
|
173
|
+
context "debit" do
|
174
|
+
before do
|
175
|
+
@transaction = @account.transactions[0]
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should set amount" do
|
179
|
+
@transaction.amount.should == BigDecimal('-11.76')
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should set amount in pennies" do
|
183
|
+
@transaction.amount_in_pennies.should == -1176
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
context "credit" do
|
188
|
+
before do
|
189
|
+
@transaction = @account.transactions[3]
|
190
|
+
end
|
191
|
+
|
192
|
+
it "should set amount" do
|
193
|
+
@transaction.amount.should == BigDecimal('47.01')
|
194
|
+
end
|
195
|
+
|
196
|
+
it "should set amount in pennies" do
|
197
|
+
@transaction.amount_in_pennies.should == 4701
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
138
201
|
end
|
metadata
CHANGED
@@ -1,72 +1,88 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ofx
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 9
|
9
|
-
version: 0.2.9
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.4
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Nando Vieira
|
13
|
-
|
8
|
+
- Anna Cruz
|
9
|
+
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: nokogiri
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
version: "0"
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.13.1
|
31
21
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: rspec
|
35
22
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.13.1
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: byebug
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 11.1.3
|
46
35
|
type: :development
|
47
|
-
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 11.1.3
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 13.0.6
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 13.0.6
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.10'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.10'
|
48
70
|
description: |
|
49
71
|
A simple OFX (Open Financial Exchange) parser built on top of Nokogiri.
|
50
|
-
Currently supports OFX
|
51
|
-
|
72
|
+
Currently supports OFX 102, 200 and 211.
|
73
|
+
|
52
74
|
Usage:
|
53
|
-
|
54
|
-
OFX(
|
75
|
+
|
76
|
+
OFX('sample.ofx') do |ofx|
|
55
77
|
p ofx
|
56
78
|
end
|
57
|
-
|
58
|
-
email:
|
79
|
+
email:
|
59
80
|
- fnando.vieira@gmail.com
|
81
|
+
- anna.cruz@gmail.com
|
60
82
|
executables: []
|
61
|
-
|
62
83
|
extensions: []
|
63
|
-
|
64
84
|
extra_rdoc_files: []
|
65
|
-
|
66
|
-
files:
|
67
|
-
- .gitignore
|
68
|
-
- Gemfile
|
69
|
-
- Gemfile.lock
|
85
|
+
files:
|
70
86
|
- README.rdoc
|
71
87
|
- Rakefile
|
72
88
|
- lib/ofx.rb
|
@@ -76,61 +92,46 @@ files:
|
|
76
92
|
- lib/ofx/foundation.rb
|
77
93
|
- lib/ofx/parser.rb
|
78
94
|
- lib/ofx/parser/ofx102.rb
|
95
|
+
- lib/ofx/parser/ofx103.rb
|
96
|
+
- lib/ofx/parser/ofx211.rb
|
97
|
+
- lib/ofx/sign_on.rb
|
98
|
+
- lib/ofx/statement.rb
|
99
|
+
- lib/ofx/status.rb
|
79
100
|
- lib/ofx/transaction.rb
|
80
101
|
- lib/ofx/version.rb
|
81
|
-
- ofx.gemspec
|
82
|
-
- spec/fixtures/avatar.gif
|
83
|
-
- spec/fixtures/bb.ofx
|
84
|
-
- spec/fixtures/invalid_version.ofx
|
85
|
-
- spec/fixtures/sample.ofx
|
86
|
-
- spec/fixtures/utf8.ofx
|
87
102
|
- spec/ofx/account_spec.rb
|
88
103
|
- spec/ofx/ofx102_spec.rb
|
104
|
+
- spec/ofx/ofx103_spec.rb
|
105
|
+
- spec/ofx/ofx211_spec.rb
|
89
106
|
- spec/ofx/ofx_parser_spec.rb
|
90
107
|
- spec/ofx/ofx_spec.rb
|
108
|
+
- spec/ofx/sign_on_spec.rb
|
109
|
+
- spec/ofx/statement_spec.rb
|
110
|
+
- spec/ofx/status_spec.rb
|
91
111
|
- spec/ofx/transaction_spec.rb
|
92
112
|
- spec/spec_helper.rb
|
93
|
-
has_rdoc: true
|
94
113
|
homepage: http://rubygems.org/gems/ofx
|
95
|
-
licenses:
|
96
|
-
|
97
|
-
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
98
118
|
rdoc_options: []
|
99
|
-
|
100
|
-
require_paths:
|
119
|
+
require_paths:
|
101
120
|
- lib
|
102
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
-
|
104
|
-
requirements:
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
105
123
|
- - ">="
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
|
-
requirements:
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
113
128
|
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
- 0
|
117
|
-
version: "0"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
118
131
|
requirements: []
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
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
|
131
|
-
- spec/ofx/account_spec.rb
|
132
|
-
- spec/ofx/ofx102_spec.rb
|
133
|
-
- spec/ofx/ofx_parser_spec.rb
|
134
|
-
- spec/ofx/ofx_spec.rb
|
135
|
-
- spec/ofx/transaction_spec.rb
|
136
|
-
- spec/spec_helper.rb
|
132
|
+
rubygems_version: 3.3.3
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently
|
136
|
+
supports OFX 102, 200 and 211.
|
137
|
+
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
ofx (0.2.8)
|
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/ofx.gemspec
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "ofx/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
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.
|
16
|
-
|
17
|
-
Usage:
|
18
|
-
|
19
|
-
OFX("sample.ofx") do |ofx|
|
20
|
-
p ofx
|
21
|
-
end
|
22
|
-
TXT
|
23
|
-
|
24
|
-
s.files = `git ls-files`.split("\n")
|
25
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
-
s.require_paths = ["lib"]
|
28
|
-
|
29
|
-
s.add_dependency "nokogiri"
|
30
|
-
s.add_development_dependency "rspec", ">= 2.0.0"
|
31
|
-
end
|
data/spec/fixtures/avatar.gif
DELETED
Binary file
|