Class: SaltParser::Ofx::Parser::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ofx/parser/base.rb

Direct Known Subclasses

OFX102, OFX211

Constant Summary collapse

ACCOUNT_TYPES =
{
  "CHECKING"   => :checking,
  "SAVINGS"    => :savings,
  "CREDITCARD" => :credit_card,
  "CREDITLINE" => :credit,
  "INVESTMENT" => :investment,
  "MONEYMRKT"  => :savings
}
TRANSACTION_TYPES =
[
  'ATM', 'CASH', 'CHECK', 'CREDIT', 'DEBIT', 'DEP', 'DIRECTDEBIT', 'DIRECTDEP', 'DIV',
  'FEE', 'INT', 'OTHER', 'PAYMENT', 'POS', 'REPEATPMT', 'SRVCHG', 'XFER'
].inject({}) { |hash, tran_type| hash[tran_type] = tran_type.downcase.to_sym; hash }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



21
22
23
24
25
26
27
28
29
# File 'lib/ofx/parser/base.rb', line 21

def initialize(options = {})
  @headers  = options[:headers]
  @body     = options[:body]
  @html     = Nokogiri::HTML.parse(body)
  @errors   = []
  build_sign_on
  build_accounts
  check_for_errors
end

Instance Attribute Details

#accountsObject (readonly)

Returns the value of attribute accounts.



19
20
21
# File 'lib/ofx/parser/base.rb', line 19

def accounts
  @accounts
end

#bodyObject (readonly)

Returns the value of attribute body.



19
20
21
# File 'lib/ofx/parser/base.rb', line 19

def body
  @body
end

#errorsObject (readonly)

Returns the value of attribute errors.



19
20
21
# File 'lib/ofx/parser/base.rb', line 19

def errors
  @errors
end

#headersObject (readonly)

Returns the value of attribute headers.



19
20
21
# File 'lib/ofx/parser/base.rb', line 19

def headers
  @headers
end

#htmlObject (readonly)

Returns the value of attribute html.



19
20
21
# File 'lib/ofx/parser/base.rb', line 19

def html
  @html
end

#sign_onObject (readonly)

Returns the value of attribute sign_on.



19
20
21
# File 'lib/ofx/parser/base.rb', line 19

def sign_on
  @sign_on
end

Instance Method Details

#build_accountsObject



39
40
41
42
43
44
# File 'lib/ofx/parser/base.rb', line 39

def build_accounts
  @accounts = Ofx::Accounts.new
  
  
  
end

#to_hashObject



31
32
33
34
35
36
37
# File 'lib/ofx/parser/base.rb', line 31

def to_hash
  {
    :errors => errors,
    :sign_on => sign_on.to_hash,
    :accounts => accounts.to_hash
  }
end