Created
June 7, 2013 15:20
-
-
Save mindreframer/5730042 to your computer and use it in GitHub Desktop.
Read your contacts from gmail with ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gem install contacts | |
# >> remove "require 'jcode' " in gdata gem, if on ruby 1.9 | |
require 'rubygems' | |
require 'contacts' | |
CONTACTS_SCOPE = 'http://www.google.com/m8/feeds/' | |
CONTACTS_FEED = CONTACTS_SCOPE + 'contacts/default/full/?max-results=1000' | |
@client = GData::Client::Contacts.new | |
@client.clientlogin("[email protected]", "MY_PASS") | |
feed = @client.get(CONTACTS_FEED).to_xml; nil | |
# make it pretty :) | |
formatter = REXML::Formatters::Pretty.new | |
formatter.compact = true | |
puts formatter.write(feed.root,"") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment