title: Import google contacts into a rails app
body: <p>I want to import google contacts into my rails app.</p>
  
  <p>First of all how dare Google didnt include a sample code for Ruby here,</p>
  
  <p><a href="https://developers.google.com/google-apps/contacts/v3/?csw=1" rel="nofollow">https://developers.google.com/google-apps/contacts/v3/?csw=1</a></p>
  
  <p>Second of all, </p>
  
  <p>If you use omnicontacts, <a href="https://github.com/Diego81/omnicontacts" rel="nofollow">https://github.com/Diego81/omnicontacts</a>, it wont fetch the phone_number, city, country and other things(only first_name and last_name)</p>
  
  <p>Third,</p>
  
  <p>This solution is a bit famous if you do the googling, <a href="http://rtdptech.com/2010/12/importing-gmail-contacts-list-to-rails-application/" rel="nofollow">http://rtdptech.com/2010/12/importing-gmail-contacts-list-to-rails-application/</a> it wont work for me. </p>
  
  <p>Fourth,</p>
  
  <p>It was easy to import google calendar events with omniauth gem, with the following good piece of code,</p>
  
  <pre><code>def action_after_callback
  # After authenticating and hitting callback redirect url, which will route to this action.
  @auth = request.env["omniauth.auth"]
  #Use the token from the data to request a list of calendars
  @token = @auth["credentials"]["token"]
  client = Google::APIClient.new
  client.authorization.access_token = @token
  service = client.discovered_api('calendar', 'v3')
  @result = client.execute(
    :api_method =&gt; service.events.insert,
    :parameters =&gt; {'calendarId' =&gt; 'primary'},
    :body =&gt; JSON.dump(event),
    :headers =&gt; {'Content-Type' =&gt; 'application/json'})
  p @result.data
  end
  </code></pre>
  
  <p>API DISCOVERY is not available for contacts I heard from googling.</p>
  
  <p>So someone help me whats the best way?</p>