Class: AuctionFunCore::Entities::User

Inherits:
ROM::Struct
  • Object
show all
Defined in:
lib/auction_fun_core/entities/user.rb

Overview

Defines the User class as Entity. It appears to be a simple data structure class representing user-related information.

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Checks if the user is active.

Returns:

  • (Boolean)

    True if the user is active, otherwise false.



13
14
15
# File 'lib/auction_fun_core/entities/user.rb', line 13

def active?
  active
end

#balanceMoney

Returns the user’s balance as a Money object.

Returns:

  • (Money)

    User’s balance.



61
62
63
# File 'lib/auction_fun_core/entities/user.rb', line 61

def balance
  Money.new(balance_cents, balance_currency)
end

#confirmed?Boolean

Checks if the user has been confirmed.

Returns:

  • (Boolean)

    True if the user is confirmed, otherwise false.



29
30
31
# File 'lib/auction_fun_core/entities/user.rb', line 29

def confirmed?
  confirmed_at.present?
end

#email_confirmed?Boolean

Checks if the user’s email has been confirmed.

Returns:

  • (Boolean)

    True if the email is confirmed, otherwise false.



37
38
39
# File 'lib/auction_fun_core/entities/user.rb', line 37

def email_confirmed?
  email_confirmation_at.present?
end

#inactive?Boolean

Checks if the user is inactive.

Returns:

  • (Boolean)

    True if the user is inactive, otherwise false.



21
22
23
# File 'lib/auction_fun_core/entities/user.rb', line 21

def inactive?
  !active
end

#infoHash

Returns user information excluding password digest.

Returns:

  • (Hash)

    User information.



53
54
55
# File 'lib/auction_fun_core/entities/user.rb', line 53

def info
  attributes.except(:password_digest)
end

#phone_confirmed?Boolean

Checks if the user’s phone has been confirmed.

Returns:

  • (Boolean)

    True if the phone is confirmed, otherwise false.



45
46
47
# File 'lib/auction_fun_core/entities/user.rb', line 45

def phone_confirmed?
  phone_confirmation_at.present?
end