Class: MOCO::Project Deprecated

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

Overview

Deprecated.

Use MOCO::Project from entities/project.rb instead

hundertzehn.github.io/mocoapp-api-docs/sections/projects.html

Instance Attribute Summary collapse

Attributes inherited from BaseEntity

#attributes, #client

Instance Method Summary collapse

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

#activeObject

Returns the value of attribute active.



50
51
52
# File 'lib/moco/entities.rb', line 50

def active
  @active
end

#customerObject

Returns the value of attribute customer.



50
51
52
# File 'lib/moco/entities.rb', line 50

def customer
  @customer
end

#idObject

Returns the value of attribute id.



50
51
52
# File 'lib/moco/entities.rb', line 50

def id
  @id
end

#nameObject

Returns the value of attribute name.



50
51
52
# File 'lib/moco/entities.rb', line 50

def name
  @name
end

#tasksObject

Fetches tasks associated with this project.



34
35
36
# File 'lib/moco/entities/project.rb', line 34

def tasks
  @tasks
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/moco/entities/project.rb', line 52

def active?
  status == "active"
end

#activitiesObject

Fetches activities associated with this project.



21
22
23
24
# File 'lib/moco/entities/project.rb', line 21

def activities
  # Use the has_many method to fetch activities
  has_many(:activities)
end

#co_leaderObject



15
16
17
18
# File 'lib/moco/entities/project.rb', line 15

def co_leader
  # Use the association method to fetch the co_leader
  association(:co_leader, "User")
end

#expensesObject

Fetches expenses associated with this project.



27
28
29
30
31
# File 'lib/moco/entities/project.rb', line 27

def expenses
  # Don't cache the proxy - create a fresh one each time
  # This ensures we get fresh data when expenses are created/updated/deleted
  MOCO::NestedCollectionProxy.new(client, self, :expenses, "Expense")
end

#leaderObject



10
11
12
13
# File 'lib/moco/entities/project.rb', line 10

def leader
  # Use the association method to fetch the leader
  association(:leader, "User")
end

#to_sObject



52
53
54
# File 'lib/moco/entities.rb', line 52

def to_s
  [customer&.name, name].join(" / ")
end