Class: MOCO::PaymentSchedule

Inherits:
BaseEntity show all
Defined in:
lib/moco/entities/payment_schedule.rb

Overview

Represents a MOCO project payment schedule entry (Geplante Abrechnungen) for fixed-price project milestones

Required attributes for create:

net_total - Float, payment amount
date      - String, "YYYY-MM-DD" scheduled payment date

Optional attributes:

title       - String, milestone name (e.g., "First installment")
description - String, milestone details (HTML allowed)
checked     - Boolean, mark as completed

Read-only attributes:

id, project (Hash), billed, created_at, updated_at

Access methods:

# All payment schedules across projects
moco.payment_schedules.all

# Filter by project
moco.payment_schedules.where(project_id: 123)

Example:

moco.post("projects/123/payment_schedules", {
  net_total: 5000.0,
  date: "2024-03-15",
  title: "Design Phase Complete"
})

Filtering:

moco.payment_schedules.where(from: "2024-01-01", to: "2024-12-31")
moco.payment_schedules.where(checked: false)  # unpaid only
moco.payment_schedules.where(company_id: 456)

Instance Attribute Summary

Attributes inherited from BaseEntity

#attributes, #client

Instance Method Summary collapse

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

#projectObject

Associations



40
41
42
# File 'lib/moco/entities/payment_schedule.rb', line 40

def project
  association(:project)
end

#to_sObject



44
45
46
# File 'lib/moco/entities/payment_schedule.rb', line 44

def to_s
  "PaymentSchedule ##{id} (#{date})"
end