Class: OFX::Parser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Parser

Returns a new instance of Parser.



7
8
9
10
11
# File 'lib/ofx/parser.rb', line 7

def initialize(body)
  @body = body
  @output = {}
  dump
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/ofx/parser.rb', line 4

def body
  @body
end

#outputObject

Returns the value of attribute output.



5
6
7
# File 'lib/ofx/parser.rb', line 5

def output
  @output
end

Instance Method Details

#balanceObject



21
22
23
# File 'lib/ofx/parser.rb', line 21

def balance
  @output[:balance].round(2)
end

#ofx_versionObject



13
14
15
# File 'lib/ofx/parser.rb', line 13

def ofx_version
  @body[/VERSION:([0-9]{3})/, 1].to_i
end

#pendingObject



25
26
27
# File 'lib/ofx/parser.rb', line 25

def pending
  @output[:pending].round(2)
end

#transactionsObject



17
18
19
# File 'lib/ofx/parser.rb', line 17

def transactions
  @output[:transactions]
end