Class: Legion::Identity::Grant

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/identity/grant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(grant_id:, token:, provider:, result:, qualifier: :default, purpose: nil, reason: nil, expires_at: nil) ⇒ Grant

rubocop:disable Metrics/ParameterLists



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/legion/identity/grant.rb', line 8

def initialize(grant_id:, token:, provider:, result:, qualifier: :default, purpose: nil, reason: nil, expires_at: nil) # rubocop:disable Metrics/ParameterLists
  @grant_id   = grant_id
  @token      = token
  @provider   = provider
  @qualifier  = qualifier
  @purpose    = purpose
  @result     = result
  @reason     = reason
  @expires_at = expires_at
  freeze
end

Instance Attribute Details

#expires_atObject (readonly)

Returns the value of attribute expires_at.



6
7
8
# File 'lib/legion/identity/grant.rb', line 6

def expires_at
  @expires_at
end

#grant_idObject (readonly)

Returns the value of attribute grant_id.



6
7
8
# File 'lib/legion/identity/grant.rb', line 6

def grant_id
  @grant_id
end

#providerObject (readonly)

Returns the value of attribute provider.



6
7
8
# File 'lib/legion/identity/grant.rb', line 6

def provider
  @provider
end

#purposeObject (readonly)

Returns the value of attribute purpose.



6
7
8
# File 'lib/legion/identity/grant.rb', line 6

def purpose
  @purpose
end

#qualifierObject (readonly)

Returns the value of attribute qualifier.



6
7
8
# File 'lib/legion/identity/grant.rb', line 6

def qualifier
  @qualifier
end

#reasonObject (readonly)

Returns the value of attribute reason.



6
7
8
# File 'lib/legion/identity/grant.rb', line 6

def reason
  @reason
end

#resultObject (readonly)

Returns the value of attribute result.



6
7
8
# File 'lib/legion/identity/grant.rb', line 6

def result
  @result
end

#tokenObject (readonly)

Returns the value of attribute token.



6
7
8
# File 'lib/legion/identity/grant.rb', line 6

def token
  @token
end

Instance Method Details

#denied?Boolean

Returns:

  • (Boolean)


21
# File 'lib/legion/identity/grant.rb', line 21

def denied?  = result == :denied

#granted?Boolean

Returns:

  • (Boolean)


20
# File 'lib/legion/identity/grant.rb', line 20

def granted? = result == :granted