class GitContacts::Contacts
Public Class Methods
create(uid, hash)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 9 def self::create uid, hash # some keys are optional gid = Gitdb::Contacts.new(uid).create(hash[:name]).getmeta[:gid] obj = ContactsObject.new obj.set_gid gid obj.name = hash[:name] obj.note = hash[:note] if hash.has_key?(:note) obj.users << uid obj.admins << uid gid end
exist?(gid)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 5 def self::exist? gid true if ContactsObject::exist?(gid) end
new(gid)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 21 def initialize gid @obj = ContactsObject::access gid end
Public Instance Methods
add_admin(uid)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 45 def add_admin uid @obj.admins << uid if @obj end
add_request(request_id)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 49 def add_request request_id @obj.requests << request_id if @obj end
add_user(uid)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 41 def add_user uid @obj.users << uid if @obj end
getadmins()
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 33 def getadmins @obj.admins if @obj end
getgid()
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 25 def getgid @obj.gid if @obj end
getrequests()
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 37 def getrequests @obj.requests if @obj end
getusers()
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 29 def getusers @obj.users if @obj end
remove_admin(uid)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 57 def remove_admin uid @obj.admins.delete(uid) if @obj end
remove_request(request_id)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 61 def remove_request request_id @obj.requests.delete request_id if @obj end
remove_user(uid)
click to toggle source
# File lib/gitcontacts/Contacts.rb, line 53 def remove_user uid @obj.users.delete(uid) if @obj end