Class: User Abstract

Inherits:
Object
  • Object
show all
Defined in:
app/models/user.rb

Overview

This class is abstract.

The information all Users of the system have, such as name and e-mail.

Direct Known Subclasses

Provider

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (String) email

Returns the e-mail of the User.

Returns:

  • (String)

    the e-mail of the User.



9
10
11
# File 'app/models/user.rb', line 9

def email
  @email
end

- (String) name

Returns the name of the User.

Returns:

  • (String)

    the name of the User.



6
7
8
# File 'app/models/user.rb', line 6

def name
  @name
end

- (String) password_digest

Returns the password digest of the User used in authentication.

Returns:

  • (String)

    the password digest of the User used in authentication.



12
13
14
# File 'app/models/user.rb', line 12

def password_digest
  @password_digest
end

- (UserState) state

Returns the state of the User.

Returns:



15
16
17
# File 'app/models/user.rb', line 15

def state
  @state
end

Class Method Details

+ (User) login(email, password)

Login the User in the system.

If the e-mail isn't found, or the password doesn't match, fail.

Parameters:

  • email (String)

    the e-mail of the User.

  • password (String)

    the password given for the login, which is supposed to be hashed and compared with the password digest.

Returns:

  • (User)

    the User for the given e-mail and password.



33
34
# File 'app/models/user.rb', line 33

def self. email, password
end

Instance Method Details

- (Boolean) signup

Sign up the User to the system.

If the User is already on the system, do nothing.

Returns:

  • (Boolean)

    whether the user was signed up.



22
23
# File 'app/models/user.rb', line 22

def 
end