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.



18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
# File 'lib/models/porcelain.rb', line 18325

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_type ⇒ Object

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



18305
18306
18307
# File 'lib/models/porcelain.rb', line 18305

def 
  @account_type
end

#created_at ⇒ Object

CreatedAt is the timestamp when the token was created



18307
18308
18309
# File 'lib/models/porcelain.rb', line 18307

def created_at
  @created_at
end

#deadline ⇒ Object

The timestamp when the Token will expire.



18309
18310
18311
# File 'lib/models/porcelain.rb', line 18309

def deadline
  @deadline
end

#duration ⇒ Object

Duration from token creation to expiration.



18311
18312
18313
# File 'lib/models/porcelain.rb', line 18311

def duration
  @duration
end

#id ⇒ Object

Unique identifier of the Token.



18313
18314
18315
# File 'lib/models/porcelain.rb', line 18313

def id
  @id
end

#name ⇒ Object

Unique human-readable name of the Token.



18315
18316
18317
# File 'lib/models/porcelain.rb', line 18315

def name
  @name
end

#permissions ⇒ Object

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



18317
18318
18319
# File 'lib/models/porcelain.rb', line 18317

def permissions
  @permissions
end

#rekeyed ⇒ Object

The timestamp when the Token was last rekeyed.



18319
18320
18321
# File 'lib/models/porcelain.rb', line 18319

def rekeyed
  @rekeyed
end

#suspended ⇒ Object

Reserved for future use. Always false for tokens.



18321
18322
18323
# File 'lib/models/porcelain.rb', line 18321

def suspended
  @suspended
end

#tags ⇒ Object

Tags is a map of key, value pairs.



18323
18324
18325
# File 'lib/models/porcelain.rb', line 18323

def tags
  @tags
end

Instance Method Details

#to_json(options = {}) ⇒ Object



18349
18350
18351
18352
18353
18354
18355
# File 'lib/models/porcelain.rb', line 18349

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