coop_to_ofx 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -75,14 +75,14 @@ describe OFX::Statement::Output::Base do
75
75
  describe "OFX wrapper" do
76
76
  it "should be able to generate the correct OFX root element" do
77
77
  @base.ofx_block(@builder)
78
- output = Hpricot(@builder.target!)
78
+ output = Nokogiri::XML(@builder.target!)
79
79
 
80
80
  output.at('/OFX').should_not be_nil
81
81
  end
82
82
 
83
83
  it "should yield a child node builder so that document generation can continue" do
84
84
  @base.ofx_block(@builder) { |node| node.fnord }
85
- output = Hpricot(@builder.target!)
85
+ output = Nokogiri::XML(@builder.target!)
86
86
 
87
87
  output.at('/OFX/fnord').should_not be_nil
88
88
  end
@@ -97,7 +97,7 @@ describe OFX::Statement::Output::Base do
97
97
  it "should be able to generate a sensible Signon Message Set, with Signon response block" do
98
98
 
99
99
  @base.signon_block(@builder, @statement)
100
- output = Hpricot(@builder.target!)
100
+ output = Nokogiri::XML(@builder.target!)
101
101
 
102
102
  output.at('/SIGNONMSGSRSV1/SONRS').should_not be_nil
103
103
  output.at('/SIGNONMSGSRSV1/SONRS/STATUS/CODE').inner_text.should == '0'
@@ -108,7 +108,7 @@ describe OFX::Statement::Output::Base do
108
108
 
109
109
  it "should yield a child node builder so that document generation can continue" do
110
110
  @base.signon_block(@builder, @statement) { |node| node.fnord }
111
- output = Hpricot(@builder.target!)
111
+ output = Nokogiri::XML(@builder.target!)
112
112
 
113
113
  output.at('/SIGNONMSGSRSV1/fnord').should_not be_nil
114
114
  end
@@ -118,7 +118,7 @@ describe OFX::Statement::Output::Base do
118
118
  it "should produce the right bits for a ledger balance block" do
119
119
  statement = stub('Statement', :ledger_balance => '350.00', :date => Time.utc('2009', '2', '3'))
120
120
  @base.ledger_balance_block(@builder, statement)
121
- output = Hpricot(@builder.target!)
121
+ output = Nokogiri::XML(@builder.target!)
122
122
 
123
123
  output.at('/LEDGERBAL/BALAMT').inner_text.should == "350.00"
124
124
  output.at('/LEDGERBAL/DTASOF').inner_text.should == "20090203"
@@ -135,7 +135,7 @@ describe OFX::Statement::Output::Base do
135
135
 
136
136
  it "should generate a block with the right values" do
137
137
  @base.transaction_list(@builder, @statement)
138
- output = Hpricot(@builder.target!)
138
+ output = Nokogiri::XML(@builder.target!)
139
139
 
140
140
  output.at('/BANKTRANLIST/DTSTART').inner_text.should == "20090108"
141
141
  output.at('/BANKTRANLIST/DTEND').inner_text.should == "20090109"
@@ -143,7 +143,7 @@ describe OFX::Statement::Output::Base do
143
143
 
144
144
  it "should should yield for child node generation in the right place" do
145
145
  @base.transaction_list(@builder, @statement) { |child| child.fnord }
146
- output = Hpricot(@builder.target!)
146
+ output = Nokogiri::XML(@builder.target!)
147
147
 
148
148
  output.at('/BANKTRANLIST/fnord').should_not be_nil
149
149
  end
@@ -159,7 +159,7 @@ describe OFX::Statement::Output::Base do
159
159
  transaction = OFX::Statement::Transaction.new("-350.00", @t, "A nice thing wot I bought")
160
160
  transaction.stubs(:fitid).returns("PROPER:FIT:ID")
161
161
  @base.transaction_block(@builder, transaction)
162
- output = Hpricot(@builder.target!)
162
+ output = Nokogiri::XML(@builder.target!)
163
163
 
164
164
  output.at('/STMTTRN/TRNTYPE').inner_text.should == "DEBIT"
165
165
  output.at('/STMTTRN/DTPOSTED').inner_text.should == "20090108"
@@ -172,7 +172,7 @@ describe OFX::Statement::Output::Base do
172
172
  transaction = OFX::Statement::Transaction.new("350.00", @t, "A nice sum wot I was given")
173
173
  transaction.stubs(:fitid).returns("PROPER:FIT:ID")
174
174
  @base.transaction_block(@builder, transaction)
175
- output = Hpricot(@builder.target!)
175
+ output = Nokogiri::XML(@builder.target!)
176
176
 
177
177
  output.at('/STMTTRN/TRNTYPE').inner_text.should == "CREDIT"
178
178
  output.at('/STMTTRN/DTPOSTED').inner_text.should == "20090108"
@@ -185,7 +185,7 @@ describe OFX::Statement::Output::Base do
185
185
  transaction = OFX::Statement::Transaction.new("-350.00", @t, "A nice thing wot I bought", {:memo => "plenty USD wonga"})
186
186
  transaction.stubs(:fitid).returns("PROPER:FIT:ID")
187
187
  @base.transaction_block(@builder, transaction)
188
- output = Hpricot(@builder.target!)
188
+ output = Nokogiri::XML(@builder.target!)
189
189
 
190
190
  output.at('/STMTTRN/TRNTYPE').inner_text.should == "DEBIT"
191
191
  output.at('/STMTTRN/DTPOSTED').inner_text.should == "20090108"
@@ -14,14 +14,14 @@ describe OFX::Statement::Output::CreditCard do
14
14
  describe "credit card message set wrapper" do
15
15
  it "should be able to generate the correct OFX root element" do
16
16
  @output.message_set_block(@builder)
17
- output = Hpricot(@builder.target!)
17
+ output = Nokogiri::XML(@builder.target!)
18
18
 
19
19
  output.at('/CREDITCARDMSGSETV1').should_not be_nil
20
20
  end
21
21
 
22
22
  it "should yield a child node builder so that document generation can continue" do
23
23
  @output.message_set_block(@builder) { |node| node.fnord }
24
- output = Hpricot(@builder.target!)
24
+ output = Nokogiri::XML(@builder.target!)
25
25
 
26
26
  output.at('/CREDITCARDMSGSETV1/fnord').should_not be_nil
27
27
  end
@@ -38,7 +38,7 @@ describe OFX::Statement::Output::CreditCard do
38
38
 
39
39
  it "should be able to generate the correct Statement block" do
40
40
  @output.statement_block(@builder, @statement)
41
- output = Hpricot(@builder.target!)
41
+ output = Nokogiri::XML(@builder.target!)
42
42
 
43
43
  output.at('/CCSTMTTRNRS/CCSTMTRS/CURDEF').should_not be_nil
44
44
  output.at('/CCSTMTTRNRS/CCSTMTRS/CURDEF').inner_text.should == "GBP"
@@ -57,7 +57,7 @@ describe OFX::Statement::Output::CreditCard do
57
57
 
58
58
  it "should yield a child node builder so that document generation can continue" do
59
59
  @output.statement_block(@builder, @statement) { |node| node.fnord }
60
- output = Hpricot(@builder.target!)
60
+ output = Nokogiri::XML(@builder.target!)
61
61
 
62
62
  output.at('/CCSTMTTRNRS/CCSTMTRS/BANKTRANLIST/fnord').should_not be_nil
63
63
  end
@@ -76,7 +76,7 @@ describe OFX::Statement::Output::CreditCard do
76
76
  statement.available_credit = "305.00"
77
77
  statement << transaction
78
78
 
79
- output_doc = Hpricot(@output.serialise(statement))
79
+ output_doc = Nokogiri::XML(@output.serialise(statement))
80
80
  output_doc.search('/OFX/SIGNONMSGSRSV1/SONRS/STATUS/CODE').should_not be_empty
81
81
  output_doc.search('/OFX/SIGNONMSGSRSV1/CREDITCARDMSGSETV1/CCSTMTTRNRS/CCSTMTRS/BANKTRANLIST/STMTTRN/TRNAMT').should_not be_empty
82
82
  end
@@ -13,14 +13,14 @@ describe OFX::Statement::Output::CurrentAccount do
13
13
  describe "bank account message set wrapper" do
14
14
  it "should be able to generate the correct bank account message set element" do
15
15
  @output.message_set_block(@builder)
16
- output = Hpricot(@builder.target!)
16
+ output = Nokogiri::XML(@builder.target!)
17
17
 
18
18
  output.at('/BANKMSGSETV1').should_not be_nil
19
19
  end
20
20
 
21
21
  it "should yield a child node builder so that document generation can continue" do
22
22
  @output.message_set_block(@builder) { |node| node.fnord }
