class GitContacts::User
Public Class Methods
all()
click to toggle source
# File lib/gitcontacts/User.rb, line 16 def self::all UserObject::all end
create(hash)
click to toggle source
# File lib/gitcontacts/User.rb, line 9 def self::create hash # some keys are optional obj = UserObject.new obj.set_email hash[:email] obj.password = Digest::MD5.hexdigest(hash[:password]) end
exist?(email)
click to toggle source
# File lib/gitcontacts/User.rb, line 5 def self::exist? email UserObject::exist?(email) end
new(email)
click to toggle source
# File lib/gitcontacts/User.rb, line 20 def initialize email @email = email @obj = UserObject::access email end
Public Instance Methods
add_contacts(gid)
click to toggle source
# File lib/gitcontacts/User.rb, line 67 def add_contacts gid @obj.contacts << gid if @obj end
add_request(request_id)
click to toggle source
# File lib/gitcontacts/User.rb, line 75 def add_request request_id @obj.requests << request_id if @obj end
getcontacts()
click to toggle source
# File lib/gitcontacts/User.rb, line 42 def getcontacts @obj.contacts.members if @obj end
getemail()
click to toggle source
def getname
@obj.name.value if @obj
end
# File lib/gitcontacts/User.rb, line 33 def getemail #@obj.email if @obj @email end
getinfo()
click to toggle source
# File lib/gitcontacts/User.rb, line 50 def getinfo { :uid => getuid, :email => getemail, :contacts => getcontacts, :request => getrequests } end
getpassword()
click to toggle source
# File lib/gitcontacts/User.rb, line 38 def getpassword @obj.password.value if @obj end
getrequests()
click to toggle source
# File lib/gitcontacts/User.rb, line 46 def getrequests @obj.requests.members if @obj end
getuid()
click to toggle source
# File lib/gitcontacts/User.rb, line 25 def getuid getemail end
password_correct?(sha)
click to toggle source
# File lib/gitcontacts/User.rb, line 59 def password_correct? sha sha == getpassword && sha != nil && sha != "" end
remove_contacts(gid)
click to toggle source
# File lib/gitcontacts/User.rb, line 71 def remove_contacts gid @obj.contacts.delete gid if @obj end
remove_request(request_id)
click to toggle source
# File lib/gitcontacts/User.rb, line 79 def remove_request request_id @obj.requests.delete request_id if @obj end
set_password(sha)
click to toggle source
# File lib/gitcontacts/User.rb, line 63 def set_password sha @obj.password = sha if sha != nil && sha != "" end