few experiments…

This commit is contained in:
Harry Bomrah committed 2012-05-16 11:18:54 +08:00
1 parent 1a9fa8f505
commit 75cbae049b
3 files changed
+41 -4

No files matched your search

@@ -32,6 +32,7 @@ class OtheraccountsController< ApplicationController
@decrypted_password = @gmailaccount.first.encrypted_password.decrypt
@email = @gmailaccount.first.email
url = URI.parse("https://mail.google.com/mail/feed/atom")
#url = URI.parse("https://www.google.com/m8/feeds/contacts/default/full")
req = Net::HTTP::Get.new(url.path)
req.basic_auth @email, @decrypted_password
req.content_type = 'text/xml'
@@ -57,6 +58,16 @@ class OtheraccountsController< ApplicationController
# oauth_token = oauth.request_token.token
# oauth_secret = oauth.request_token.secret
#require File.dirname(__FILE__)+"/../lib/contacts"
@gmailaccount = OtherAccount.where(:type.all => ["gmail"],:user_id.all => [current_user.id]) rescue nil
if @gmailaccount.first != nil
login = @gmailaccount.first.encrypted_password.decrypt
password = @gmailaccount.first.email
@contacts = Contacts::Gmail.new(login, password).contacts
render :json => @contacts.to_json
end
end