23
- output = Hpricot(@builder.target!)
23
+ output = Nokogiri::XML(@builder.target!)
24
24
 
25
25
  output.at('/BANKMSGSETV1/fnord').should_not be_nil
26
26
  end
@@ -37,7 +37,7 @@ describe OFX::Statement::Output::CurrentAccount do
37
37
 
38
38
  it "should be able to generate the correct Statement block" do
39
39
  @output.statement_block(@builder, @statement)
40
- output = Hpricot(@builder.target!)
40
+ output = Nokogiri::XML(@builder.target!)
41
41
 
42
42
  output.at('/STMTTRNRS/STMTRS/CURDEF').should_not be_nil
43
43
  output.at('/STMTTRNRS/STMTRS/CURDEF').inner_text.should == "GBP"
@@ -54,7 +54,7 @@ describe OFX::Statement::Output::CurrentAccount do
54
54
 
55
55
  it "should yield a child node builder so that document generation can continue" do
56
56
  @output.statement_block(@builder, @statement) { |node| node.fnord }
57
- output = Hpricot(@builder.target!)
57
+ output = Nokogiri::XML(@builder.target!)
58
58
 
59
59
  output.at('/STMTTRNRS/STMTRS/BANKTRANLIST/fnord').should_not be_nil
60
60
  end
@@ -72,7 +72,7 @@ describe OFX::Statement::Output::CurrentAccount do
72
72
  statement.sort_code = "089273"
73
73
  statement << transaction
74
74
 
75
- output_doc = Hpricot(@output.serialise(statement))
75
+ output_doc = Nokogiri::XML(@output.serialise(statement))
76
76
  output_doc.search('/OFX/SIGNONMSGSRSV1/SONRS/STATUS/CODE').should_not be_empty
77
77
  output_doc.search('/OFX/SIGNONMSGSRSV1/BANKMSGSETV1/STMTTRNRS/STMTRS/BANKTRANLIST/STMTTRN/TRNAMT').should_not be_empty
78
78
  end
data/spec/spec_helper.rb CHANGED
@@ -7,10 +7,11 @@ end
7
7
 
8
8
  require 'ofx'
9
9
  require 'coop_scraper'
10
- require 'hpricot'
10
+ require 'nokogiri'
11
11
 
12
12
  def full_fixture_path(fixture_dir, fixture_filename)
13
- File.dirname(__FILE__) + "/fixtures/#{fixture_dir}/" + fixture_filename
13
+ puts "full_fixture_path: #{File.expand_path("fixtures/#{fixture_dir}/#{fixture_filename}", File.dirname(__FILE__))}"
14
+ File.expand_path "fixtures/#{fixture_dir}/#{fixture_filename}", File.dirname(__FILE__)
14
15
  end
15
16
 
16
17
  def read_fixture(fixture_filename)
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coop_to_ofx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 1
8
+ - 0
9
+ version: 1.1.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Matt Patterson
@@ -10,77 +15,69 @@ bindir: bin
10
15
  cert_chain: []
11
16
 
12
17
  date: 2009-07-10 00:00:00 +01:00
13
- default_executable:
18
+ default_executable: coop_to_ofx
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
- name: hpricot
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
21
+ name: nokogiri
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ~>
22
27
  - !ruby/object:Gem::Version
23
- version: 0.6.0
24
- version:
28
+ segments:
29
+ - 1
30
+ - 4
31
+ - 0
32
+ version: 1.4.0
33
+ type: :runtime
34
+ version_requirements: *id001
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: builder
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
41
  - - ~>
32
42
  - !ruby/object:Gem::Version
43
+ segments:
44
+ - 2
45
+ - 1
46
+ - 0
33
47
  version: 2.1.0
34
- version:
48
+ type: :runtime
49
+ version_requirements: *id002
35
50
  - !ruby/object:Gem::Dependency
36
51
  name: rspec
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 1
60
+ - 3
61
+ - 0
62
+ version: 1.3.0
37
63
  type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: mocha
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
40
70
  requirements:
41
- - - ">="
71
+ - - ~>
42
72
  - !ruby/object:Gem::Version
