Class: LedgerSync::Expense
- Defined in:
- lib/ledger_sync/resources/expense.rb
Constant Summary
Constants inherited from Resource
Instance Method Summary collapse
Methods inherited from Resource
#==, #assign_attribute, #assign_attributes, #changed?, #changes, #dup, inherited, #klass_from_resource_type, resource_module_str, resource_type, serialize_attribute?, #to_h
Methods included from ResourceAttribute::Reference::Many::Mixin
Methods included from ResourceAttribute::Reference::One::Mixin
Methods included from ResourceAttribute::Mixin
#assign_attribute, #assign_attributes, included, #initialize, #resource_attributes, #save, #serialize_attributes
Methods included from Validatable
#valid?, #validate, #validate_or_fail
Instance Method Details
#amount ⇒ Object
25 26 27 |
# File 'lib/ledger_sync/resources/expense.rb', line 25 def amount line_items.map(&:amount).sum end |
#name ⇒ Object
29 30 31 |
# File 'lib/ledger_sync/resources/expense.rb', line 29 def name "Purchase: #{amount} #{currency.try(:symbol)}" end |