Class: MOCO::User

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

Overview

Represents a MOCO user Provides methods for user-specific operations and associations

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

#firstnameObject

Returns the value of attribute firstname.



91
92
93
# File 'lib/moco/entities.rb', line 91

def firstname
  @firstname
end

#idObject

Returns the value of attribute id.



91
92
93
# File 'lib/moco/entities.rb', line 91

def id
  @id
end

#lastnameObject

Returns the value of attribute lastname.



91
92
93
# File 'lib/moco/entities.rb', line 91

def lastname
  @lastname
end

Instance Method Details

#activitiesObject

Associations



13
14
15
# File 'lib/moco/entities/user.rb', line 13

def activities
  has_many(:activities)
end

#full_nameObject



25
26
27
# File 'lib/moco/entities/user.rb', line 25

def full_name
  "#{firstname} #{lastname}"
end

#holidaysObject



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

def holidays
  has_many(:holidays)
end

#performance_reportObject

Instance methods for user-specific operations



8
9
10
# File 'lib/moco/entities/user.rb', line 8

def performance_report
  client.get("users/#{id}/performance_report")
end

#presencesObject



17
18
19
# File 'lib/moco/entities/user.rb', line 17

def presences
  has_many(:presences)
end

#to_sObject



29
30
31
# File 'lib/moco/entities/user.rb', line 29

def to_s
  full_name
end