43
- version: "0"
44
- version:
45
- description: |-
46
- Convert statement HTML from the Co-operative bank's online banking system to OFX for import into financial apps.
47
-
48
- = Usage
49
-
50
- For a Current Account:
51
-
52
- 1. Save the HTML source of the statement page.
53
-
54
- coop_to_ofx --current /path/to/statement.html
55
-
56
- Will produce /path/to/statement.ofx
57
-
58
- For a Credit Card:
59
-
60
- 1. Save the HTML source of the statement page
61
-
62
- coop_to_ofx /path/to/statement.html
63
-
64
- Or
65
-
66
- coop_to_ofx --credit /path/to/statement.html
67
-
68
- Will produce /path/to/statement.ofx
69
-
70
-
71
- To produce OFX 1 SGML (rather than OFX 2 XML):
72
-
73
- coop_to_ofx --ofx1 /path/to/statement.html
74
- coop_to_ofx --ofx1 --current /path/to/statement.html
75
-
76
- To show all the options:
77
-
78
- coop_to_ofx --help
79
-
80
-
81
- == To do
82
-
83
- XML / SGML validation of output against the specs
73
+ segments:
74
+ - 0
75
+ - 9
76
+ - 0
77
+ version: 0.9.0
78
+ type: :development
79
+ version_requirements: *id004
80
+ description: Convert statement HTML from the Co-operative bank's online banking system to OFX for import into financial apps.
84
81
  email: matt@reprocessed.org
85
82
  executables:
86
83
  - coop_to_ofx
@@ -89,12 +86,37 @@ extensions: []
89
86
  extra_rdoc_files:
90
87
  - README.rdoc
91
88
  files:
92
- - Rakefile
93
89
  - README.rdoc
94
- - bin/coop_to_ofx
90
+ - MIT-LICENSE
91
+ - Rakefile
92
+ - lib/coop_scraper/base.rb
93
+ - lib/coop_scraper/credit_card.rb
94
+ - lib/coop_scraper/current_account.rb
95
+ - lib/coop_scraper/version.rb
96
+ - lib/coop_scraper.rb
97
+ - lib/ofx/statement/base.rb
98
+ - lib/ofx/statement/credit_card.rb
99
+ - lib/ofx/statement/current_account.rb
100
+ - lib/ofx/statement/output/base.rb
101
+ - lib/ofx/statement/output/builder.rb
102
+ - lib/ofx/statement/output/credit_card.rb
103
+ - lib/ofx/statement/output/current_account.rb
104
+ - lib/ofx/statement/transaction.rb
105
+ - lib/ofx/statement.rb
106
+ - lib/ofx.rb
107
+ - spec/spec.opts
95
108
  - spec/coop_scraper/base_spec.rb
96
109
  - spec/coop_scraper/credit_card_spec.rb
97
110
  - spec/coop_scraper/current_account_spec.rb
111
+ - spec/ofx/statement/base_spec.rb
112
+ - spec/ofx/statement/credit_card_spec.rb
113
+ - spec/ofx/statement/current_account_spec.rb
114
+ - spec/ofx/statement/output/base_spec.rb
115
+ - spec/ofx/statement/output/builder_spec.rb
116
+ - spec/ofx/statement/output/credit_card_spec.rb
117
+ - spec/ofx/statement/output/current_account_spec.rb
118
+ - spec/ofx/statement/transaction_spec.rb
119
+ - spec/spec_helper.rb
98
120
  - spec/fixtures/credit_card/cc_statement_fixture.html
99
121
  - spec/fixtures/credit_card/foreign_transaction_fixture.html
100
122
  - spec/fixtures/credit_card/interest_transaction_fixture.html
@@ -112,33 +134,11 @@ files:
112
134
  - spec/fixtures/current_account/no_transactions_fixture.html
113
135
  - spec/fixtures/current_account/normal_transaction_fixture.html
114
136
  - spec/fixtures/current_account/payment_in_transaction_fixture.html
137
+ - spec/fixtures/current_account/priv_savings_fixture.html
138
+ - spec/fixtures/current_account/privilege_fixture.html
115
139
  - spec/fixtures/current_account/service_charge_transaction_fixture.html
116
140
  - spec/fixtures/current_account/transfer_transaction_fixture.html
