Class: Buxfer::Account
- Defined in:
- lib/buxfer/account.rb
Class Method Summary collapse
-
.all ⇒ Object
Returns an array of accounts.
Instance Method Summary collapse
-
#add_transaction(amount, description, status = nil, tags = []) ⇒ Object
Add a transaction to Buxfer.
-
#transactions(options = {}) ⇒ Object
Return an array of the last 25 transactions for this account.
-
#upload_statement(statement, date_format = 'DD/MM/YYYY') ⇒ Object
Upload a file containing a transaction statement to Buxfer account.
Class Method Details
Instance Method Details
#add_transaction(amount, description, status = nil, tags = []) ⇒ Object
Add a transaction to Buxfer. The amount and description must be specified.
An array of tag names can be specified.
Examples:
account.add_transaction(1000, 'Salary')
28 29 30 |
# File 'lib/buxfer/account.rb', line 28 def add_transaction(amount, description, status = nil, = []) Buxfer.add_transaction(amount, description, self.name, status, ) end |
#transactions(options = {}) ⇒ Object
Return an array of the last 25 transactions for this account. See Buxfer::Base#transactions for valid options.
14 15 16 |
# File 'lib/buxfer/account.rb', line 14 def transactions( = {}) Buxfer.transactions(.merge(:account => self)) end |
#upload_statement(statement, date_format = 'DD/MM/YYYY') ⇒ Object
Upload a file containing a transaction statement to Buxfer account.
The statement can be a String or an IO object.
An optional date format can be passed indicating if the dates used in the statement are in the format ‘DD/MM/YYYY’ (default) or ‘MM/DD/YYYY’
Example:
account = Buxfer.accounts.first
account.upload_statement(open('/path/to/file')) => true
45 46 47 |
# File 'lib/buxfer/account.rb', line 45 def upload_statement(statement, date_format = 'DD/MM/YYYY') Buxfer.upload_statement(self.id, statement, date_format) end |