ofx_for_ruby 0.1.1

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.
Files changed (74) hide show
  1. data/.externalToolBuilders/Rebuild parsers.launch +10 -0
  2. data/.gitignore +9 -0
  3. data/.loadpath +5 -0
  4. data/.project +27 -0
  5. data/COPYING +674 -0
  6. data/Gemfile +2 -0
  7. data/README +47 -0
  8. data/RELEASE_NOTES +45 -0
  9. data/Rakefile +63 -0
  10. data/lib/ofx.rb +60 -0
  11. data/lib/ofx/1.0.2/banking_message_set.rb +261 -0
  12. data/lib/ofx/1.0.2/credit_card_statement_message_set.rb +269 -0
  13. data/lib/ofx/1.0.2/document.rb +34 -0
  14. data/lib/ofx/1.0.2/email_message_set.rb +34 -0
  15. data/lib/ofx/1.0.2/financial_institution_profile_message_set.rb +155 -0
  16. data/lib/ofx/1.0.2/header.rb +48 -0
  17. data/lib/ofx/1.0.2/interbank_funds_transfer_message_set.rb +30 -0
  18. data/lib/ofx/1.0.2/investment_security_list_message_set.rb +30 -0
  19. data/lib/ofx/1.0.2/investment_statement_message_set.rb +30 -0
  20. data/lib/ofx/1.0.2/lexer.rb +135 -0
  21. data/lib/ofx/1.0.2/message_set.rb +165 -0
  22. data/lib/ofx/1.0.2/ofx_102.racc +90 -0
  23. data/lib/ofx/1.0.2/ofx_102.rex +65 -0
  24. data/lib/ofx/1.0.2/parser.rb +215 -0
  25. data/lib/ofx/1.0.2/payment_message_set.rb +30 -0
  26. data/lib/ofx/1.0.2/serializer.rb +114 -0
  27. data/lib/ofx/1.0.2/signon_message_set.rb +121 -0
  28. data/lib/ofx/1.0.2/signup_message_set.rb +186 -0
  29. data/lib/ofx/1.0.2/statements.rb +54 -0
  30. data/lib/ofx/1.0.2/status.rb +30 -0
  31. data/lib/ofx/1.0.2/wire_funds_transfer_message_set.rb +30 -0
  32. data/lib/ofx/banking_message_set.rb +125 -0
  33. data/lib/ofx/credit_card_statement_message_set.rb +104 -0
  34. data/lib/ofx/document.rb +30 -0
  35. data/lib/ofx/email_message_set.rb +42 -0
  36. data/lib/ofx/file_unique_identifier.rb +28 -0
  37. data/lib/ofx/financial_client.rb +76 -0
  38. data/lib/ofx/financial_institution.rb +83 -0
  39. data/lib/ofx/financial_institution_profile_message_set.rb +67 -0
  40. data/lib/ofx/header.rb +115 -0
  41. data/lib/ofx/http/cacert.pem +3509 -0
  42. data/lib/ofx/http/ofx_http_client.rb +84 -0
  43. data/lib/ofx/interbank_funds_transfer_message_set.rb +33 -0
  44. data/lib/ofx/investment_security_list_message_set.rb +33 -0
  45. data/lib/ofx/investment_statement_message_set.rb +33 -0
  46. data/lib/ofx/message_set.rb +78 -0
  47. data/lib/ofx/payment_message_set.rb +33 -0
  48. data/lib/ofx/serializer.rb +39 -0
  49. data/lib/ofx/signon_message_set.rb +141 -0
  50. data/lib/ofx/signup_message_set.rb +84 -0
  51. data/lib/ofx/statements.rb +49 -0
  52. data/lib/ofx/status.rb +100 -0
  53. data/lib/ofx/transaction_unique_identifier.rb +28 -0
  54. data/lib/ofx/version.rb +82 -0
  55. data/lib/ofx/wire_funds_transfer_message_set.rb +33 -0
  56. data/ofx_for_ruby.gemspec +25 -0
  57. data/planning/OFX Specification completion.ods +0 -0
  58. data/test/capital_one/capital_one_helper.rb +77 -0
  59. data/test/capital_one/fixtures/README +10 -0
  60. data/test/capital_one/fixtures/fipid-5599.xml +98 -0
  61. data/test/capital_one/test_banking_statement.rb +108 -0
  62. data/test/capital_one/test_financial_institution_profile.rb +295 -0
  63. data/test/capital_one/test_ofx_http_client.rb +72 -0
  64. data/test/capital_one/test_signup_account_information.rb +100 -0
  65. data/test/citi/citi_helper.rb +77 -0
  66. data/test/citi/fixtures/README +9 -0
  67. data/test/citi/fixtures/fipid-6642.xml +98 -0
  68. data/test/citi/test_credit_card_statement.rb +159 -0
  69. data/test/citi/test_financial_institution_profile.rb +231 -0
  70. data/test/citi/test_ofx_http_client.rb +71 -0
  71. data/test/citi/test_signup_account_information.rb +85 -0
  72. data/test/test_helper.rb +4 -0
  73. data/test/test_ofx_version.rb +141 -0
  74. metadata +210 -0