117
- - spec/ofx/statement/base_spec.rb
118
- - spec/ofx/statement/credit_card_spec.rb
119
- - spec/ofx/statement/current_account_spec.rb
120
- - spec/ofx/statement/output/base_spec.rb
121
- - spec/ofx/statement/output/builder_spec.rb
122
- - spec/ofx/statement/output/credit_card_spec.rb
123
- - spec/ofx/statement/output/current_account_spec.rb
124
- - spec/ofx/statement/transaction_spec.rb
125
- - spec/spec.opts
126
- - spec/spec_helper.rb
127
- - lib/coop_scraper/base.rb
128
- - lib/coop_scraper/credit_card.rb
129
- - lib/coop_scraper/current_account.rb
130
- - lib/coop_scraper/version.rb
131
- - lib/coop_scraper.rb
132
- - lib/ofx/statement/base.rb
133
- - lib/ofx/statement/credit_card.rb
134
- - lib/ofx/statement/current_account.rb
135
- - lib/ofx/statement/output/base.rb
136
- - lib/ofx/statement/output/builder.rb
137
- - lib/ofx/statement/output/credit_card.rb
138
- - lib/ofx/statement/output/current_account.rb
139
- - lib/ofx/statement/transaction.rb
140
- - lib/ofx/statement.rb
141
- - lib/ofx.rb
141
+ - bin/coop_to_ofx
142
142
  has_rdoc: true
143
143
  homepage: http://reprocessed.org/
144
144
  licenses: []
@@ -150,23 +150,60 @@ rdoc_options:
150
150
  require_paths:
151
151
  - lib
152
152
  required_ruby_version: !ruby/object:Gem::Requirement
153
+ none: false
153
154
  requirements:
154
155
  - - ">="
155
156
  - !ruby/object:Gem::Version
157
+ segments:
158
+ - 0
156
159
  version: "0"
157
- version:
158
160
  required_rubygems_version: !ruby/object:Gem::Requirement
161
+ none: false
159
162
  requirements:
160
163
  - - ">="
161
164
  - !ruby/object:Gem::Version
165
+ segments:
166
+ - 0
162
167
  version: "0"
163
- version:
164
168
  requirements: []
165
169
 
166
- rubyforge_project: coop_to_ofx
167
- rubygems_version: 1.3.4
170
+ rubyforge_project:
171
+ rubygems_version: 1.3.7
168
172
  signing_key:
169
173
  specification_version: 3
170
174
  summary: Convert Co-operative bank HTML statements into OFX
171
- test_files: []
172
-
175
+ test_files:
176
+ - spec/spec.opts
177
+ - spec/coop_scraper/base_spec.rb
178
+ - spec/coop_scraper/credit_card_spec.rb
179
+ - spec/coop_scraper/current_account_spec.rb
180
+ - spec/ofx/statement/base_spec.rb
181
+ - spec/ofx/statement/credit_card_spec.rb
182
+ - spec/ofx/statement/current_account_spec.rb
183
+ - spec/ofx/statement/output/base_spec.rb
184
+ - spec/ofx/statement/output/builder_spec.rb
185
+ - spec/ofx/statement/output/credit_card_spec.rb
186
+ - spec/ofx/statement/output/current_account_spec.rb
187
+ - spec/ofx/statement/transaction_spec.rb
188
+ - spec/spec_helper.rb
189
+ - spec/fixtures/credit_card/cc_statement_fixture.html
190
+ - spec/fixtures/credit_card/foreign_transaction_fixture.html
191
+ - spec/fixtures/credit_card/interest_transaction_fixture.html
192
+ - spec/fixtures/credit_card/maybe.txt
193
+ - spec/fixtures/credit_card/merchandise_interest_fixture.html
194
+ - spec/fixtures/credit_card/normal_transaction_fixture.html
195
+ - spec/fixtures/credit_card/overlimit_charge_fixture.html
196
+ - spec/fixtures/credit_card/payment_in_transaction_fixture.html
197
+ - spec/fixtures/credit_card/simple_cc_statement.ofx
198
+ - spec/fixtures/credit_card/statement_with_interest_line_fixture.html
199
+ - spec/fixtures/current_account/cash_point_transaction_fixture.html
200
+ - spec/fixtures/current_account/current_account_fixture.html
201
+ - spec/fixtures/current_account/current_account_fixture.ofx
202
+ - spec/fixtures/current_account/debit_interest_transaction_fixture.html
203
+ - spec/fixtures/current_account/no_transactions_fixture.html
204
+ - spec/fixtures/current_account/normal_transaction_fixture.html
205
+ - spec/fixtures/current_account/payment_in_transaction_fixture.html
206
+ - spec/fixtures/current_account/priv_savings_fixture.html
207
+ - spec/fixtures/current_account/privilege_fixture.html
208
+ - spec/fixtures/current_account/service_charge_transaction_fixture.html
209
+ - spec/fixtures/current_account/transfer_transaction_fixture.html