Skip to content

Instantly share code, notes, and snippets.

@jasdeepsingh
Created November 3, 2011 00:11
Show Gist options
  • Save jasdeepsingh/1335385 to your computer and use it in GitHub Desktop.
Save jasdeepsingh/1335385 to your computer and use it in GitHub Desktop.
Contacts Controller
class ContactsController < ApplicationController
before_filter :check_unauthorized , :only => [:make_friend_request, :confirm_friend_request, :change_contact_type]
before_filter :decode_data , :only => [:make_friend_request, :confirm_friend_request, :change_contact_type]
before_filter :check_expired_friend_requests , :only => [:get_contacts]
def confirm_friend_request
response = FriendRequest.confirm_friend_request(@data["user_key"], session[:user_key], @data["status"], session[:authorization_type], @data["encrypt_key"])
render :json => response
end
def make_friend_request
response = FriendRequest.send_friend_request(@data["pin"], session[:user_key], session[:authorization_type], @data['name'], @data["ttl"], @data["encrypt_key"])
render :json => response
end
def change_contact_type
response = Contact.change_contact_type(session[:user_key], session[:authorization_type], @data["user_key"], @data["action"])
render :json => response
end
def get_contacts
contacts = Contact.get_contacts(session[:user_key], session[:authorization_type])
render :json => {"response" => {"contact_list" => contacts}}
end
#TEST
def test_make_friend_request
end
def test_confirm_friend_request
@customers = { :private => :private, :public => :public, :reject => :reject}
end
def test_change_contact_type
@customers = { :private => :private, :public => :public, :delete => :delete}
end
def test_get_contacts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment