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.



18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
# File 'lib/models/porcelain.rb', line 18266

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.



18246
18247
18248
# File 'lib/models/porcelain.rb', line 18246

def 
  @account_type
end

#created_atObject

CreatedAt is the timestamp when the token was created



18248
18249
18250
# File 'lib/models/porcelain.rb', line 18248

def created_at
  @created_at
end

#deadlineObject

The timestamp when the Token will expire.



18250
18251
18252
# File 'lib/models/porcelain.rb', line 18250

def deadline
  @deadline
end

#durationObject

Duration from token creation to expiration.



18252
18253
18254
# File 'lib/models/porcelain.rb', line 18252

def duration
  @duration
end

#idObject

Unique identifier of the Token.



18254
18255
18256
# File 'lib/models/porcelain.rb', line 18254

def id
  @id
end

#nameObject

Unique human-readable name of the Token.



18256
18257
18258
# File 'lib/models/porcelain.rb', line 18256

def name
  @name
end

#permissionsObject

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



18258
18259
18260
# File 'lib/models/porcelain.rb', line 18258

def permissions
  @permissions
end

#rekeyedObject

The timestamp when the Token was last rekeyed.



18260
18261
18262
# File 'lib/models/porcelain.rb', line 18260

def rekeyed
  @rekeyed
end

#suspendedObject

Reserved for future use. Always false for tokens.



18262
18263
18264
# File 'lib/models/porcelain.rb', line 18262

def suspended
  @suspended
end

#tagsObject

Tags is a map of key, value pairs.



18264
18265
18266
# File 'lib/models/porcelain.rb', line 18264

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



18290
18291
18292
18293
18294
18295
18296
# File 'lib/models/porcelain.rb', line 18290

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