ofx_for_ruby 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 430b7f5c78f4a4dc08653128f5ec829d34e89079
4
+ data.tar.gz: 7a6a023f4882b3f1f04a1e5e8f7d0693f316cdf5
5
+ SHA512:
6
+ metadata.gz: cb65456b98851a449e4f2124a461c0c650252565dff75d17cd8e8e0218e2a5f7f35401f437d4d8667f5ba711da233f58487f59b0aa0ace963e0b09722ab527a7
7
+ data.tar.gz: 980c88061fa30811e7a1e0c43cd350d4a964498e95d4b3df8b1d818359076e6e70ccec35b26f10261aa9c0fb55abd4d04e7d26eee268874d8c8db9f29042a317
@@ -0,0 +1 @@
1
+ 2.0.0-p247
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source :rubygems
2
- gemspec
1
+ source "https://rubygems.org"
2
+ gemspec
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ Bundler::GemHelper.install_tasks
21
21
  require 'rake'
22
22
  require 'rake/clean'
23
23
  require 'rake/testtask'
24
- require 'rake/rdoctask'
24
+ require 'rdoc/task'
25
25
 
26
26
 
27
27
  Rake::TestTask.new do |t|
@@ -37,17 +37,8 @@ Rake::RDocTask.new do |rd|
37
37
  rd.rdoc_dir = "documentation/api"
38
38
  end
39
39
 
40
- # RCOV command, run as though from the commandline. Amend as required or perhaps move to config/environment.rb?
41
- RCOV = "bundle exec rcov -Ilib --xref --profile"
42
-
43
- desc "generate a unit coverage report in coverage"
44
- task :"coverage" do
45
- sh "#{RCOV} --output coverage test/test_*.rb test/**/test_*.rb"
46
- end
47
-
48
- desc "runs coverage and rdoc"
49
- task :default => [:coverage, :rdoc]
50
-
40
+ desc "runs tests and rdoc"
41
+ task :default => [:test, :rdoc]
51
42
 
52
43
  desc "recreates parsers"
53
44
  task :parsers do
@@ -56,8 +47,7 @@ task :parsers do
56
47
  end
57
48
 
58
49
  task :test => :parsers
59
- task :coverage => :parsers
60
50
  task :rdoc => :parsers
61
51
  task :build => :parsers
62
52
  task :release => :parsers
63
- task :install => :parsers
53
+ task :install => :parsers
data/lib/ofx.rb CHANGED
@@ -57,4 +57,4 @@ require 'ofx/http/ofx_http_client.rb'
57
57
  # = Specifications
58
58
  # OFX 1.0.2:: http://www.ofx.net/ofx/downloads/ofx102spec.zip
59
59
  module OFX
60
- end
60
+ end
@@ -45,4 +45,4 @@ module OFX
45
45
  header
46
46
  end
47
47
  end
48
- end
48
+ end
@@ -1,6 +1,6 @@
1
1
  #--
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by rex 1.0.2
3
+ # This file is automatically generated by rex 1.0.5
4
4
  # from lexical definition file "ofx_102.rex".
5
5
  #++
6
6
 
@@ -29,89 +29,94 @@ class Parser < Racc::Parser
29
29
 
30
30
  class ScanError < StandardError ; end
31
31
 
32
- attr_reader :lineno
33
- attr_reader :filename
32
+ attr_reader :lineno
33
+ attr_reader :filename
34
+ attr_accessor :state
34
35
 
35
- def scan_setup ; end
36
+ def scan_setup(str)
37
+ @ss = StringScanner.new(str)
38
+ @lineno = 1
39
+ @state = nil
40
+ end
36
41
 
37
- def action &block
42
+ def action
38
43
  yield
39
44
  end
40
45
 
41
- def scan_str( str )
42
- scan_evaluate str
46
+ def scan_str(str)
47
+ scan_setup(str)
43
48
  do_parse
44
49
  end
50
+ alias :scan :scan_str
45
51
 
46
52
  def load_file( filename )
47
53
  @filename = filename
48
54
  open(filename, "r") do |f|
49
- scan_evaluate f.read
55
+ scan_setup(f.read)
50
56
  end
51
57
  end
52
58
 
53
59
  def scan_file( filename )
54
- load_file filename
60
+ load_file(filename)
55
61
  do_parse
56
62
  end
57
63
 
64
+
58
65
  def next_token
