Class: OFX::Statement::Base
- Inherits:
-
Object
- Object
- OFX::Statement::Base
- Defined in:
- lib/ofx/statement/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#account_number ⇒ Object
Returns the value of attribute account_number.
-
#builder_class ⇒ Object
readonly
Returns the value of attribute builder_class.
- #currency ⇒ Object
-
#date ⇒ Object
Returns the value of attribute date.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
- #language ⇒ Object
-
#ledger_balance ⇒ Object
Returns the value of attribute ledger_balance.
- #server_response_time ⇒ Object
-
#start_date ⇒ Object
Returns the value of attribute start_date.
Instance Method Summary collapse
- #<<(transaction) ⇒ Object
- #fitid_for(transaction) ⇒ Object
-
#initialize(format = :ofx2) ⇒ Base
constructor
A new instance of Base.
- #serialise(format = :ofx2) ⇒ Object
- #transactions ⇒ Object
Constructor Details
#initialize(format = :ofx2) ⇒ Base
Returns a new instance of Base.
13 14 15 16 17 18 19 20 |
# File 'lib/ofx/statement/base.rb', line 13 def initialize(format = :ofx2) case format when :ofx1 @builder_class = OFX::Statement::Output::Builder::OFX1 when :ofx2 @builder_class = OFX::Statement::Output::Builder::OFX2 end end |
Instance Attribute Details
#account_number ⇒ Object
Returns the value of attribute account_number.
10 11 12 |
# File 'lib/ofx/statement/base.rb', line 10 def account_number @account_number end |
#builder_class ⇒ Object (readonly)
Returns the value of attribute builder_class.
8 9 10 |
# File 'lib/ofx/statement/base.rb', line 8 def builder_class @builder_class end |
#currency ⇒ Object
22 23 24 |
# File 'lib/ofx/statement/base.rb', line 22 def currency @currency ||= 'GBP' end |
#date ⇒ Object
Returns the value of attribute date.
10 11 12 |
# File 'lib/ofx/statement/base.rb', line 10 def date @date end |
#end_date ⇒ Object
Returns the value of attribute end_date.
10 11 12 |
# File 'lib/ofx/statement/base.rb', line 10 def end_date @end_date end |
#language ⇒ Object
26 27 28 |
# File 'lib/ofx/statement/base.rb', line 26 def language @language ||= 'ENG' end |
#ledger_balance ⇒ Object
Returns the value of attribute ledger_balance.
10 11 12 |
# File 'lib/ofx/statement/base.rb', line 10 def ledger_balance @ledger_balance end |
#server_response_time ⇒ Object
30 31 32 |
# File 'lib/ofx/statement/base.rb', line 30 def server_response_time @server_response_time ||= Time.now end |
#start_date ⇒ Object
Returns the value of attribute start_date.
10 11 12 |
# File 'lib/ofx/statement/base.rb', line 10 def start_date @start_date end |
Instance Method Details
#<<(transaction) ⇒ Object
34 35 36 37 |
# File 'lib/ofx/statement/base.rb', line 34 def <<(transaction) transaction.statement = self transactions << transaction end |
#fitid_for(transaction) ⇒ Object
43 44 45 46 |
# File 'lib/ofx/statement/base.rb', line 43 def fitid_for(transaction) index = transactions.index(transaction) Digest::SHA1.hexdigest(self.date.strftime('%Y%m%d') + transaction.date.strftime('%Y%m%d') + index.to_s) end |
#serialise(format = :ofx2) ⇒ Object
48 49 50 |
# File 'lib/ofx/statement/base.rb', line 48 def serialise(format = :ofx2) output.new.serialise(self, format) end |
#transactions ⇒ Object
39 40 41 |
# File 'lib/ofx/statement/base.rb', line 39 def transactions @transactions ||= [] end |