Last active
August 29, 2015 14:06
-
-
Save vinhnglx/2963a4e17b928161ac43 to your computer and use it in GitHub Desktop.
Using Omnicontacts to get mail contacts from Google ref: http://qiita.com/vinhnguyenleasnet/items/53ade9f730d21a7a84d4
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
<% unless @contacts.nil?%> | |
<% @contacts.each do |c|%> | |
<ul> | |
<li><%= c[:name]%> : <%= c[:email]%></li> | |
</ul> | |
<%end%> | |
<%end%> |
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
mkdir omnicontacts | |
cd omnicontacts/ | |
rails new . |
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 'omnicontacts' |
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 'omnicontacts' |
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
class MainController < ApplicationController | |
def index | |
end | |
def contact | |
end | |
end |
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
class MainController < ApplicationController | |
def index | |
end | |
def contact | |
end | |
end |
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
require 'omnicontacts' | |
Rails.application.middleware.use OmniContacts::Builder do | |
importer :gmail, "client_id", "client_secret, {:redirect_path => "/oauth2callback", :ssl_ca_path => "/etc/ssl/certs/curl-ca-bundle.crt"} | |
end |
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
require 'omnicontacts' | |
Rails.application.middleware.use OmniContacts::Builder do | |
importer :gmail, "client_id", "client_secret, {:redirect_path => "/oauth2callback", :ssl_ca_path => "/etc/ssl/certs/curl-ca-bundle.crt"} | |
end |
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
Omnicontacts::Application.routes.draw do | |
match "/contacts/:importer/callback" => "main#index", :via => [:get] | |
match "/oauth2callback" => "main#contact", :via => [:get] | |
# You can have the root of your site routed with "root" | |
root 'main#index' | |
end |
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
Omnicontacts::Application.routes.draw do | |
match "/contacts/:importer/callback" => "main#index", :via => [:get] | |
match "/oauth2callback" => "main#contact", :via => [:get] | |
# You can have the root of your site routed with "root" | |
root 'main#index' | |
end |
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
class MainController < ApplicationController | |
def index | |
end | |
def contact | |
@contacts = request.env['omnicontacts.contacts'] | |
respond_to do |format| | |
format.html | |
end | |
end | |
end |
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
<h2>OmniContacts Example</h2> | |
<a href="/contacts/gmail">Gmail</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment