Class: Contacts::Provider::Google

Inherits:
OAuth
  • Object
show all
Defined in:
lib/contacts/provider/google.rb

Instance Method Summary collapse

Methods inherited from OAuth

#connect!, #consumer, inherited

Methods inherited from Base

all, #attributes, #attributes=, #connect!, #connection, #contacts, #contacts_response, #initialize, #parse_attributes, provider_id, #site_url, #valid_attributes, valid_attributes, valid_attributes=

Constructor Details

This class inherits a constructor from Contacts::Provider::Base

Instance Method Details

#parse_contacts!Object



10
11
12
13
14
15
16
# File 'lib/contacts/provider/google.rb', line 10

def parse_contacts!
  if contacts_response.code.to_i == 401
    raise "Error 401".inspect
  else
    @contacts = Nokogiri::XML(contacts_response.body).css("entry").map {|entry| Contacts::Contact::Google.parse(entry)}.compact 
  end
end

#retrieve_contacts!Object



6
7
8
# File 'lib/contacts/provider/google.rb', line 6

def retrieve_contacts!
  @contacts_response = connection.get("/m8/feeds/contacts/#{uid||'default'}/full?max-results=999")
end