Module: SocialAuth

Extended by:
ActiveSupport::Autoload
Defined in:
lib/social_auth.rb,
lib/social_auth/engine.rb,
lib/social_auth/railtie.rb,
lib/social_auth/version.rb,
app/models/social_auth/service.rb,
lib/social_auth/acts_as_social_user.rb,
app/models/social_auth/twitter_service.rb,
app/models/social_auth/facebook_service.rb,
app/models/social_auth/google_plus_service.rb

Defined Under Namespace

Modules: ActsAsSocialUser Classes: BadRequest, Engine, Error, FacebookService, GooglePlusService, InstallGenerator, InvalidToken, Railtie, RateLimitExceeded, Service, ServiceDoesNotExist, TwitterService

Constant Summary collapse

VERSION =
"0.0.13"
@@redis_instance_method =
nil
@@twitter_consumer_key =
nil
@@twitter_consumer_secret =
nil
@@google_client_id =
nil
@@google_client_secret =
nil
@@google_redirect_uri =
nil
@@google_api_key =
nil

Class Method Summary collapse

Class Method Details

.authenticate(type, auth_token) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/social_auth.rb', line 35

def self.authenticate(type, auth_token)
  case type.camelize
  when "Facebook"
    FacebookService.init_with(auth_token)
  when "Twitter"
    TwitterService.init_with(auth_token)
  when "GooglePlus"
    GooglePlusService.init_with(auth_token)
  end
end

.connect(user, type, auth_token, method = "Connected") ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/social_auth.rb', line 46

def self.connect(user, type, auth_token, method="Connected")
  case type.camelize
  when "Facebook"
    FacebookService.connect_with(user, auth_token, method)
  when "Twitter"
    TwitterService.connect_with(user, auth_token, method)
  when "GooglePlus"
    GooglePlusService.connect_with(user, auth_token, method)
  end
end

.disconnect(user, type) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'lib/social_auth.rb', line 57

def self.disconnect(user, type)
  case type.camelize
  when "Facebook"
    FacebookService.disconnect_user(user)
  when "Twitter"
    TwitterService.disconnect_user(user)
  when "GooglePlus"
    GooglePlusService.disconnect_user(user)
  end
end

.setup {|_self| ... } ⇒ Object

Used to set up Social Login from the initializer.

Yields:

  • (_self)

Yield Parameters:

  • _self (SocialAuth)

    the object that the method was called on



31
32
33
# File 'lib/social_auth.rb', line 31

def self.setup
  yield self
end