59
- @rex_tokens.shift
66
+ return if @ss.eos?
67
+
68
+ # skips empty actions
69
+ until token = _next_token or @ss.eos?; end
70
+ token
60
71
  end
61
72
 
62
- def scan_evaluate( str )
63
- scan_setup
64
- @rex_tokens = []
65
- @lineno = 1
66
- ss = StringScanner.new(str)
67
- state = nil
68
- until ss.eos?
69
- text = ss.peek(1)
70
- @lineno += 1 if text == "\n"
71
- case state
72
- when nil
73
- case
74
- when (text = ss.scan(/\<\//))
75
- @rex_tokens.push action { state = :TAG; [:etag_in, text] }
76
-
77
- when (text = ss.scan(/\</))
78
- @rex_tokens.push action { state = :TAG; [:tag_in, text] }
79
-
80
- when (text = ss.scan(/\s+(?=\S)/))
81
- ;
82
-
83
- when (text = ss.scan(/.*?(?=(\<|\<\/)+?)/))
84
- @rex_tokens.push action { [:text, text] }
85
-
86
- when (text = ss.scan(/.*\S(?=\s*$)/))
87
- @rex_tokens.push action { [:text, text] }
88
-
89
- when (text = ss.scan(/\s+(?=$)/))
90
- ;
91
-
92
- else
93
- text = ss.string[ss.pos .. -1]
94
- raise ScanError, "can not match: '" + text + "'"
95
- end # if
96
-
97
- when :TAG
98
- case
99
- when (text = ss.scan(/\>/))
100
- @rex_tokens.push action { state = nil; [:tag_out, text] }
101
-
102
- when (text = ss.scan(/[\w\-\.]+/))
103
- @rex_tokens.push action { [:element, text] }
104
-
105
- else
106
- text = ss.string[ss.pos .. -1]
107
- raise ScanError, "can not match: '" + text + "'"
108
- end # if
73
+ def _next_token
74
+ text = @ss.peek(1)
75
+ @lineno += 1 if text == "\n"
76
+ token = case @state
77
+ when nil
78
+ case
79
+ when (text = @ss.scan(/\<\//))
80
+ action { @state = :TAG; [:etag_in, text] }
81
+
82
+ when (text = @ss.scan(/\</))
83
+ action { @state = :TAG; [:tag_in, text] }
84
+
85
+ when (text = @ss.scan(/\s+(?=\S)/))
86
+ ;
87
+
88
+ when (text = @ss.scan(/.*?(?=(\<|\<\/)+?)/))
89
+ action { [:text, text] }
90
+
91
+ when (text = @ss.scan(/.*\S(?=\s*$)/))
92
+ action { [:text, text] }
93
+
94
+ when (text = @ss.scan(/\s+(?=$)/))
95
+ ;
96
+
97
+ else
98
+ text = @ss.string[@ss.pos .. -1]
99
+ raise ScanError, "can not match: '" + text + "'"
100
+ end # if
101
+
102
+ when :TAG
103
+ case
104
+ when (text = @ss.scan(/\>/))
105
+ action { @state = nil; [:tag_out, text] }
106
+
107
+ when (text = @ss.scan(/[\w\-\.]+/))
108
+ action { [:element, text] }
109
109
 
110
110
  else
111
- raise ScanError, "undefined state: '" + state.to_s + "'"
112
- end # case state
113
- end # until ss
114
- end # def scan_evaluate
111
+ text = @ss.string[@ss.pos .. -1]
112
+ raise ScanError, "can not match: '" + text + "'"
113
+ end # if
114
+
115
+ else
116
+ raise ScanError, "undefined state: '" + state.to_s + "'"
117
+ end # case state
118
+ token
119
+ end # def _next_token
115
120
 
116
121
  end # class
117
122
 
@@ -28,10 +28,10 @@ macro
28
28
  rule
29
29
 
30
30
  # [:state] pattern [actions]
31
- {ETAG_IN} { state = :TAG; [:etag_in, text] }
32
- {TAG_IN} { state = :TAG; [:tag_in, text] }
31
+ {ETAG_IN} { @state = :TAG; [:etag_in, text] }
32
+ {TAG_IN} { @state = :TAG; [:tag_in, text] }
33
33
 
34
- :TAG {TAG_OUT} { state = nil; [:tag_out, text] }
34
+ :TAG {TAG_OUT} { @state = nil; [:tag_out, text] }
35
35
 
36
36
  :TAG [\w\-\.]+ { [:element, text] }
37
37
 
@@ -62,36 +62,36 @@ end
62
62
  ##### State transition tables begin ###
63
63
 
64
64
  racc_action_table = [
65
- 1, 6, 1, 14, 15, 14, 15, 8, 9, 5,
66
- 17, 19, 20, 1 ]
65
+ 4, 16, 4, 10, 12, 10, 12, 8, 5, 7,
66
+ 17, 19, 20, 4 ]
67
67
 
68
68
  racc_action_check = [
69
- 18, 2, 7, 18, 18, 7, 7, 5, 6, 1,
70
- 14, 16, 17, 0 ]
69
+ 18, 7, 6, 18, 18, 6, 6, 5, 1, 4,
70
+ 10, 15, 17, 0 ]
71
71
 
72
72
  racc_action_pointer = [
73
- 11, 6, 1, nil, nil, 3, 8, 0, nil, nil,
74
- nil, nil, nil, nil, 7, nil, 5, 8, -2, nil,
73
+ 11, 8, nil, nil, 6, 7, 0, -3, nil, nil,
74
+ 7, nil, nil, nil, nil, 5, nil, 8, -2, nil,
75
75
  nil, nil ]
76
76
 
77
77
  racc_action_default = [
78
- -1, -13, -13, -2, -6, -13, -13, -13, -4, 22,
79
- -3, -7, -9, -10, -13, -8, -6, -13, -13, -12,
78
+ -1, -13, -2, -6, -13, -13, -13, -13, 22, -3,
79
+ -13, -7, -8, -9, -10, -6, -4, -13, -13, -12,
80
80
  -5, -11 ]
81
81
 
82
82
  racc_goto_table = [
83
- 7, 4, 10, 3, 2, nil, nil, nil, nil, nil,
84
- nil, nil, 18, 21 ]
83
+ 9, 6, 3, 2, 1, nil, nil, nil, nil, nil,
84
+ nil, nil, 21, 18 ]
85
85
 
86
86
  racc_goto_check = [
87
- 4, 3, 5, 2, 1, nil, nil, nil, nil, nil,
88
- nil, nil, 4, 5 ]
87
+ 5, 4, 3, 2, 1, nil, nil, nil, nil, nil,
88
+ nil, nil, 5, 4 ]
89
89
 
