Class: UCB::LDAP::JobAppointment

Inherits:
Entry
  • Object
show all
Defined in:
lib/ucb_ldap/job_appointment.rb

Overview

UCB::LDAP::JobAppointment

This class models a person’s job appointment instance in the UCB LDAP directory.

appts = JobAppontment.find_by_uid("1234")       #=> [#<UCB::LDAP::JobAppointment: ...>, ...]

JobAppointments are usually loaded through a Person instance:

p = Person.find_by_uid("1234")    #=> #<UCB::LDAP::Person: ...>
appts = p.job_appointments        #=> [#<UCB::LDAP::JobAppointment: ...>, ...]

Note on Binds

You must have a privileged bind and pass your credentials to UCB::LDAP.authenticate() before performing your JobAppointment search.

Constant Summary

Constants inherited from Entry

Entry::TESTING

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entry

#assigned_attributes, #attributes, canonical, #canonical, combine_filters, create, create!, #delete, #delete!, #dn, entity_name, filter_in, find_by_dn, #initialize, make_search_filter, #method_missing, #modify, #modify_operations, #net_ldap, net_ldap, object_classes, required_attributes, required_schema_attributes, schema_attribute, schema_attributes_array, schema_attributes_hash, search, set_schema_attributes, #setter_method?, tree_base, tree_base=, unique_object_class, #update_attributes, #update_attributes!, #value_getter, #value_setter

Constructor Details

This class inherits a constructor from UCB::LDAP::Entry

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class UCB::LDAP::Entry

Class Method Details

.find_by_uid(uid) ⇒ Object

Returns an Array of JobAppointment for uid, sorted by record_number(). Returns an empty Array ([]) if nothing is found.



69
70
71
72
73
# File 'lib/ucb_ldap/job_appointment.rb', line 69

def self.find_by_uid(uid)
  base = "uid=#{uid},ou=people,dc=berkeley,dc=edu"
  filter = Net::LDAP::Filter.eq("objectclass", 'berkeleyEduPersonJobAppt')
  search(:base => base, :filter => filter).sort_by { |appt| appt.record_number }
end

Instance Method Details

#appointment_typeObject



55
56
57
# File 'lib/ucb_ldap/job_appointment.rb', line 55

def appointment_type
  berkeleyEduPersonJobApptType
end

#cto_codeObject



22
23
24
# File 'lib/ucb_ldap/job_appointment.rb', line 22

def cto_code
  berkeleyEduPersonJobApptCTOCode
end

#deptidObject



26
27
28
# File 'lib/ucb_ldap/job_appointment.rb', line 26

def deptid
  berkeleyEduPersonJobApptDepartment
end

#erc_codeObject

Returns Employee Relation Code



43
44
45
# File 'lib/ucb_ldap/job_appointment.rb', line 43

def erc_code
  berkeleyEduPersonJobApptRelationsCode
end

#personnel_program_codeObject



34
35
36
# File 'lib/ucb_ldap/job_appointment.rb', line 34

def personnel_program_code
  berkeleyEduPersonJobApptPersPgmCode
end

#primary?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/ucb_ldap/job_appointment.rb', line 38

def primary?
  berkeleyEduPersonJobApptPrimaryFlag
end

#record_numberObject



30
31
32
# File 'lib/ucb_ldap/job_appointment.rb', line 30

def record_number
  berkeleyEduPersonJobApptEmpRecNumber.to_i
end

#represented?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/ucb_ldap/job_appointment.rb', line 47

def represented?
  berkeleyEduPersonJobApptRepresentation != 'U'
end

#title_codeObject



51
52
53
# File 'lib/ucb_ldap/job_appointment.rb', line 51

def title_code
  berkeleyEduPersonJobApptTitleCode
end

#wos?Boolean

Returns true if appointment is Without Salary

Returns:

  • (Boolean)


60
61
62
# File 'lib/ucb_ldap/job_appointment.rb', line 60

def wos?
  berkeleyEduPersonJobApptWOS
end