Class: MOCO::Holiday
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::Holiday
- Defined in:
- lib/moco/entities/holiday.rb
Overview
Represents a MOCO holiday entry Provides methods for holiday-specific associations
Instance Attribute Summary
Attributes inherited from BaseEntity
Class Method Summary collapse
-
.entity_path ⇒ Object
Override entity_path to match API path.
Instance Method Summary collapse
- #creator ⇒ 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
Class Method Details
.entity_path ⇒ Object
Override entity_path to match API path
8 9 10 |
# File 'lib/moco/entities/holiday.rb', line 8 def self.entity_path "users/holidays" end |
Instance Method Details
#creator ⇒ Object
17 18 19 |
# File 'lib/moco/entities/holiday.rb', line 17 def creator @creator ||= client.users.find(creator_id) if creator_id end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/moco/entities/holiday.rb', line 21 def to_s "#{year} - #{title} - #{days} days (#{hours} hours) - #{user&.full_name}" end |
#user ⇒ Object
Associations
13 14 15 |
# File 'lib/moco/entities/holiday.rb', line 13 def user @user ||= client.users.find(user_id) if user_id end |