Module: GoogleAuthentication

Defined in:
lib/google_authentication.rb,
lib/google_authentication/engine.rb,
lib/google_authentication/version.rb,
lib/google_authentication/acts_as_google_user.rb,
lib/generators/google_authentication/install_generator.rb,
lib/generators/google_authentication/google_authentication_generator.rb

Overview

Main module for the gem

Defined Under Namespace

Modules: ActsAsGoogleUser, Generators Classes: Engine

Constant Summary collapse

VERSION =
'0.3.0'
@@domain =

default value for google domain used for authentication

"gmail.com"
@@model_name =

default model used (singular name)

:user

Class Method Summary collapse

Class Method Details

.define_routes?bool

Used in the routes file to decide wheter to add routes to the application

Returns:

  • (bool)

    true iff the GoogleAuthentication model is already defined



33
34
35
36
37
38
39
40
# File 'lib/google_authentication.rb', line 33

def self.define_routes?
  begin
    Object.const_get(model_name.to_s.camelize)
  rescue NameError
    return false
  end
  return true
end

.devise_tableSymbol

Return a symbol which is used to build devise routes

Returns:

  • (Symbol)

    a symbol representing the table name used by devise



44
45
46
# File 'lib/google_authentication.rb', line 44

def self.devise_table
  model_name.to_s.pluralize.to_sym
end

.setup {|self| ... } ⇒ Object

Allows config in initializer

Examples:

Changing the authentication setup

GoogleAuthentication.setup do |config|
  config.domain = 'your-google-apps-domain.com'
  config.model_name = :account
end

Yields:

  • (self)

    Allows config in initializer using the same syntax as Devise

Yield Parameters:



26
27
28
# File 'lib/google_authentication.rb', line 26

def self.setup
  yield self
end