90
90
  racc_goto_pointer = [
91
- nil, 4, 3, 1, -4, -5, nil, nil, nil ]
91
+ nil, 4, 3, 2, -2, -6, nil, nil, nil ]
92
92
 
93
93
  racc_goto_default = [
94
- nil, nil, nil, 16, nil, nil, 11, 12, 13 ]
94
+ nil, nil, nil, 15, nil, nil, 11, 13, 14 ]
95
95
 
96
96
  racc_reduce_table = [
97
97
  0, 0, :racc_error,
@@ -49,12 +49,14 @@ module OFX
49
49
  end
50
50
  body += "</OFX>\n"
51
51
 
52
- #print body
52
+ # puts body
53
53
 
54
54
  body
55
55
  end
56
56
 
57
57
  def from_http_response_body(body)
58
+ # puts "Raw response:\n#{body}"
59
+
58
60
  header_pattern = /(\w+\:.*\n)+/
59
61
  header_match = header_pattern.match(body)
60
62
 
@@ -62,15 +64,15 @@ module OFX
62
64
  header = Header.from_ofx_102_s(header_match[0].strip)
63
65
 
64
66
  parser = OFX::OFX102::Parser.new
67
+
65
68
  parser.scan_str body
66
69
 
67
70
  if parser.documents.length > 1
68
71
  raise NotImplementedError, "Multiple response documents"
69
72
  end
70
73
 
71
- #require 'pp'
72
- #print body
73
- #pp parser.ofx_hashes[0]
74
+ # require 'pp'
75
+ # pp parser.ofx_hashes[0]
74
76
 
75
77
  document = parser.documents[0]
76
78
  document.header = header
@@ -56,7 +56,8 @@ module OFX
56
56
  " <LANGUAGE>#{language}\n" +
57
57
  financial_institution_identification.to_ofx_102_s + "\n" +
58
58
  (" <SESSCOOKIE>#{session_cookie}\n" if session_cookie).to_s +
59
- application_identification.to_ofx_102_s
59
+ application_identification.to_ofx_102_s + "\n" +
60
+ (" <CLIENTUID>#{client_unique_identifier}" if client_unique_identifier).to_s
60
61
  end
61
62
  def self.from_ofx_102_hash(request_hash)
62
63
  raise NotImplementedError
@@ -118,4 +119,4 @@ module OFX
118
119
  response
119
120
  end
120
121
  end
121
- end
122
+ end
@@ -23,6 +23,7 @@ module OFX
23
23
  @financial_institutions_and_credentials = []
24
24
 
25
25
  attr_accessor :date_of_last_profile_update
26
+ attr_accessor :client_unique_identifier
26
27
 
27
28
  def initialize(financial_institutions_and_credentials)
28
29
  @financial_institutions_and_credentials = financial_institutions_and_credentials
@@ -56,6 +57,7 @@ module OFX
56
57
  signonRequest.financial_institution_identification = self.financial_institution_identification_for(financial_institution_id)
57
58
  signonRequest.session_cookie = nil
58
59
  signonRequest.application_identification = self.application_identification
60
+ signonRequest.client_unique_identifier = self.client_unique_identifier
59
61
  signonMessageSet.requests << signonRequest
60
62
 
61
63
  signonMessageSet
@@ -73,4 +75,4 @@ module OFX
73
75
  profileMessageSet
74
76
  end
75
77
  end
76
- end
78
+ end
@@ -53,6 +53,10 @@ module OFX
53
53
  document.header.header_version = OFX::Version.new("1.0.0")
54
54
  document.header.content_type = "OFXSGML"
55
55
  document.header.document_version = OFX::Version.new("1.0.2")
56
+ when OFX::Version.new("1.0.3")
57
+ document.header.header_version = OFX::Version.new("1.0.0")
58
+ document.header.content_type = "OFXSGML"
59
+ document.header.document_version = OFX::Version.new("1.0.3")
56
60
  else
57
61
  raise NotImplementedError
58
62
  end
@@ -80,4 +84,4 @@ module OFX
80
84
  return serializer.from_http_response_body(response_body)
81
85
  end
82
86
  end
83
- end
87
+ end
@@ -112,4 +112,4 @@ module OFX
112
112
  @headers['OLDFILEUID'] = value
113
113
  end
114
114
  end
115
- end
115
+ end
@@ -21,7 +21,7 @@ module OFX
21
21
  class Serializer
22
22
  def self.get(version)
23
23
  case version
24
- when OFX::Version.new("1.0.2")
24
+ when OFX::Version.new("1.0.2"), OFX::Version.new("1.0.3")
25
25
  return OFX::OFX102::Serializer.new
26
26
  else
27
27
  raise NotImplementedError
@@ -36,4 +36,4 @@ module OFX
36
36
  raise NotImplementedError
37
37
  end
38
38
  end
39
- end
39
+ end
@@ -79,6 +79,7 @@ module OFX
79
79
  attr_accessor :financial_institution_identification
80
80
  attr_accessor :session_cookie
81
81
  attr_accessor :application_identification
82
+ attr_accessor :client_unique_identifier
82
83
 
83
84
  def satisfies_requirements?
84
85
  raise NotImplementedError
@@ -138,4 +139,4 @@ module OFX
138
139
  raise NotImplementedError
139
140
  end
140
141
  end
141
- end
142
+ end
@@ -1,17 +1,17 @@
1
1
  # Copyright © 2007 Chris Guidry <chrisguidry@gmail.com>
2
2
  #
3
3
  # This file is part of OFX for Ruby.
4
- #
4
+ #
5
5
  # OFX for Ruby is free software; you can redistribute it and/or modify
6
6
  # it under the terms of the GNU General Public License as published by
7
7
  # the Free Software Foundation; either version 3 of the License, or
8
8
  # (at your option) any later version.
9
- #
9
+ #
10
10
  # OFX for Ruby is distributed in the hope that it will be useful,
11
11
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
13
  # GNU General Public License for more details.
14
- #
14
+ #
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
 
@@ -21,9 +21,9 @@ module OFX
21
21
 
22
22
  def initialize(version)
23
23
  @version = [0, 0, 0]
24
-
24
+
25
25
  return if version.nil?
26
-
26
+
27
27
  parts = case version
28
28
  when Version
29
29
  version.to_a
@@ -74,13 +74,13 @@ module OFX
74
74
  end
75
75
  def eql?(other)
76
76
  other_a = other.to_a
77
-
77
+
78
78
  return @version[0] == other_a[0] && @version[1] == other_a[1] && @version[2] == other_a[2]
79
79
  end
80
80
  def hash()
81
81
  return @version.hash
82
82
  end
83
83
  end
84
-
85
- VERSION = Version.new('0.1.2')
86
- end
84
+
85
+ VERSION = Version.new('0.1.3')
86
+ end
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
7
7
  s.version = OFX::VERSION.to_dotted_s
8
8
  s.platform = Gem::Platform::RUBY
9
9
 
10
- s.authors = ["Chris Guidry"]
10
+ s.authors = ["Chris Guidry", "Patrick Bacon"]
11
11
  s.description = "OFX for Ruby is a pure Ruby implementation of Open Financial Exchange specifications (1.0.2 through 2.1.1) for building both financial clients and servers, providing parsers/serializers for each version, and a uniform object model across all versions."
12
- s.email = ["chrisguidry@gmail.com"]
12
+ s.email = ["bacon@atomicobject.com"]
13
13
  s.summary = "Pure Ruby implementation of Open Financial Exchange specifications"
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency "activesupport"
21
21
 
22
22
  s.add_development_dependency "racc"
23
- s.add_development_dependency "rex"
24
- s.add_development_dependency "rcov"
23
+ s.add_development_dependency "rexical"
24
+ s.add_development_dependency "pry"
25
25
  end
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.dirname(__FILE__) + '/capital_one_helper'
19
19
 
20
- class CapitalOneBankingStatmentTest < Test::Unit::TestCase
20
+ class CapitalOneBankingStatmentTest < Minitest::Test
21
21
 
22
22
  include CapitalOneHelper
23
23
 
@@ -27,6 +27,7 @@ class CapitalOneBankingStatmentTest < Test::Unit::TestCase
27
27
  end
28
28
 
29
29
  def test_requesting_last_seven_days_statement_from_capital_one
30
+ skip 'Need Capital One Account'
30
31
  financial_institution = OFX::FinancialInstitution.get_institution('Capital One')
31
32
  requestDocument = financial_institution.create_request_document
32
33
 
@@ -105,4 +106,4 @@ class CapitalOneBankingStatmentTest < Test::Unit::TestCase
105
106
 
106
107
  assert_equal 366.15.to_d, total_of_transactions
107
108
  end
108
- end
109
+ end
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.dirname(__FILE__) + '/capital_one_helper'
19
19
 
20
- class CapitalOneFinancialInstitutionProfileTest < Test::Unit::TestCase
20
+ class CapitalOneFinancialInstitutionProfileTest < Minitest::Test
21
21
 
22
22
  include CapitalOneHelper
23
23
 
@@ -26,6 +26,7 @@ class CapitalOneFinancialInstitutionProfileTest < Test::Unit::TestCase
26
26
  end
27
27
 
28
28
  def test_requesting_fresh_fi_profile_from_capital_one
29
+ skip 'Need Capital One Account'
29
30
  financial_institution = OFX::FinancialInstitution.get_institution('Capital One')
30
31
  requestDocument = financial_institution.create_request_document
31
32
 
@@ -240,6 +241,7 @@ class CapitalOneFinancialInstitutionProfileTest < Test::Unit::TestCase
240
241
  end
241
242
 
242
243
  def test_requesting_up_to_date_fi_profile_from_capital_one
244
+ skip 'Need Capital One Account'
243
245
  financial_institution = OFX::FinancialInstitution.get_institution('Capital One')
244
246
  requestDocument = financial_institution.create_request_document
245
247
 
@@ -292,4 +294,4 @@ class CapitalOneFinancialInstitutionProfileTest < Test::Unit::TestCase
292
294
  assert_not_equal nil, profile_response.signon_realms
293
295
  assert_equal 0, profile_response.signon_realms.length
294
296
  end
295
- end
297
+ end
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.dirname(__FILE__) + '/capital_one_helper'
19
19
 
20
- class CapitalOneOFXHTTPClientTest < Test::Unit::TestCase
20
+ class CapitalOneOFXHTTPClientTest < Minitest::Test
21
21
 
22
22
  include CapitalOneHelper
23
23
 
@@ -26,6 +26,7 @@ class CapitalOneOFXHTTPClientTest < Test::Unit::TestCase
26
26
  end
27
27
 
28
28
  def test_account_info_request_to_capital_one
29
+ skip 'Need Capital One Account'
29
30
  account_info_request =
30
31
  "OFXHEADER:100
31
32
  DATA:OFXSGML
@@ -69,4 +70,4 @@ NEWFILEUID:20070518034113.000
69
70
  assert account_info_response[0..12] == 'OFXHEADER:100'
70
71
  end
71
72
 
72
- end
73
+ end
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.dirname(__FILE__) + '/capital_one_helper'
19
19
 
20
- class CapitalOneSignupAccountInformationTest < Test::Unit::TestCase
20
+ class CapitalOneSignupAccountInformationTest < Minitest::Test
21
21
 
22
22
  include CapitalOneHelper
23
23
 
@@ -27,6 +27,7 @@ class CapitalOneSignupAccountInformationTest < Test::Unit::TestCase
27
27
  end
28
28
 
29
29
  def test_requesting_fresh_fi_profile_from_capital_one
30
+ skip 'Need Capital One Account'
30
31
  financial_institution = OFX::FinancialInstitution.get_institution('Capital One')
31
32
  requestDocument = financial_institution.create_request_document
32
33
 
@@ -97,4 +98,4 @@ class CapitalOneSignupAccountInformationTest < Test::Unit::TestCase
97
98
  assert_equal true, savings.account_information.transfer_destination
98
99
  assert_equal :active, savings.account_information.status
99
100
  end
100
- end
101
+ end
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.dirname(__FILE__) + '/citi_helper'
19
19
 
20
- class CitiCreditCardStatmentTest < Test::Unit::TestCase
20
+ class CitiCreditCardStatmentTest < Minitest::Test
21
21
 
22
22
  include CitiHelper
23
23
 
@@ -27,6 +27,7 @@ class CitiCreditCardStatmentTest < Test::Unit::TestCase
27
27
  end
28
28
 
29
29
  def test_requesting_last_seven_days_statement_from_citi
30
+ skip 'Need Citi Account'
30
31
  financial_institution = OFX::FinancialInstitution.get_institution('Citi')
31
32
  requestDocument = financial_institution.create_request_document
32
33
 
@@ -93,6 +94,7 @@ class CitiCreditCardStatmentTest < Test::Unit::TestCase
93
94
  end
94
95
 
95
96
  def test_requesting_closing_statement_from_citi
97
+ skip 'Need Citi Account'
96
98
  financial_institution = OFX::FinancialInstitution.get_institution('Citi')
97
99
  requestDocument = financial_institution.create_request_document
98
100
 
@@ -156,4 +158,4 @@ class CitiCreditCardStatmentTest < Test::Unit::TestCase
156
158
  assert_equal nil, closing.marketing_information
157
159
  end
158
160
  end
159
- end
161
+ end
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.dirname(__FILE__) + '/citi_helper'
19
19
 
20
- class CitiFinancialInstitutionProfileTest < Test::Unit::TestCase
20
+ class CitiFinancialInstitutionProfileTest < Minitest::Test
21
21
 
22
22
  include CitiHelper
23
23
 
@@ -26,6 +26,7 @@ class CitiFinancialInstitutionProfileTest < Test::Unit::TestCase
26
26
  end
27
27
 
28
28
  def test_requesting_fresh_fi_profile_from_citi
29
+ skip 'Need Citi Account'
29
30
  financial_institution = OFX::FinancialInstitution.get_institution('Citi')
30
31
  requestDocument = financial_institution.create_request_document
31
32
 
@@ -228,4 +229,4 @@ class CitiFinancialInstitutionProfileTest < Test::Unit::TestCase
228
229
  # assert_not_equal nil, profile_response.signon_realms
229
230
  # assert_equal 0, profile_response.signon_realms.length
230
231
  # end
231
- end
232
+ end
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.dirname(__FILE__) + '/citi_helper'
19
19
 
20
- class CitiOFXHTTPClientTest < Test::Unit::TestCase
20
+ class CitiOFXHTTPClientTest < Minitest::Test
21
21
 
22
22
  include CitiHelper
23
23
 
@@ -26,6 +26,7 @@ class CitiOFXHTTPClientTest < Test::Unit::TestCase
26
26
  end
27
27
 
28
28
  def test_account_info_request_to_citi
29
+ skip 'Need Citi Account'
29
30
  account_info_request =
30
31
  "OFXHEADER:100
31
32
  DATA:OFXSGML
@@ -68,4 +69,4 @@ NEWFILEUID:20070624162951.735621
68
69
  assert account_info_response != nil
69
70
  assert account_info_response[0..12] == 'OFXHEADER:100'
70
71
  end
71
- end
72
+ end
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.dirname(__FILE__) + '/citi_helper'
19
19
 
20
- class CitiSignupAccountInformationTest < Test::Unit::TestCase
20
+ class CitiSignupAccountInformationTest < Minitest::Test
21
21
 
22
22
  include CitiHelper
23
23
 
@@ -27,6 +27,7 @@ class CitiSignupAccountInformationTest < Test::Unit::TestCase
27
27
  end
28
28
 
29
29
  def test_requesting_fresh_fi_profile_from_capital_one
30
+ skip 'Need Citi Account'
30
31
  financial_institution = OFX::FinancialInstitution.get_institution('Citi')
31
32
  requestDocument = financial_institution.create_request_document
32
33
 
@@ -82,4 +83,4 @@ class CitiSignupAccountInformationTest < Test::Unit::TestCase
82
83
  assert_equal false, credit_card.account_information.transfer_destination
83
84
  assert_equal :active, credit_card.account_information.status
84
85
  end
85
- end
86
+ end
@@ -1,4 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
- require 'test/unit'
4
- require 'ofx'
3
+ # require 'test/unit'
4
+ require 'minitest/autorun'
5
+ require 'minitest/test'
6
+ require 'pry'
7
+ require 'ofx'
@@ -17,7 +17,7 @@
17
17
 
18
18
  require File.expand_path(File.dirname(__FILE__) + '/test_helper')
19
19
 
20
- class OFXVersionTest < Test::Unit::TestCase
20
+ class OFXVersionTest < Minitest::Test
21
21
 
22
22
  def test_creating_from_array
23
23
  version = OFX::Version.new([1, 2, 3])
@@ -138,4 +138,4 @@ class OFXVersionTest < Test::Unit::TestCase
138
138
  assert_equal 2, hash[OFX::Version.new('2')]
139
139
  assert_equal nil, hash[OFX::Version.new('3')]
140
140
  end
141
- end
141
+ end
@@ -0,0 +1,37 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
+
3
+ class OFXParserTest < Minitest::Test
4
+
5
+ def test_creating_from_array
6
+ body = <<-EOS
7
+ <OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>0<SEVERITY>INFO<MESSAGE>SUCCESS</STATUS><DTSERVER>20151223151556.657[-5:EST]<LANGUAGE>ENG<FI><ORG>AB<FID>12345</FI></SONRS></SIGNONMSGSRSV1><BANKMSGSRSV1><STMTTRNRS><TRNUID>20151223151555<STATUS><CODE>0<SEVERITY>INFO</STATUS><CLTCOOKIE>1<STMTRS><CURDEF>USD<BANKACCTFROM><BANKID>071234513<ACCTID>9876543123547<ACCTTYPE>CHECKING</BANKACCTFROM><BANKTRANLIST><DTSTART>20131223151557.601[-5:EST]<DTEND>20151222190000.000[-5:EST]<STMTTRN><TRNTYPE>CHECK<DTPOSTED>20151221120000[0:GMT]<TRNAMT>370.99<FITID>211111110<CHECKNUM>1<NAME>REMOTE ONLINE DEPOSIT #<MEMO>1</STMTTRN></BANKTRANLIST><LEDGERBAL><BALAMT>1000.35<DTASOF>20151222190000.000[-5:EST]</LEDGERBAL><AVAILBAL><BALAMT>1200.09<DTASOF>20151221190000.000[-5:EST]</AVAILBAL></STMTRS></STMTTRNRS></BANKMSGSRSV1></OFX>
8
+ EOS
9
+ parser = OFX::OFX102::Parser.new
10
+
11
+ parser.scan_str body
12
+
13
+ # require 'pp'
14
+ # pp parser.ofx_hashes[0]
15
+
16
+ document = parser.documents[0]
17
+
18
+ signon_message_set = document.message_sets[0]
19
+ signon_response = signon_message_set.responses[0]
20
+
21
+ banking_statement_message_set = document.message_sets[1]
22
+ banking_statement_response = banking_statement_message_set.responses[0]
23
+
24
+ assert_equal '9876543123547', banking_statement_response.account.account_identifier
25
+ assert_equal '071234513', banking_statement_response.account.bank_identifier
26
+ assert_equal '1200.09', banking_statement_response.available_balance.amount
27
+ assert_equal '1000.35', banking_statement_response.ledger_balance.amount
28
+
29
+ transactions = banking_statement_response.transactions
30
+ assert_equal 1, transactions.size
31
+
32
+ transaction = transactions.first
33
+ assert_equal '370.99', transaction.amount.to_f.to_s
34
+ assert_equal 'REMOTE ONLINE DEPOSIT #', transaction.payee
35
+ assert_equal :check, transaction.transaction_type
36
+ end
37
+ end
metadata CHANGED
@@ -1,93 +1,87 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ofx_for_ruby
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Chris Guidry
8
+ - Patrick Bacon
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-01-16 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
- version: "0"
31
- type: :runtime
12
+ date: 2015-12-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
32
15
  name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
33
22
  prerelease: false
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 3
42
- segments:
43
- - 0
44
- version: "0"
45
- type: :development
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
46
29
  name: racc
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
47
36
  prerelease: false
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- requirement: &id003 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
- version: "0"
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rexical
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
59
49
  type: :development
60
- name: rex
61
50
  prerelease: false
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- requirement: &id004 !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- hash: 3
70
- segments:
71
- - 0
72
- version: "0"
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: pry
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
73
63
  type: :development
74
- name: rcov
75
64
  prerelease: false
76
- version_requirements: *id004
77
- description: OFX for Ruby is a pure Ruby implementation of Open Financial Exchange specifications (1.0.2 through 2.1.1) for building both financial clients and servers, providing parsers/serializers for each version, and a uniform object model across all versions.
78
- email:
79
- - chrisguidry@gmail.com
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ description: OFX for Ruby is a pure Ruby implementation of Open Financial Exchange
71
+ specifications (1.0.2 through 2.1.1) for building both financial clients and servers,
72
+ providing parsers/serializers for each version, and a uniform object model across
73
+ all versions.
74
+ email:
75
+ - bacon@atomicobject.com
80
76
  executables: []
81
-
82
77
  extensions: []
83
-
84
78
  extra_rdoc_files: []
85
-
86
- files:
79
+ files:
87
80
  - .externalToolBuilders/Rebuild parsers.launch
88
81
  - .gitignore
89
82
  - .loadpath
90
83
  - .project
84
+ - .ruby-version
91
85
  - COPYING
92
86
  - Gemfile
93
87
  - README
@@ -157,41 +151,31 @@ files:
157
151
  - test/citi/test_signup_account_information.rb
158
152
  - test/test_helper.rb
159
153
  - test/test_ofx_version.rb
160
- has_rdoc: true
154
+ - test/test_parser.rb
161
155
  homepage: http://github.com/baconpat/ofx_for_ruby
162
156
  licenses: []
163
-
157
+ metadata: {}
164
158
  post_install_message:
165
159
  rdoc_options: []
166
-
167
- require_paths:
160
+ require_paths:
168
161
  - lib
169
- required_ruby_version: !ruby/object:Gem::Requirement
170
- none: false
171
- requirements:
172
- - - ">="
173
- - !ruby/object:Gem::Version
174
- hash: 3
175
- segments:
176
- - 0
177
- version: "0"
178
- required_rubygems_version: !ruby/object:Gem::Requirement
179
- none: false
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- hash: 3
184
- segments:
185
- - 0
186
- version: "0"
162
+ required_ruby_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - '>='
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
187
172
  requirements: []
188
-
189
173
  rubyforge_project:
190
- rubygems_version: 1.3.7
174
+ rubygems_version: 2.0.3
191
175
  signing_key:
192
- specification_version: 3
176
+ specification_version: 4
193
177
  summary: Pure Ruby implementation of Open Financial Exchange specifications
194
- test_files:
178
+ test_files:
195
179
  - test/capital_one/capital_one_helper.rb
196
180
  - test/capital_one/fixtures/README
197
181
  - test/capital_one/fixtures/fipid-5599.xml
@@ -208,3 +192,4 @@ test_files:
208
192
  - test/citi/test_signup_account_information.rb
209
193
  - test/test_helper.rb
210
194
  - test/test_ofx_version.rb
195
+ - test/test_parser.rb