forked from aasmith/ofx-parser
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://ofx-parser.googlecode.com/svn/trunk@2 fe641ded-ca33-0410-bb68-4527006b89d7
- Loading branch information
sciodev
committed
Jun 26, 2007
1 parent
90c968d
commit 34e9c7a
Showing
13 changed files
with
2,567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
== 1.0.0 / 2007-06-24 | ||
|
||
* Initial release. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
History.txt | ||
Manifest.txt | ||
README.txt | ||
Rakefile | ||
lib/class-extension.rb | ||
lib/ofx-parser.rb | ||
lib/ofx.rb | ||
lib/sic.rb | ||
test/fixtures/banking.ofx.sgml | ||
test/fixtures/creditcard.ofx.sgml | ||
test/fixtures/with_spaces.ofx.sgml | ||
test/test_ofx_parser.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
== ofx-parser | ||
by Andrew A. Smith | ||
|
||
http://ofx-parser.rubyforge.org/ | ||
http://rubyforge.org/projects/ofx-parser/ | ||
|
||
== DESCRIPTION: | ||
|
||
ofx-parser is a ruby library to parse a realistic subset of the lengthy OFX 1.x specification. | ||
|
||
== FEATURES/PROBLEMS: | ||
|
||
* Reads OFX responses - i.e. those downloaded from financial institutions and | ||
puts it into a usable object graph. | ||
* Supports the 3 main message sets: banking, credit card and investment | ||
accounts, as well as the required 'sign on' set. | ||
* Knows about SIC codes - if your institution provides them. | ||
See http://www.eeoc.gov/stats/jobpat/siccodes.html | ||
* Monetary amounts can be retrieved either as a raw string, or in pennies. | ||
* Supports OFX timestamps. | ||
|
||
== SYNOPSIS: | ||
|
||
Supports bank accounts: | ||
|
||
require 'rubygems' | ||
require 'ofx-parser' | ||
|
||
ofx = OfxParser::OfxParser.parse(open("bank-statement.ofx")) | ||
|
||
ofx.bank_account.number # => '103333333333' | ||
ofx.bank_account.routing_number # => '033000033' | ||
ofx.bank_account.balance # => '123.45' | ||
ofx.bank_account.balance_in_pennies # => 12345 | ||
|
||
ofx.bank_account.statement.start_date # => DateTime | ||
ofx.bank_account.statement.end_date # => DateTime | ||
|
||
ofx.bank_account.statement.transactions.size # => 4 | ||
|
||
ofx.bank_account.statement.transactions.first.payee # => "FOO, INC." | ||
ofx.bank_account.statement.transactions.first.type # => :DEBIT | ||
ofx.bank_account.statement.transactions.first.amount # => '-11.11' | ||
ofx.bank_account.statement.transactions.first.amount_in_pennies # => -1111 | ||
|
||
Also supports credit cards... | ||
|
||
ofx = OfxParser::OfxParser.parse(open("creditcard-statement.ofx")) | ||
|
||
ofx.credit_card.remaining_credit # => '19000.0' | ||
ofx.credit_card.remaining_credit_in_pennies # => '1900000' | ||
|
||
ofx.credit_card.statement.start_date # => DateTime | ||
ofx.credit_card.statement.end_date # => DateTime | ||
|
||
ofx.credit_card.statement.transactions.size # => 10 | ||
|
||
ofx.credit_card.statement.transactions.first.type # => :DEBIT | ||
ofx.credit_card.statement.transactions.first.amount # => '-19.17' | ||
ofx.credit_card.statement.transactions.first.amount_in_pennies # => '-1917' | ||
ofx.credit_card.statement.transactions.first.sic # => '7933' | ||
ofx.credit_card.statement.transactions.first.sic_desc # => 'BOWLING CENTERS' | ||
ofx.credit_card.statement.transactions.first.payee # => 'SUNSET BOWLING' | ||
|
||
Working on investment accounts... | ||
|
||
== REQUIREMENTS: | ||
|
||
* hpricot >= 0.6 | ||
|
||
== INSTALL: | ||
|
||
* gem install ofx-parser | ||
|
||
== LICENSE: | ||
|
||
Copyright (c) 2007, Andrew A. Smith | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the copyright owner nor the names of its contributors | ||
may be used to endorse or promote products derived from this software | ||
without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'rubygems' | ||
require 'hoe' | ||
$:.unshift(File.dirname(__FILE__) + "/lib") | ||
require 'ofx-parser' | ||
|
||
Hoe.new('ofx-parser', OfxParser::VERSION) do |p| | ||
p.author = 'Andrew A. Smith' | ||
p.email = 'andy@tinnedfruit.org' | ||
p.rubyforge_name = 'ofx-parser' | ||
p.summary = 'ofx-parser is a ruby library for parsing OFX 1.x data.' | ||
p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n") | ||
p.url = 'http://ofx-parser.rubyforge.org/' | ||
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n") | ||
p.remote_rdoc_dir = '' # Release to root | ||
p.extra_deps << ["hpricot", ">= 0.6"] | ||
p.need_zip = true | ||
p.need_tar = false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Subject: [ANN] ofx-parser 1.0.0 Released | ||
|
||
ofx-parser version 1.0.0 has been released! | ||
|
||
* <http://ofx-parser.rubyforge.org/> | ||
|
||
## DESCRIPTION: | ||
|
||
ofx-parser is a ruby library to parse a realistic subset of the lengthy OFX 1.x specification. | ||
|
||
## FEATURES/PROBLEMS: | ||
|
||
* Reads OFX responses - i.e. those downloaded from financial institutions and | ||
puts it into a usable object graph. | ||
* Supports the 3 main message sets: banking, credit card and investment | ||
accounts, as well as the required 'sign on' set. | ||
* Knows about SIC codes - if your institution provides them. | ||
See http://www.eeoc.gov/stats/jobpat/siccodes.html | ||
* Monetary amounts can be retrieved either as a raw string, or in pennies. | ||
* Supports OFX timestamps. | ||
|
||
Changes: | ||
|
||
## 1.0.0 / 2007-06-24 | ||
|
||
* Initial release. | ||
|
||
* <http://ofx-parser.rubyforge.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# = class_extension.rb | ||
# | ||
# == Copyright (c) 2006 Daniel Schierbeck | ||
# | ||
# Ruby License | ||
# | ||
# This module is free software. You may use, modify, and/or redistribute this | ||
# software under the same terms as Ruby. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
# == Special Thanks | ||
# | ||
# Thanks to Trans, Nobu and Ulysses for their original on this concept. | ||
# | ||
# == Authors and Contributors | ||
# | ||
# * Daniel Schierbeck | ||
# * Thomas Sawyer | ||
# * Nobu Nakada | ||
# * Ulysses | ||
|
||
# Author:: Daniel Schierbeck | ||
# Copyright:: Copyright (c) 2006 Daniel Schierbeck | ||
# License:: Ruby License | ||
|
||
# | ||
|
||
class Module #:nodoc: all | ||
|
||
alias_method :append_features_without_class_extension, :append_features | ||
|
||
# = class_extension | ||
# | ||
# Normally when including modules, class/module methods are not | ||
# extended. To achieve this behavior requires some clever | ||
# Ruby Karate. Instead class_extension provides an easy to use | ||
# and clean solution. Simply place the extending class methods | ||
# in a block of the special module method #class_extension. | ||
# | ||
# module Mix | ||
# def inst_meth | ||
# puts 'inst_meth' | ||
# end | ||
# | ||
# class_extension do | ||
# def class_meth | ||
# "Class Method!" | ||
# end | ||
# end | ||
# end | ||
# | ||
# class X | ||
# include Mix | ||
# end | ||
# | ||
# X.class_meth #=> "Class Method!" | ||
# | ||
|
||
def class_extension(&block) | ||
@class_extension ||= Module.new do | ||
def self.append_features(mod) | ||
append_features_without_class_extension(mod) | ||
end | ||
end | ||
@class_extension.module_eval(&block) if block_given? | ||
@class_extension | ||
end | ||
|
||
private :class_extension | ||
|
||
def append_features(mod) | ||
append_features_without_class_extension(mod) | ||
mod.extend(class_extension) | ||
if mod.instance_of? Module | ||
mod.__send__(:class_extension).__send__(:include, class_extension) | ||
end | ||
end | ||
|
||
end | ||
|
||
class Class #:nodoc: all | ||
undef_method :class_extension | ||
end | ||
|
||
|
||
|
||
# _____ _ | ||
# |_ _|__ ___| |_ | ||
# | |/ _ \/ __| __| | ||
# | | __/\__ \ |_ | ||
# |_|\___||___/\__| | ||
# | ||
|
||
=begin test | ||
require 'test/unit' | ||
class TC_ClassMethods < Test::Unit::TestCase | ||
# fixture | ||
module N | ||
class_extension do | ||
def n ; 43 ; end | ||
def s ; self ; end | ||
end | ||
extend class_extension | ||
end | ||
class X | ||
include N | ||
def n ; 11 ; end | ||
end | ||
module K | ||
include N | ||
class_extension do | ||
def n ; super + 1 ; end | ||
end | ||
end | ||
class Z | ||
include K | ||
end | ||
# tests | ||
def test_01 | ||
assert_equal( 43, N.n ) | ||
assert_equal( N, N.s ) | ||
end | ||
def test_02 | ||
assert_equal( 43, X.n ) | ||
assert_equal( X, X.s ) | ||
end | ||
def test_03 | ||
assert_equal( 11, X.new.n ) | ||
end | ||
def test_04 | ||
assert_equal( 43, K.n ) #notic the difference! | ||
assert_equal( K, K.s ) | ||
end | ||
def test_05 | ||
assert_equal( 44, Z.n ) | ||
assert_equal( Z, Z.s ) | ||
end | ||
end | ||
=end | ||
|
Oops, something went wrong.