Module: VelirIdentityEngine::User::ClassMethods

Defined in:
lib/velir_identity_engine/user.rb

Instance Method Summary collapse

Instance Method Details

#approved_usersObject



40
# File 'lib/velir_identity_engine/user.rb', line 40

def approved_users ; where(:approved => true) end

#create_with_omniauth(auth) ⇒ User

Creates a valid record given an OmniAuth hash.

Parameters:

  • auth (Hash)

    Omniauth hash

Returns:

  • (User)

    Returns a user or raises an error.



30
31
32
33
34
35
36
37
38
# File 'lib/velir_identity_engine/user.rb', line 30

def create_with_omniauth(auth)
  user = self.new
  user.provider = auth["provider"]
  user.uid = auth["uid"]
  user.first_name = auth["user_info"]["name"].split(" ")[0]
  user.last_name = auth["user_info"]["name"].split(" ")[1]
  user.save!
  user
end

#unapproved_usersObject



41
# File 'lib/velir_identity_engine/user.rb', line 41

def unapproved_users ; where(:approved => false) end