Class: Unit::Types::AuthorizedUser

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/types/authorized_user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(full_name, email, phone, jwt_subject = nil) ⇒ AuthorizedUser

Returns a new instance of AuthorizedUser.

Parameters:



14
15
16
17
18
19
# File 'lib/unit/types/authorized_user.rb', line 14

def initialize(full_name, email, phone, jwt_subject = nil)
  @full_name = full_name
  @email = email
  @phone = phone
  @jwt_subject = jwt_subject
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/unit/types/authorized_user.rb', line 8

def email
  @email
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



8
9
10
# File 'lib/unit/types/authorized_user.rb', line 8

def full_name
  @full_name
end

#jwt_subjectObject (readonly)

Returns the value of attribute jwt_subject.



8
9
10
# File 'lib/unit/types/authorized_user.rb', line 8

def jwt_subject
  @jwt_subject
end

#phoneObject (readonly)

Returns the value of attribute phone.



8
9
10
# File 'lib/unit/types/authorized_user.rb', line 8

def phone
  @phone
end

Instance Method Details

#representObject



21
22
23
24
25
26
27
28
29
# File 'lib/unit/types/authorized_user.rb', line 21

def represent
  payload = {
    fullName: full_name.represent,
    email: email,
    phone: phone.represent,
    jwtSubject: jwt_subject
  }
  payload.compact
end