Class: OpenStax::Accounts::Account

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/openstax/accounts/account.rb

Direct Known Subclasses

AnonymousAccount

Constant Summary collapse

USERNAME_DISCARDED_CHAR_REGEX =
/[^A-Za-z\d_]/
USERNAME_MAX_LENGTH =
50

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#syncingObject

Returns the value of attribute syncing.



7
8
9
# File 'app/models/openstax/accounts/account.rb', line 7

def syncing
  @syncing
end

Instance Method Details

#casual_nameObject



37
38
39
# File 'app/models/openstax/accounts/account.rb', line 37

def casual_name
  first_name || username
end

#has_authenticated?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'app/models/openstax/accounts/account.rb', line 45

def has_authenticated?
  !access_token.nil?
end

#is_anonymous?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/openstax/accounts/account.rb', line 41

def is_anonymous?
  false
end

#nameObject



33
34
35
# File 'app/models/openstax/accounts/account.rb', line 33

def name
  (first_name || last_name) ? [first_name, last_name].compact.join(" ") : username
end