Class: Cassette::Authentication::User

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cassette/authentication/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ User

Returns a new instance of User.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cassette/authentication/user.rb', line 17

def initialize(attrs = {})
  config            = attrs[:config]
  @login            = attrs[:login]
  @name             = attrs[:name]
  @type             = attrs[:type]
  @email            = attrs[:email]
  @ticket           = attrs[:ticket]
  @authorities      = Cassette::Authentication::Authorities
                      .parse(attrs.fetch(:authorities, '[]'),
                             config&.base_authority)
  @extra_attributes = attrs[:extra_attributes] || {}
  @extra_attributes.each_pair do |key, value|
    if respond_to?("#{key}=")
      public_send("#{key}=", value)
    end
  end
end

Instance Attribute Details

#authoritiesObject

Returns the value of attribute authorities.



12
13
14
# File 'lib/cassette/authentication/user.rb', line 12

def authorities
  @authorities
end

#emailObject

Returns the value of attribute email.



12
13
14
# File 'lib/cassette/authentication/user.rb', line 12

def email
  @email
end

#extra_attributesObject

Returns the value of attribute extra_attributes.



12
13
14
# File 'lib/cassette/authentication/user.rb', line 12

def extra_attributes
  @extra_attributes
end

#loginObject

Returns the value of attribute login.



12
13
14
# File 'lib/cassette/authentication/user.rb', line 12

def 
  @login
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/cassette/authentication/user.rb', line 12

def name
  @name
end

#ticketObject

Returns the value of attribute ticket.



12
13
14
# File 'lib/cassette/authentication/user.rb', line 12

def ticket
  @ticket
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/cassette/authentication/user.rb', line 12

def type
  @type
end