Class: Kuroko2::User

Inherits:
ApplicationRecord show all
Includes:
TableNameCustomizable
Defined in:
app/models/kuroko2/user.rb

Constant Summary collapse

GRAVATAR_URL =
'//www.gravatar.com/avatar/%s?s=90&d=mm'
GOOGLE_OAUTH2_PROVIDER =
'google_oauth2'
GROUP_PROVIDER =
'group_mail'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_or_create_user(uid, attributes) ⇒ Object



25
26
27
28
29
30
31
32
# File 'app/models/kuroko2/user.rb', line 25

def self.find_or_create_user(uid, attributes)
  find_or_create_by(uid: uid) do |user|
    user.name       = attributes[:name]
    user.email      = attributes[:email]
    user.first_name = attributes[:first_name]
    user.last_name  = attributes[:last_name]
  end
end

Instance Method Details

#google_account?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'app/models/kuroko2/user.rb', line 34

def google_account?
  self.provider == GOOGLE_OAUTH2_PROVIDER
end