Class: MOCO::PlanningEntry
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::PlanningEntry
- Defined in:
- lib/moco/entities/planning_entry.rb
Overview
Represents a MOCO planning entry Provides methods for planning entry-specific associations
Instance Attribute Summary
Attributes inherited from BaseEntity
Instance Method Summary collapse
- #deal ⇒ Object
- #project ⇒ Object
- #to_s ⇒ Object
-
#user ⇒ Object
Associations.
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
#deal ⇒ Object
16 17 18 |
# File 'lib/moco/entities/planning_entry.rb', line 16 def deal @deal ||= client.deals.find(deal_id) if deal_id end |
#project ⇒ Object
12 13 14 |
# File 'lib/moco/entities/planning_entry.rb', line 12 def project @project ||= client.projects.find(project_id) if project_id end |
#to_s ⇒ Object
20 21 22 23 24 |
# File 'lib/moco/entities/planning_entry.rb', line 20 def to_s period = starts_on == ends_on ? starts_on : "#{starts_on} to #{ends_on}" resource = project || deal "#{period} - #{hours_per_day}h/day - #{user&.full_name} - #{resource&.name}" end |
#user ⇒ Object
Associations
8 9 10 |
# File 'lib/moco/entities/planning_entry.rb', line 8 def user @user ||= client.users.find(user_id) if user_id end |