Sha256: e9d395d5582b76d0a1d642975e51e35cc1745e222ce441ba27907a3af323a138
Contents?: true
Size: 767 Bytes
Versions: 1
Compression:
Stored size: 767 Bytes
Contents
# frozen_string_literal: true require_relative 'account' require_relative 'customer' require_relative 'expense_line_item' require_relative 'vendor' module LedgerSync class Expense < LedgerSync::Resource attribute :currency, type: Type::String attribute :memo, type: Type::String attribute :payment_type, type: Type::String attribute :transaction_date, type: Type::Date attribute :exchange_rate, type: Type::Float attribute :reference_number, type: Type::String references_one :entity, to: [Customer, Vendor] references_one :account, to: Account references_many :line_items, to: ExpenseLineItem def amount line_items.map(&:amount).sum end def name "Purchase: #{amount} #{currency}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-1.3.1 | lib/ledger_sync/resources/expense.rb |