@@ -0,0 +1,84 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require 'net/http'
19
+ require 'net/https'
20
+ require 'uri'
21
+
22
+ module OFX
23
+ class HTTPClient
24
+
25
+ @ofx_uri = nil
26
+ def initialize(ofx_uri)
27
+ @ofx_uri = ofx_uri
28
+ end
29
+
30
+ def send(ofx_body)
31
+ http_request = Net::HTTP::Post.new(@ofx_uri.request_uri)
32
+
33
+ http_request['User-Agent'] = 'OFX for Ruby 0.0.1.0'
34
+ http_request['Content-Type'] = 'application/x-ofx'
35
+ http_request['Accept'] = "*/*, application/x-ofx"
36
+ http_request['Content-Length'] = ofx_body.length.to_s
37
+
38
+ http_request.body = ofx_body.gsub("\n", "\r\n")
39
+
40
+ #print_request http_request
41
+
42
+ http = Net::HTTP.new(@ofx_uri.host, @ofx_uri.port)
43
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
44
+ http.ca_file = File.join(File.dirname(__FILE__), "cacert.pem")
45
+ http.use_ssl = true
46
+ http_response = http.start do |http|
47
+ http.request(http_request)
48
+ end
49
+
50
+ #print_response http_response
51
+
52
+ case http_response
53
+ when Net::HTTPSuccess
54
+ http_response.body
55
+ else
56
+ http_response.error!
57
+ end
58
+ end
59
+
60
+ private
61
+ def print_request(http_request)
62
+ puts "Request:"
63
+ puts @ofx_uri.host
64
+ puts @ofx_uri.port
65
+ puts @ofx_uri.path
66
+ puts ""
67
+
68
+ puts "Headers and Body:"
69
+ http_request.each_header { |key, value| puts key + ": " + value + "\n" }
70
+ puts "\n"
71
+ puts http_request.body
72
+ end
73
+
74
+ def print_response(http_response)
75
+ puts "Response:"
76
+ puts http_response.http_version
77
+ puts http_response.code.to_s + " " + http_response.message.to_s
78
+ puts "Headers and Body:"
79
+ http_response.each_header { |key, value| puts key + ": " + value + "\n" }
80
+ puts "\n"
81
+ puts http_response.body
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,33 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module OFX
19
+ class InterbankFundsTransferMessageSet < MessageSet
20
+ def precedence
21
+ 6
22
+ end
23
+ def version
24
+ 1
25
+ end
26
+ end
27
+
28
+ class InterbankFundsTransferMessageSetProfile < MessageSetProfile
29
+ def self.message_set_class
30
+ InterbankFundsTransferMessageSet
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module OFX
19
+ class InvestmentSecurityListMessageSet < MessageSet
20
+ def precedence
21
+ 10
22
+ end
23
+ def version
24
+ 1
25
+ end
26
+ end
27
+
28
+ class InvestmentSecurityListMessageSetProfile < MessageSetProfile
29
+ def self.message_set_class
30
+ InvestmentSecurityListMessageSet
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module OFX
19
+ class InvestmentStatementMessageSet < MessageSet
20
+ def precedence
21
+ 5
22
+ end
23
+ def version
24
+ 1
25
+ end
26
+ end
27
+
28
+ class InvestmentStatementMessageSetProfile < MessageSetProfile
29
+ def self.message_set_class
30
+ InvestmentStatementMessageSet
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,78 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module OFX
19
+
20
+ class MessageSet
21
+ def precedence
22
+ raise NotImplementedError
23
+ end
24
+
25
+ def version
26
+ raise NotImplementedError
27
+ end
28
+
29
+ def requests
30
+ @requests ||= []
31
+ end
32
+
33
+ def responses
34
+ @responses ||= []
35
+ end
36
+ end
37
+
38
+ class MessageSetProfile
39
+ attr_accessor :message_set_class
40
+ attr_accessor :version
41
+ attr_accessor :service_provider_name
42
+ attr_accessor :message_url
43
+ attr_accessor :required_ofx_security
44
+ attr_accessor :requires_transport_security
45
+ def requires_transport_security?
46
+ @requires_transport_security
47
+ end
48
+ attr_accessor :signon_realm
49
+ attr_accessor :language
50
+ attr_accessor :synchronization_mode
51
+ attr_accessor :supports_response_file_error_recovery
52
+ def supports_response_file_error_recovery?
53
+ @supports_response_file_error_recovery
54
+ end
55
+ end
56
+
57
+ class Request
58
+ def satisfies_requirements?
59
+ raise NotImplementedError
60
+ end
61
+ end
62
+
63
+ class TransactionalRequest < Request
64
+ attr_accessor :transaction_identifier
65
+ attr_accessor :client_cookie
66
+ attr_accessor :transaction_authorization_number
67
+ end
68
+
69
+ class Response
70
+ attr_accessor :status
71
+ end
72
+
73
+ class TransactionalResponse < Response
74
+ attr_accessor :transaction_identifier
75
+ attr_accessor :client_cookie
76
+ end
77
+
78
+ end
@@ -0,0 +1,33 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module OFX
19
+ class PaymentMessageSet < MessageSet
20
+ def precedence
21
+ 8
22
+ end
23
+ def version
24
+ 1
25
+ end
26
+ end
27
+
28
+ class PaymentMessageSetProfile < MessageSetProfile
29
+ def self.message_set_class
30
+ PaymentMessageSet
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,39 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require File.dirname(__FILE__) + '/1.0.2/serializer'
19
+
20
+ module OFX
21
+ class Serializer
22
+ def self.get(version)
23
+ case version
24
+ when OFX::Version.new("1.0.2")
25
+ return OFX::OFX102::Serializer.new
26
+ else
27
+ raise NotImplementedError
28
+ end
29
+ end
30
+
31
+ def to_http_post_body(document)
32
+ raise NotImplementedError
33
+ end
34
+
35
+ def from_http_request_body(document)
36
+ raise NotImplementedError
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,141 @@
1
+ # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
+ #
3
+ # This file is part of OFX for Ruby.
4
+ #
5
+ # OFX for Ruby is free software; you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation; either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # OFX for Ruby is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ module OFX
19
+ class SignonMessageSet < MessageSet
20
+ def precedence
21
+ 1
22
+ end
23
+ def version
24
+ 1
25
+ end
26
+ end
27
+
28
+ class SignonMessageSetProfile < MessageSetProfile
29
+ def self.message_set_class
30
+ SignonMessageSet
31
+ end
32
+ end
33
+
34
+ class UserCredentials
35
+ attr_accessor :user_identification
36
+ attr_accessor :password
37
+
38
+ def initialize(user_identification, password)
39
+ @user_identification = user_identification
40
+ @password = password
41
+ end
42
+
43
+ end
44
+ class UserKey
45
+ def user_key
46
+ raise NotImplementedError
47
+ end
48
+
49
+ def expiration_date
50
+ raise NotImplementedError
51
+ end
52
+ end
53
+
54
+ class FinancialInstitutionIdentification
55
+ attr_accessor :organization
56
+ attr_accessor :financial_institution_identifier
57
+
58
+ def initialize(organization, financial_institution_identifier)
59
+ @organization = organization
60
+ @financial_institution_identifier = financial_institution_identifier
61
+ end
62
+ end
63
+
64
+ class ApplicationIdentification
65
+ attr_accessor :application_identification
66
+ attr_accessor :application_version
67
+
68
+ def initialize(application_identification, application_version)
69
+ @application_identification = application_identification
70
+ @application_version = application_version
71
+ end
72
+ end
73
+
74
+ class SignonRequest < Request
75
+ attr_accessor :date
76
+ attr_accessor :user_identification
77
+ attr_accessor :generate_user_key
78
+ attr_accessor :language
79
+ attr_accessor :financial_institution_identification
80
+ attr_accessor :session_cookie
81
+ attr_accessor :application_identification
82
+
83
+ def satisfies_requirements?
84
+ raise NotImplementedError
85
+ end
86
+ end
87
+
88
+ class SignonResponse < Response
89
+ attr_accessor :date
90
+ attr_accessor :user_key
91
+ attr_accessor :language
92
+ attr_accessor :date_of_last_profile_update
93
+ attr_accessor :date_of_last_account_update
94
+ attr_accessor :financial_institution_identification
95
+ attr_accessor :session_cookie
96
+ end
97
+
98
+
99
+
100
+ class PasswordChangeRequest < TransactionalRequest
101
+ def user_identification
102
+ raise NotImplementedError
103
+ end
104
+ end
105
+
106
+ class PasswordChangeResponse < TransactionalResponse
107
+ def user_identification
108
+ raise NotImplementedError
109
+ end
110
+
111
+ def date_changed
112
+ raise NotImplementedError
113
+ end
114
+ end
115
+
116
+
117
+
118
+ class ChallengeRequest < Request
119
+ def user_identification
120
+ raise NotImplementedError
121
+ end
122
+
123
+ def financial_institution_certificate_identifier
124
+ raise NotImplementedError
125
+ end
126
+ end
127
+
128
+ class ChallengeResponse < Response
129
+ def user_identification
130
+ raise NotImplementedError
131
+ end
132
+
133
+ def nonce
134
+ raise NotImplementedError
135
+ end
136
+
137
+ def financial_institution_certificate_identifier
138
+ raise NotImplementedError
139
+ end
140
+ end
141
+ end