Class: Rafflesia::CliTokenData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/auth/cli_token_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  access_token: :access_token,
  entitlements: :entitlements,
  expires_at: :expires_at,
  organization_id: :organization_id,
  permissions: :permissions,
  refresh_token: :refresh_token,
  role: :role,
  session_id: :session_id,
  token_type: :token_type,
  user: :user
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ CliTokenData

Returns a new instance of CliTokenData.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rafflesia/auth/cli_token_data.rb', line 33

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @access_token = hash[:access_token]
  @entitlements = (hash[:entitlements] || [])
  @expires_at = hash[:expires_at]
  @organization_id = hash[:organization_id]
  @permissions = (hash[:permissions] || [])
  @refresh_token = hash[:refresh_token]
  @role = hash[:role]
  @session_id = hash[:session_id]
  @token_type = hash[:token_type]
  @user = hash[:user] ? Rafflesia::AuthUser.new(hash[:user]) : nil
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def access_token
  @access_token
end

#entitlementsObject

Returns the value of attribute entitlements.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def entitlements
  @entitlements
end

#expires_atObject

Returns the value of attribute expires_at.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def expires_at
  @expires_at
end

#organization_idObject

Returns the value of attribute organization_id.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def organization_id
  @organization_id
end

#permissionsObject

Returns the value of attribute permissions.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def permissions
  @permissions
end

#refresh_tokenObject

Returns the value of attribute refresh_token.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def refresh_token
  @refresh_token
end

#roleObject

Returns the value of attribute role.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def role
  @role
end

#session_idObject

Returns the value of attribute session_id.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def session_id
  @session_id
end

#token_typeObject

Returns the value of attribute token_type.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def token_type
  @token_type
end

#userObject

Returns the value of attribute user.



21
22
23
# File 'lib/rafflesia/auth/cli_token_data.rb', line 21

def user
  @user
end