Module: EasyAuth

Defined in:
lib/easy_auth/oauth.rb,
lib/easy_auth/oauth/version.rb

Defined Under Namespace

Modules: Models, Oauth

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.oauthObject

Returns the value of attribute oauth.



41
42
43
# File 'lib/easy_auth/oauth.rb', line 41

def oauth
  @oauth
end

Class Method Details

.oauth_client(provider, client_id, secret, scope = '') ⇒ Object



46
47
48
# File 'lib/easy_auth/oauth.rb', line 46

def self.oauth_client(provider, client_id, secret, scope = '')
  oauth[provider] = OpenStruct.new :client_id => client_id, :secret => secret, :scope => scope || ''
end

.oauth_identity_model(params) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/easy_auth/oauth.rb', line 28

def self.oauth_identity_model(params)
  method_name = "oauth_#{params[:provider]}_identity_model"
  camelcased_provider_name = params[:provider].to_s.camelcase
  if respond_to?(method_name)
    send(method_name, params)
  elsif eval("::Identities::Oauth::#{camelcased_provider_name} rescue nil")
    eval("::Identities::Oauth::#{camelcased_provider_name}")
  else
    camelcased_provider_name.constantize
  end
end