Class: MOCO::Task
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::Task
- Defined in:
- lib/moco/entities.rb,
lib/moco/entities/task.rb
Overview
Represents a MOCO task (project service/activity type) Tasks are nested under projects: project.tasks.create(…)
Required attributes for create:
name - String, task name (e.g., "Development", "Design / UX")
Optional attributes:
billable - Boolean, whether time on this task is billable
active - Boolean, whether task is active
budget - Float/Integer, budget in hours or currency
hourly_rate - Float/Integer, rate for this task (used if project billing_variant is "task")
description - String, task description
Read-only attributes (returned by API):
id, created_at, updated_at
Example:
project = moco.projects.find(123)
project.tasks.create(
name: "Development",
billable: true,
hourly_rate: 150,
budget: 100
)
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#billable ⇒ Object
Returns the value of attribute billable.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
Attributes inherited from BaseEntity
Instance Method Summary collapse
- #activities ⇒ Object
-
#project ⇒ Object
Associations.
- #to_s ⇒ Object
Methods inherited from BaseEntity
#==, #association, #destroy, #eql?, #has_many, #hash, #initialize, #inspect, #reload, #save, #to_h, #to_json, #update
Constructor Details
This class inherits a constructor from MOCO::BaseEntity
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
60 61 62 |
# File 'lib/moco/entities.rb', line 60 def active @active end |
#billable ⇒ Object
Returns the value of attribute billable.
60 61 62 |
# File 'lib/moco/entities.rb', line 60 def billable @billable end |
#id ⇒ Object
Returns the value of attribute id.
60 61 62 |
# File 'lib/moco/entities.rb', line 60 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
60 61 62 |
# File 'lib/moco/entities.rb', line 60 def name @name end |
#project_id ⇒ Object
Returns the value of attribute project_id.
60 61 62 |
# File 'lib/moco/entities.rb', line 60 def project_id @project_id end |
Instance Method Details
#activities ⇒ Object
35 36 37 |
# File 'lib/moco/entities/task.rb', line 35 def activities client.activities.where(task_id: id) end |
#project ⇒ Object
Associations
31 32 33 |
# File 'lib/moco/entities/task.rb', line 31 def project @project ||= client.projects.find(project_id) if project_id end |
#to_s ⇒ Object
62 63 64 |
# File 'lib/moco/entities.rb', line 62 def to_s name end |