gmail_contatos 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +38 -0
- data/app/controllers/gmail_contatos/contacts_controller.rb +1 -1
- data/config/routes.rb +3 -3
- data/lib/gmail_contatos/engine.rb +1 -1
- data/lib/gmail_contatos/helper.rb +1 -1
- data/lib/gmail_contatos/version.rb +1 -1
- metadata +40 -19
data/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---- Simples Gem para Sincronizar com Google Contact ----
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Instalação
|
|
5
|
+
|
|
6
|
+
adicione no Gemfile:
|
|
7
|
+
|
|
8
|
+
```ruby
|
|
9
|
+
gem "gmail_contatos"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
no controller que deseja usar os contatos do google adicione:
|
|
13
|
+
```ruby
|
|
14
|
+
before_filter :get_gmail_contatos, :only=>:index
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Obs: Na função que tiver o :only (nesse caso a index) o gmail_contatos retornará uma objetos @gcontatos que você pode usar
|
|
19
|
+
como quiser, essa variável tera uma Array de objetos do tipo Google::Contact que tem os seguintes atributos [nome, email].
|
|
20
|
+
|
|
21
|
+
Uma sugestão de uso para a view é:
|
|
22
|
+
```ruby
|
|
23
|
+
<table border=1>
|
|
24
|
+
<tr>
|
|
25
|
+
<th>Nome</th>
|
|
26
|
+
<th>email</th>
|
|
27
|
+
</tr>
|
|
28
|
+
|
|
29
|
+
<% @gcontatos.each do |c| %>
|
|
30
|
+
<tr>
|
|
31
|
+
<td><%= c.nome %></td>
|
|
32
|
+
<td><%= c.email %></td>
|
|
33
|
+
</tr>
|
|
34
|
+
<% end %>
|
|
35
|
+
</table>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Contribuições e dicas são bem vindas :D
|
|
@@ -3,7 +3,7 @@ module GmailContatos
|
|
|
3
3
|
class ContactsController < GmailContatos::ApplicationController
|
|
4
4
|
def new
|
|
5
5
|
# refatorar para funcionar com qualquer config de rota
|
|
6
|
-
redirect_to Google::Authorization.build_auth_url("http://#{request.env["HTTP_HOST"]}/
|
|
6
|
+
redirect_to Google::Authorization.build_auth_url("http://#{request.env["HTTP_HOST"]}/g_auth")
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def authorize
|
data/config/routes.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
get "
|
|
3
|
-
get "
|
|
1
|
+
Rails.application.routes.draw do |map|
|
|
2
|
+
get "g_auth" =>"gmail_contatos/contacts#authorize"
|
|
3
|
+
get "g_autorizar" => "gmail_contatos/contacts#new"
|
|
4
4
|
end
|
|
@@ -7,7 +7,7 @@ module GmailContatos
|
|
|
7
7
|
def get_gmail_contatos
|
|
8
8
|
unless params.member?(:gtoken) then
|
|
9
9
|
session[:back_url] = request.url.to_s
|
|
10
|
-
redirect_to "
|
|
10
|
+
redirect_to "g_autorizar"
|
|
11
11
|
else
|
|
12
12
|
puts "chamar".inspect
|
|
13
13
|
@gcontatos = Google::Contact.all(params["gtoken"])
|
metadata
CHANGED
|
@@ -1,24 +1,35 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gmail_contatos
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 31
|
|
5
5
|
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 1
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.1.2
|
|
6
11
|
platform: ruby
|
|
7
|
-
authors:
|
|
12
|
+
authors:
|
|
8
13
|
- Janderson F. Ferreira
|
|
9
14
|
autorequire:
|
|
10
15
|
bindir: bin
|
|
11
16
|
cert_chain: []
|
|
12
|
-
|
|
17
|
+
|
|
18
|
+
date: 2012-03-13 00:00:00 Z
|
|
13
19
|
dependencies: []
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
|
|
21
|
+
description: " Simples gem para sincronizar com Gmail Contatos "
|
|
22
|
+
email:
|
|
16
23
|
- ffjanderson@gmail.com
|
|
17
24
|
executables: []
|
|
25
|
+
|
|
18
26
|
extensions: []
|
|
27
|
+
|
|
19
28
|
extra_rdoc_files: []
|
|
20
|
-
|
|
29
|
+
|
|
30
|
+
files:
|
|
21
31
|
- Gemfile
|
|
32
|
+
- README.md
|
|
22
33
|
- Rakefile
|
|
23
34
|
- app/controllers/gmail_contatos/contacts_controller.rb
|
|
24
35
|
- config/routes.rb
|
|
@@ -30,26 +41,36 @@ files:
|
|
|
30
41
|
- lib/gmail_contatos/version.rb
|
|
31
42
|
homepage: https://github.com/Janderson/gmail_contatos
|
|
32
43
|
licenses: []
|
|
44
|
+
|
|
33
45
|
post_install_message:
|
|
34
46
|
rdoc_options: []
|
|
35
|
-
|
|
47
|
+
|
|
48
|
+
require_paths:
|
|
36
49
|
- lib
|
|
37
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
51
|
none: false
|
|
39
|
-
requirements:
|
|
40
|
-
- -
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
requirements:
|
|
53
|
+
- - ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
hash: 3
|
|
56
|
+
segments:
|
|
57
|
+
- 0
|
|
58
|
+
version: "0"
|
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
60
|
none: false
|
|
45
|
-
requirements:
|
|
46
|
-
- -
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
|
|
61
|
+
requirements:
|
|
62
|
+
- - ">="
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
hash: 3
|
|
65
|
+
segments:
|
|
66
|
+
- 0
|
|
67
|
+
version: "0"
|
|
49
68
|
requirements: []
|
|
69
|
+
|
|
50
70
|
rubyforge_project: gmail_contatos
|
|
51
71
|
rubygems_version: 1.8.15
|
|
52
72
|
signing_key:
|
|
53
73
|
specification_version: 3
|
|
54
74
|
summary: Simples gem para sincronizar com Gmail Contatos
|
|
55
75
|
test_files: []
|
|
76
|
+
|