Class: Aha::Auth::User

Inherits:
Object
  • Object
show all
Defined in:
lib/aha/auth/user.rb

Overview

Represents a user from the auth server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ User

Returns a new instance of User.



11
12
13
14
15
16
17
18
19
# File 'lib/aha/auth/user.rb', line 11

def initialize(attributes = {})
  @id = attributes["id"] || attributes[:id]
  @email = attributes["email"] || attributes[:email]
  @first_name = attributes["first_name"] || attributes[:first_name]
  @last_name = attributes["last_name"] || attributes[:last_name]
  @email_verified = attributes["email_verified"] || attributes[:email_verified]
  @created_at = parse_time(attributes["created_at"] || attributes[:created_at])
  @updated_at = parse_time(attributes["updated_at"] || attributes[:updated_at])
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



9
10
11
# File 'lib/aha/auth/user.rb', line 9

def created_at
  @created_at
end

#emailObject (readonly)

Returns the value of attribute email.



9
10
11
# File 'lib/aha/auth/user.rb', line 9

def email
  @email
end

#email_verifiedObject (readonly)

Returns the value of attribute email_verified.



9
10
11
# File 'lib/aha/auth/user.rb', line 9

def email_verified
  @email_verified
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



9
10
11
# File 'lib/aha/auth/user.rb', line 9

def first_name
  @first_name
end

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/aha/auth/user.rb', line 9

def id
  @id
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



9
10
11
# File 'lib/aha/auth/user.rb', line 9

def last_name
  @last_name
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



9
10
11
# File 'lib/aha/auth/user.rb', line 9

def updated_at
  @updated_at
end

Instance Method Details

#full_nameObject



21
22
23
# File 'lib/aha/auth/user.rb', line 21

def full_name
  [first_name, last_name].compact.join(" ")
end