Class: UCB::LDAP::Address

Inherits:
Entry
  • Object
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")       #=> [#<UCB::LDAP::Address: ...>, ...]

Addresses are usually loaded through a Person instance:

p = Person.find_by_uid("1234")    #=> #<UCB::LDAP::Person: ...>
addrs = p.addresses               #=> [#<UCB::LDAP::Address: ...>, ...]

Note on Binds

You must have a privileged bind and pass your credentials to UCB::LDAP.authenticate() before performing your Address 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!, #dn, entity_name, filter_in, find_by_dn, #initialize, make_search_filter, #method_missing, net_ldap, #net_ldap, object_classes, required_attributes, required_schema_attributes, schema_attribute, schema_attributes_array, schema_attributes_hash, search, set_schema_attributes, tree_base, tree_base=, unique_object_class

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 Address for uid, sorted by sort_order(). Returns an empty Array ([]) if nothing is found.



103
104
105
106
# File 'lib/ucb_ldap/address.rb', line 103

def find_by_uid(uid)
  warn "DEPRECATED: Addresses are no longer supported by LDAP. This method will always return an empty Array"
  []
end

Instance Method Details

#address_typeObject



27
28
29
30
# File 'lib/ucb_ldap/address.rb', line 27

def address_type
  warn "DEPRECATED: address_type is no longer supported"
  []
end

#building_codeObject



32
33
34
35
# File 'lib/ucb_ldap/address.rb', line 32

def building_code
  warn "DEPRECATED: building_code is no longer supported"
  []
end

#cityObject



37
38
39
# File 'lib/ucb_ldap/address.rb', line 37

def city
  l.first
end

#country_codeObject



41
42
43
44
# File 'lib/ucb_ldap/address.rb', line 41

def country_code
  warn "DEPRECATED: country_code is no longer supported"
  []
end

#department_acronymObject



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

def department_acronym
  berkeleyEduPersonAddressUnitHRDeptName
end

#department_nameObject



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

def department_name
  warn "DEPRECATED: department_name is no longer supported"
  []
end

#directoriesObject



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

def directories
  warn "DEPRECATED: directories is no longer supported"
  []
end

#emailObject

Returns email address associated with this Address.



61
62
63
# File 'lib/ucb_ldap/address.rb', line 61

def email
  mail.first
end

#mail_codeObject



65
66
67
# File 'lib/ucb_ldap/address.rb', line 65

def mail_code
  berkeleyEduPersonAddressMailCode
end

#mail_release?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/ucb_ldap/address.rb', line 69

def mail_release?
  berkeleyEduEmailRelFlag
end

#phoneObject



73
74
75
# File 'lib/ucb_ldap/address.rb', line 73

def phone
  telephoneNumber.first
end

#postal_addressObject

Returns postal address as an Array.

addr.attribute(:postalAddress) #=> '501 Banway Bldg.$Berkeley, CA 94720-3814$USA'
addr.postal_address            #=> ['501 Banway Bldg.', 'Berkeley, CA 94720-3814', 'USA']


82
83
84
# File 'lib/ucb_ldap/address.rb', line 82

def postal_address
  postalAddress == [] ? nil : postalAddress.split("$")
end

#primary_work_address?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/ucb_ldap/address.rb', line 23

def primary_work_address?
  berkeleyEduPersonAddressPrimaryFlag
end

#sort_orderObject



86
87
88
89
# File 'lib/ucb_ldap/address.rb', line 86

def sort_order
  warn "DEPRECATED: sort_order is no longer supported"
  0
end

#stateObject



91
92
93
# File 'lib/ucb_ldap/address.rb', line 91

def state
  st.first
end

#zipObject



95
96
97
# File 'lib/ucb_ldap/address.rb', line 95

def zip
  postalCode
end