Class: MOCO::ProjectContract

Inherits:
BaseEntity show all
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

#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



38
39
40
# File 'lib/moco/entities/project_contract.rb', line 38

def project
  association(:project)
end

#to_sObject



46
47
48
# File 'lib/moco/entities/project_contract.rb', line 46

def to_s
  "Contract ##{id}"
end

#userObject



42
43
44
# File 'lib/moco/entities/project_contract.rb', line 42

def user
  association(:user)
end