Class: UCB::LDAP::Address
- Inherits:
-
Entry
- Object
- Entry
- UCB::LDAP::Address
show all
- Defined in:
- lib/ucb_ldap_address.rb
Overview
UCB::LDAP::Address
This class models a person address instance in the UCB LDAP directory.
a = Address.find_by_uid("1234")
Addresses are usually loaded through a Person instance:
p = Person.find_by_uid("1234") addrs = p.addresses
Note on Binds
You must have a privileged bind and pass your credentials to UCB::LDAP.authenticate() before performing your Address search.
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, find_by_dn, #initialize, make_search_filter, #method_missing, #modify, #modify_operations, #net_ldap, net_ldap, object_classes, 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
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 Address for uid
, sorted by sort_order(). Returns an empty Array ([]) if nothing is found.
97
98
99
100
101
|
# File 'lib/ucb_ldap_address.rb', line 97
def find_by_uid(uid)
base = "uid=#{uid},ou=people,dc=berkeley,dc=edu"
filter = Net::LDAP::Filter.eq("objectclass", 'berkeleyEduPersonAddress')
search(:base => base, :filter => filter).sort_by{|addr| addr.sort_order}
end
|
Instance Method Details
#address_type ⇒ Object
27
28
29
|
# File 'lib/ucb_ldap_address.rb', line 27
def address_type
berkeleyEduPersonAddressType
end
|
#building_code ⇒ Object
31
32
33
|
# File 'lib/ucb_ldap_address.rb', line 31
def building_code
berkeleyEduPersonAddressBuildingCode
end
|
#city ⇒ Object
35
36
37
|
# File 'lib/ucb_ldap_address.rb', line 35
def city
l.first
end
|
#country_code ⇒ Object
39
40
41
|
# File 'lib/ucb_ldap_address.rb', line 39
def country_code
berkeleyEduPersonAddressCountryCode
end
|
#department_acronym ⇒ Object
47
48
49
|
# File 'lib/ucb_ldap_address.rb', line 47
def department_acronym
berkeleyEduPersonAddressUnitHRDeptName
end
|
#department_name ⇒ Object
43
44
45
|
# File 'lib/ucb_ldap_address.rb', line 43
def department_name
berkeleyEduPersonAddressUnitCalNetDeptName
end
|
#directories ⇒ Object
51
52
53
|
# File 'lib/ucb_ldap_address.rb', line 51
def directories
berkeleyEduPersonAddressPublications
end
|
#email ⇒ Object
Returns email address associated with this Address.
56
57
58
|
# File 'lib/ucb_ldap_address.rb', line 56
def email
mail.first
end
|
#mail_code ⇒ Object
60
61
62
|
# File 'lib/ucb_ldap_address.rb', line 60
def mail_code
berkeleyEduPersonAddressMailCode
end
|
#mail_release? ⇒ Boolean
64
65
66
|
# File 'lib/ucb_ldap_address.rb', line 64
def mail_release?
berkeleyEduEmailRelFlag
end
|
#phone ⇒ Object
68
69
70
|
# File 'lib/ucb_ldap_address.rb', line 68
def phone
telephoneNumber.first
end
|
#postal_address ⇒ Object
Returns postal address as an Array.
addr.attribute(:postalAddress) addr.postal_address
77
78
79
|
# File 'lib/ucb_ldap_address.rb', line 77
def postal_address
postalAddress == [] ? nil : postalAddress.split("$")
end
|
#primary_work_address? ⇒ Boolean
23
24
25
|
# File 'lib/ucb_ldap_address.rb', line 23
def primary_work_address?
berkeleyEduPersonAddressPrimaryFlag
end
|
#sort_order ⇒ Object
81
82
83
|
# File 'lib/ucb_ldap_address.rb', line 81
def sort_order
berkeleyEduPersonAddressSortOrder.first || 0
end
|
#state ⇒ Object
85
86
87
|
# File 'lib/ucb_ldap_address.rb', line 85
def state
st.first
end
|
#zip ⇒ Object
89
90
91
|
# File 'lib/ucb_ldap_address.rb', line 89
def zip
postalCode
end
|