muck-oauth 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.9
1
+ 0.1.11
@@ -2,14 +2,37 @@ module MuckOauthHelper
2
2
 
3
3
  # Generates a javascript array of emails from gmail. Values will be
4
4
  # put into a variable named 'gmail_contacts'
5
- def gmail_contacts_for_auto_complete(user)
5
+ def gmail_contacts_for_auto_complete(user, ignore_cache = false)
6
6
  return unless user.google
7
- contacts = user.google.portable_contacts.all.collect do |contact|
7
+ contacts = gmail_contacts(user, ignore_cache).collect do |contact|
8
8
  contact["emails"].collect{ |email| "'#{email['value']}'" }
9
9
  end.flatten
10
10
  "var gmail_contacts = [#{contacts.join(',')}];"
11
11
  end
12
12
 
13
+ def gmail_contacts_as_array(user, ignore_cache = false)
14
+ if user.google
15
+ contacts = []
16
+ gmail_contacts(user, ignore_cache).each do |contact|
17
+ name = contact['name']['formatted'] rescue ''
18
+ contact["emails"].each do |email|
19
+ email_record = [name, email['value']]
20
+ contacts << email_record unless contacts.include?(email_record)
21
+ end
22
+ end
23
+ contacts
24
+ end
25
+ end
26
+
27
+ def gmail_contacts(user, ignore_cache = false)
28
+ if @user_gmail_contacts && @user_gmail_contacts[user] && !ignore_cache
29
+ @user_gmail_contacts[user]
30
+ else
31
+ @user_gmail_contacts ||= {}
32
+ @user_gmail_contacts[user] = user.google.portable_contacts.all
33
+ end
34
+ end
35
+
13
36
  # Renders fancybox javascript for oauth services
14
37
  def oauth_fancybox_scripts
15
38
  render :partial => 'oauth_consumers/oauth_fancybox_scripts'
data/muck-oauth.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-oauth}
8
- s.version = "0.1.9"
8
+ s.version = "0.1.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball"]
12
- s.date = %q{2010-03-22}
12
+ s.date = %q{2010-04-08}
13
13
  s.description = %q{A simple wrapper for the oauth and oauth-plugin gems so that it is faster to include oauth in muck based applications.}
14
14
  s.email = %q{justin@tatemae.com}
15
15
  s.extra_rdoc_files = [
@@ -3,10 +3,6 @@ class User < ActiveRecord::Base
3
3
  c.crypto_provider = Authlogic::CryptoProviders::BCrypt
4
4
  end
5
5
  acts_as_muck_user
6
-
7
- has_many :client_applications
8
- has_many :tokens, :class_name => "OauthToken", :order => "authorized_at desc", :include => [:client_application]
9
-
10
- has_one :twitter_token, :class_name => "TwitterToken", :dependent => :destroy
6
+ acts_as_muck_oauth_user
11
7
 
12
8
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 9
9
- version: 0.1.9
8
+ - 11
9
+ version: 0.1.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Justin Ball
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-22 00:00:00 -06:00
17
+ date: 2010-04-08 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency