ofx 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.markdown → README.rdoc} +12 -18
- data/lib/ofx.rb +11 -1
- data/lib/ofx/version.rb +1 -1
- data/ofx.gemspec +3 -4
- data/spec/ofx/ofx_spec.rb +12 -2
- data/spec/ofx/transaction_spec.rb +6 -6
- metadata +4 -4
@@ -1,28 +1,24 @@
|
|
1
|
-
OFX
|
2
|
-
===
|
1
|
+
= OFX
|
3
2
|
|
4
3
|
A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2.
|
5
4
|
|
6
5
|
Works on both Ruby 1.8 and 1.9.
|
7
6
|
|
8
|
-
|
9
|
-
-----
|
7
|
+
== Usage
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
OFX("file.ofx") do |ofx|
|
14
|
-
p ofx.account
|
15
|
-
p ofx.account.balance
|
16
|
-
p ofx.transactions
|
17
|
-
end
|
9
|
+
require "ofx"
|
18
10
|
|
19
|
-
|
20
|
-
|
11
|
+
OFX("file.ofx") do
|
12
|
+
p account
|
13
|
+
p account.balance
|
14
|
+
p account.transactions
|
15
|
+
end
|
21
16
|
|
22
|
-
|
17
|
+
== Maintainer
|
23
18
|
|
24
|
-
|
25
|
-
|
19
|
+
* Nando Vieira - http://simplesideias.com.br
|
20
|
+
|
21
|
+
== License
|
26
22
|
|
27
23
|
(The MIT License)
|
28
24
|
|
@@ -44,5 +40,3 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
44
40
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
45
41
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
46
42
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
47
|
-
|
48
|
-
|
data/lib/ofx.rb
CHANGED
@@ -11,5 +11,15 @@ require "ofx/transaction"
|
|
11
11
|
require "ofx/version"
|
12
12
|
|
13
13
|
def OFX(resource, &block)
|
14
|
-
|
14
|
+
parser = OFX::Parser::Base.new(resource).parser
|
15
|
+
|
16
|
+
if block_given?
|
17
|
+
if block.arity == 1
|
18
|
+
yield parser
|
19
|
+
else
|
20
|
+
parser.instance_eval(&block)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
parser
|
15
25
|
end
|
data/lib/ofx/version.rb
CHANGED
data/ofx.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ofx}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nando Vieira"]
|
@@ -20,11 +20,10 @@ Usage:
|
|
20
20
|
}
|
21
21
|
s.email = %q{fnando.vieira@gmail.com}
|
22
22
|
s.extra_rdoc_files = [
|
23
|
-
"README.
|
23
|
+
"README.rdoc"
|
24
24
|
]
|
25
25
|
s.files = [
|
26
|
-
"
|
27
|
-
"Rakefile",
|
26
|
+
"Rakefile",
|
28
27
|
"lib/ofx.rb",
|
29
28
|
"lib/ofx/account.rb",
|
30
29
|
"lib/ofx/balance.rb",
|
data/spec/ofx/ofx_spec.rb
CHANGED
@@ -4,8 +4,18 @@ describe OFX do
|
|
4
4
|
describe "#OFX" do
|
5
5
|
it "should yield an OFX instance" do
|
6
6
|
OFX("spec/fixtures/sample.ofx") do |ofx|
|
7
|
-
ofx.should
|
7
|
+
ofx.class.should == OFX::Parser::OFX102
|
8
8
|
end
|
9
9
|
end
|
10
|
+
|
11
|
+
it "should be an OFX instance" do
|
12
|
+
OFX("spec/fixtures/sample.ofx") do
|
13
|
+
self.class.should == OFX::Parser::OFX102
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return parser" do
|
18
|
+
OFX("spec/fixtures/sample.ofx").class.should == OFX::Parser::OFX102
|
19
|
+
end
|
10
20
|
end
|
11
|
-
end
|
21
|
+
end
|
@@ -6,7 +6,7 @@ describe OFX::Transaction do
|
|
6
6
|
@parser = @ofx.parser
|
7
7
|
@account = @parser.account
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
context "debit" do
|
11
11
|
before do
|
12
12
|
@transaction = @account.transactions[0]
|
@@ -33,14 +33,14 @@ describe OFX::Transaction do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should have date" do
|
36
|
-
@transaction.posted_at.should == Time.parse("2009-10-09
|
36
|
+
@transaction.posted_at.should == Time.parse("2009-10-09 08:00:00")
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should have type" do
|
40
40
|
@transaction.type.should == :debit
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
context "credit" do
|
45
45
|
before do
|
46
46
|
@transaction = @account.transactions[1]
|
@@ -74,12 +74,12 @@ describe OFX::Transaction do
|
|
74
74
|
@transaction.type.should == :credit
|
75
75
|
end
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
context "with more info" do
|
79
79
|
before do
|
80
80
|
@transaction = @account.transactions[2]
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
it "should set payee" do
|
84
84
|
@transaction.payee.should == "Pagto conta telefone"
|
85
85
|
end
|
@@ -95,7 +95,7 @@ describe OFX::Transaction do
|
|
95
95
|
it "should have type" do
|
96
96
|
@transaction.type.should == :other
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
it "should have reference number" do
|
100
100
|
@transaction.ref_number.should == "101.901"
|
101
101
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Nando Vieira
|
@@ -44,9 +44,8 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
|
46
46
|
extra_rdoc_files:
|
47
|
-
- README.
|
47
|
+
- README.rdoc
|
48
48
|
files:
|
49
|
-
- README.markdown
|
50
49
|
- Rakefile
|
51
50
|
- lib/ofx.rb
|
52
51
|
- lib/ofx/account.rb
|
@@ -66,6 +65,7 @@ files:
|
|
66
65
|
- spec/ofx/ofx_spec.rb
|
67
66
|
- spec/ofx/transaction_spec.rb
|
68
67
|
- spec/spec_helper.rb
|
68
|
+
- README.rdoc
|
69
69
|
has_rdoc: false
|
70
70
|
homepage: http://github.com/fnando/ofx
|
71
71
|
licenses: []
|