Class: Leash::User

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

Overview

Simple value object representing an authenticated Leash user.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, email:, name: nil, picture: nil) ⇒ User

Returns a new instance of User.

Parameters:

  • id (String)
  • email (String)
  • name (String, nil) (defaults to: nil)
  • picture (String, nil) (defaults to: nil)


22
23
24
25
26
27
# File 'lib/leash/auth.rb', line 22

def initialize(id:, email:, name: nil, picture: nil)
  @id = id
  @email = email
  @name = name
  @picture = picture
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



16
17
18
# File 'lib/leash/auth.rb', line 16

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



16
17
18
# File 'lib/leash/auth.rb', line 16

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/leash/auth.rb', line 16

def name
  @name
end

#pictureObject (readonly)

Returns the value of attribute picture.



16
17
18
# File 'lib/leash/auth.rb', line 16

def picture
  @picture
end

Instance Method Details

#==(other) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/leash/auth.rb', line 29

def ==(other)
  other.is_a?(User) &&
    id == other.id &&
    email == other.email &&
    name == other.name &&
    picture == other.picture
end