Class: V1::User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/people/v1/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.over_max_attempts?(attempts) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
# File 'app/models/people/v1/user.rb', line 45

def self.over_max_attempts?(attempts)
  if attempts > 20
    return true
  else
    return false
  end
end

Instance Method Details

#create_tokenObject



40
41
42
43
# File 'app/models/people/v1/user.rb', line 40

def create_token
  self.tokens.create!
  return true
end

#sanitize_attributesObject

Might need a regex for emails, or just rather confirm them



22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/models/people/v1/user.rb', line 22

def sanitize_attributes
  if self.locked.nil?
    self.locked = false
  end
  if self.confirmed.nil?
    self.confirmed = false
  end
  if self.attempts.nil?
    self.attempts = 0
  end
  return true
end

#setup_userObject



35
36
37
38
# File 'app/models/people/v1/user.rb', line 35

def setup_user
	create_token
  return true
end