class UCB::LDAP::Address

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.

Public Class Methods

find_by_uid(uid) click to toggle source

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

# 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

Public Instance Methods

address_type() click to toggle source
# File lib/ucb_ldap/address.rb, line 27
def address_type
  warn "DEPRECATED: address_type is no longer supported"
  []
end
building_code() click to toggle source
# File lib/ucb_ldap/address.rb, line 32
def building_code
  warn "DEPRECATED: building_code is no longer supported"
  []
end
city() click to toggle source
# File lib/ucb_ldap/address.rb, line 37
def city
  l.first
end
country_code() click to toggle source
# File lib/ucb_ldap/address.rb, line 41
def country_code
  warn "DEPRECATED: country_code is no longer supported"
  []
end
department_acronym() click to toggle source
# File lib/ucb_ldap/address.rb, line 51
def department_acronym
  berkeleyEduPersonAddressUnitHRDeptName
end
department_name() click to toggle source
# File lib/ucb_ldap/address.rb, line 46
def department_name
  warn "DEPRECATED: department_name is no longer supported"
  []
end
directories() click to toggle source
# File lib/ucb_ldap/address.rb, line 55
def directories
  warn "DEPRECATED: directories is no longer supported"
  []
end
email() click to toggle source

Returns email address associated with this Address.

# File lib/ucb_ldap/address.rb, line 61
def email
  mail.first
end
mail_code() click to toggle source
# File lib/ucb_ldap/address.rb, line 65
def mail_code
  berkeleyEduPersonAddressMailCode
end
mail_release?() click to toggle source
# File lib/ucb_ldap/address.rb, line 69
def mail_release?
  berkeleyEduEmailRelFlag
end
phone() click to toggle source
# File lib/ucb_ldap/address.rb, line 73
def phone
  telephoneNumber.first
end
postal_address() click to toggle source

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']
# File lib/ucb_ldap/address.rb, line 82
def postal_address
  postalAddress == [] ? nil : postalAddress.split("$")
end
primary_work_address?() click to toggle source
# File lib/ucb_ldap/address.rb, line 23
def primary_work_address?
  berkeleyEduPersonAddressPrimaryFlag
end
sort_order() click to toggle source
# File lib/ucb_ldap/address.rb, line 86
def sort_order
  warn "DEPRECATED: sort_order is no longer supported"
  0
end
state() click to toggle source
# File lib/ucb_ldap/address.rb, line 91
def state
  st.first
end
zip() click to toggle source
# File lib/ucb_ldap/address.rb, line 95
def zip
  postalCode
end