Class: SDM::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

A Token is an account providing tokenized access for automation or integration use. Tokens include admin tokens, API keys, and SCIM tokens.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_type: nil, created_at: nil, deadline: nil, duration: nil, id: nil, name: nil, permissions: nil, rekeyed: nil, suspended: nil, tags: nil) ⇒ Token

Returns a new instance of Token.



16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
# File 'lib/models/porcelain.rb', line 16405

def initialize(
  account_type: nil,
  created_at: nil,
  deadline: nil,
  duration: nil,
  id: nil,
  name: nil,
  permissions: nil,
  rekeyed: nil,
  suspended: nil,
  tags: nil
)
  @account_type =  == nil ? "" : 
  @created_at = created_at == nil ? nil : created_at
  @deadline = deadline == nil ? nil : deadline
  @duration = duration == nil ? nil : duration
  @id = id == nil ? "" : id
  @name = name == nil ? "" : name
  @permissions = permissions == nil ? [] : permissions
  @rekeyed = rekeyed == nil ? nil : rekeyed
  @suspended = suspended == nil ? false : suspended
  @tags = tags == nil ? SDM::_porcelain_zero_value_tags() : tags
end

Instance Attribute Details

#account_typeObject

Corresponds to the type of token, e.g. api or admin-token.



16385
16386
16387
# File 'lib/models/porcelain.rb', line 16385

def 
  @account_type
end

#created_atObject

CreatedAt is the timestamp when the token was created



16387
16388
16389
# File 'lib/models/porcelain.rb', line 16387

def created_at
  @created_at
end

#deadlineObject

The timestamp when the Token will expire.



16389
16390
16391
# File 'lib/models/porcelain.rb', line 16389

def deadline
  @deadline
end

#durationObject

Duration from token creation to expiration.



16391
16392
16393
# File 'lib/models/porcelain.rb', line 16391

def duration
  @duration
end

#idObject

Unique identifier of the Token.



16393
16394
16395
# File 'lib/models/porcelain.rb', line 16393

def id
  @id
end

#nameObject

Unique human-readable name of the Token.



16395
16396
16397
# File 'lib/models/porcelain.rb', line 16395

def name
  @name
end

#permissionsObject

Permissions assigned to the token, e.g. role:create.



16397
16398
16399
# File 'lib/models/porcelain.rb', line 16397

def permissions
  @permissions
end

#rekeyedObject

The timestamp when the Token was last rekeyed.



16399
16400
16401
# File 'lib/models/porcelain.rb', line 16399

def rekeyed
  @rekeyed
end

#suspendedObject

Reserved for future use. Always false for tokens.



16401
16402
16403
# File 'lib/models/porcelain.rb', line 16401

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



16403
16404
16405
# File 'lib/models/porcelain.rb', line 16403

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



16429
16430
16431
16432
16433
16434
16435
# File 'lib/models/porcelain.rb', line 16429

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end