Class: MOCO::Schedule
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::Schedule
- Defined in:
- lib/moco/entities/schedule.rb
Overview
Represents a MOCO schedule entry Provides methods for schedule-specific associations
Instance Attribute Summary
Attributes inherited from BaseEntity
Instance Method Summary collapse
- #assignment ⇒ 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
#assignment ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/moco/entities/schedule.rb', line 12 def assignment return nil unless assignment_id @assignment ||= if assignment_type == "Absence" client.absences.find(assignment_id) else client.projects.find(assignment_id) end end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/moco/entities/schedule.rb', line 22 def to_s "#{date} - #{user&.full_name} - #{assignment&.name}" end |
#user ⇒ Object
Associations
8 9 10 |
# File 'lib/moco/entities/schedule.rb', line 8 def user @user ||= client.users.find(user_id) if user_id end |