Class: MOCO::RecurringExpense
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::RecurringExpense
- Defined in:
- lib/moco/entities/recurring_expense.rb
Overview
Represents a MOCO project recurring expense (Wiederkehrende Zusatzleistungen) for ongoing services like hosting
Required attributes for create:
start_date - String, "YYYY-MM-DD" when recurring starts
period - String, recurrence interval:
"weekly", "biweekly", "monthly", "quarterly",
"biannual", "annual"
title - String, expense name (e.g., "Monthly Hosting")
quantity - Float, number of units per period
unit - String, unit type (e.g., "Server", "License")
unit_price - Float, price per unit
unit_cost - Float, internal cost per unit
Optional attributes:
finish_date - String, "YYYY-MM-DD" when to stop (null = unlimited)
description - String, detailed description
billable - Boolean, whether to invoice (default: true)
budget_relevant - Boolean, count toward budget (default: false)
service_period_direction - String, "none", "forward", "backward"
custom_properties - Hash, custom field values
Read-only attributes:
id, price, cost, currency, recur_next_date, project (Hash),
revenue_category (Hash), created_at, updated_at
Example:
moco.post("projects/123/recurring_expenses", {
start_date: "2024-01-01",
period: "monthly",
title: "Web Hosting",
quantity: 1,
unit: "Server",
unit_price: 99.0,
unit_cost: 50.0,
billable: true
})
Note:
start_date and period cannot be modified after creation.
Instance Attribute Summary
Attributes inherited from BaseEntity
Instance Method Summary collapse
-
#project ⇒ Object
Associations.
- #to_s ⇒ Object
Methods inherited from BaseEntity
#==, #association, #destroy, #eql?, #has_many, #hash, #id, #initialize, #inspect, #reload, #save, #to_h, #to_json, #update
Constructor Details
This class inherits a constructor from MOCO::BaseEntity
Instance Method Details
#project ⇒ Object
Associations
47 48 49 |
# File 'lib/moco/entities/recurring_expense.rb', line 47 def project association(:project) end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/moco/entities/recurring_expense.rb', line 51 def to_s "RecurringExpense ##{id} - #{title}" end |