Class: MOCO::Presence
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- MOCO::Presence
- Defined in:
- lib/moco/entities/presence.rb
Overview
Represents a MOCO presence entry Provides methods for presence-specific operations and associations
Instance Attribute Summary
Attributes inherited from BaseEntity
Class Method Summary collapse
-
.entity_path ⇒ Object
Define the specific API path for this entity as a class method.
-
.touch(client, is_home_office: false, override: nil) ⇒ Object
Class methods for special operations.
Instance Method Summary collapse
- #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
Define the specific API path for this entity as a class method
8 9 10 |
# File 'lib/moco/entities/presence.rb', line 8 def self.entity_path "users/presences" end |
.touch(client, is_home_office: false, override: nil) ⇒ Object
Class methods for special operations
13 14 15 16 17 18 19 |
# File 'lib/moco/entities/presence.rb', line 13 def self.touch(client, is_home_office: false, override: nil) payload = {} payload[:is_home_office] = is_home_office if is_home_office payload[:override] = override if override client.post("users/presences/touch", payload) end |
Instance Method Details
#to_s ⇒ Object
26 27 28 |
# File 'lib/moco/entities/presence.rb', line 26 def to_s "#{date} - #{from} to #{to} - #{user&.full_name}" end |
#user ⇒ Object
Associations
22 23 24 |
# File 'lib/moco/entities/presence.rb', line 22 def user @user ||= client.users.find(user_id) if user_id end |