Class: SaltParser::Ofx::Builder
Instance Attribute Summary
Attributes inherited from Builder
#body, #content, #headers, #parser
Instance Method Summary collapse
-
#initialize(resource) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(resource) ⇒ Builder
Returns a new instance of Builder.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ofx/builder.rb', line 5 def initialize(resource) resource = open_resource(resource) resource.rewind begin @content = convert_to_utf8(resource.read) prepare(content) rescue Exception raise SaltParser::Error::UnsupportedFileError end @parser = case headers["VERSION"] when /102|103/ then SaltParser::Ofx::Parser::OFX102.new(:headers => headers, :body => body) when /200|202|211/ then SaltParser::Ofx::Parser::OFX211.new(:headers => headers, :body => body) else raise SaltParser::Error::UnsupportedFileError end end |