Class: MOCO::ProjectContract
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::ProjectContract
- Defined in:
- lib/moco/entities/project_contract.rb
Overview
Represents a MOCO project contract/staff assignment (Projekte / Personal) - assigning users to projects
Required attributes for create:
user_id - Integer, user to assign to project
Optional attributes:
billable - Boolean, whether user's time is billable
active - Boolean, whether assignment is active
budget - Float, hours budget for this user on project
hourly_rate - Float, billing rate for this user on project
Read-only attributes:
id, firstname, lastname, created_at, updated_at
Access via project:
project = moco.projects.find(123)
project.contracts # via nested API
Example:
# Assign user to project with budget
moco.post("projects/123/contracts", {
user_id: 456,
budget: 100,
hourly_rate: 150.0,
billable: true
})
Note:
Cannot delete assignment if user has tracked hours.
user_id cannot be changed after creation.
Instance Attribute Summary
Attributes inherited from BaseEntity
Instance Method Summary collapse
-
#project ⇒ Object
Associations.
- #to_s ⇒ Object
- #user ⇒ 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
38 39 40 |
# File 'lib/moco/entities/project_contract.rb', line 38 def project association(:project) end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/moco/entities/project_contract.rb', line 46 def to_s "Contract ##{id}" end |
#user ⇒ Object
42 43 44 |
# File 'lib/moco/entities/project_contract.rb', line 42 def user association(:user) end |