banker-ofx 0.4.1 → 0.4.2
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.
- data/README.md +1 -1
- data/lib/ofx.rb +3 -0
- data/lib/ofx/parser.rb +10 -5
- data/lib/ofx/version.rb +1 -1
- data/spec/ofx/account_spec.rb +0 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Banker [][travis] [][gemnasium]
|
1
|
+
# Banker-OFX [][travis] [][gemnasium]
|
2
2
|
|
3
3
|
[travis]:http://travis-ci.org/BritRuby/Banker-OFX
|
4
4
|
[gemnasium]:https://gemnasium.com/BritRuby/Banker-OFX
|
data/lib/ofx.rb
CHANGED
data/lib/ofx/parser.rb
CHANGED
@@ -17,7 +17,7 @@ module OFX
|
|
17
17
|
return document if document.respond_to?(:read)
|
18
18
|
open(document, "r:iso-8859-1:utf-8")
|
19
19
|
rescue
|
20
|
-
StringIO.new(document
|
20
|
+
StringIO.new(utf8_converter(document))
|
21
21
|
end
|
22
22
|
|
23
23
|
def prepare(content)
|
@@ -57,10 +57,15 @@ module OFX
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def condition_body(body)
|
60
|
-
body.gsub!(/>\s+</m, "><")
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
body.gsub!(/>\s+</m, "><")
|
61
|
+
body.gsub!(/\s+</m, "<")
|
62
|
+
body.gsub!(/>\s+/m, ">")
|
63
|
+
body.gsub!(/<(\w+?)>([^<]+)/m, '<\1>\2</\1>')
|
64
|
+
end
|
65
|
+
|
66
|
+
def utf8_converter(string)
|
67
|
+
return string if Kconv.isutf8(string)
|
68
|
+
Iconv.conv("UTF-8", "LATIN1//IGNORE", string)
|
64
69
|
end
|
65
70
|
end
|
66
71
|
end
|
data/lib/ofx/version.rb
CHANGED
data/spec/ofx/account_spec.rb
CHANGED
@@ -58,7 +58,6 @@ describe OFX::Account do
|
|
58
58
|
it { subject.transactions.size.should eql(2) }
|
59
59
|
it { subject.balance.amount.should eql(-562.0) }
|
60
60
|
it { subject.balance.amount_in_pennies.should eql(-56200) }
|
61
|
-
it { subject.balance.posted_at.should eql(Time.parse("2005-08-31 16:51:53 +0100")) }
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|