Module: EasyAuth

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

Defined Under Namespace

Modules: Models, Oauth2

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.oauth2Object

Returns the value of attribute oauth2.



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

def oauth2
  @oauth2
end

Class Method Details

.oauth2_client(provider, client_id, secret) ⇒ Object



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

def self.oauth2_client(provider, client_id, secret)
  oauth2[provider] = OpenStruct.new :client_id => client_id, :secret => secret
end

.oauth2_identity_model(params) ⇒ Object



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

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