Sha256: ba9c0460fdcb48da796b569c757b96373af3377236f5f8bb8f342172306a1c28
Contents?: true
Size: 958 Bytes
Versions: 1
Compression:
Stored size: 958 Bytes
Contents
require 'gdata' class Contacts class Gmail < Base CONTACTS_SCOPE = 'http://www.google.com/m8/feeds/' CONTACTS_FEED = CONTACTS_SCOPE + 'contacts/default/full/?max-results=1000' def contacts return @contacts if @contacts end def real_connect @client = GData::Client::Contacts.new @client.clientlogin(@login, @password, @options[:captcha_token], @options[:captcha_response]) feed = @client.get(CONTACTS_FEED).to_xml @contacts = feed.elements.to_a('entry').collect do |entry| title, email = entry.elements['title'].text, nil entry.elements.each('gd:email') do |e| email = e.attribute('address').value end [title, email] unless email.nil? end @contacts.compact! rescue GData::Client::AuthorizationError => e raise AuthenticationError, "Username or password are incorrect" end end TYPES[:gmail] = Gmail end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
muck-contacts-2.6.1 | lib/contacts/gmail.rb |