Class: SDM::Token
- Inherits:
-
Object
- Object
- SDM::Token
- 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
-
#account_type ⇒ Object
Corresponds to the type of token, e.g.
-
#created_at ⇒ Object
CreatedAt is the timestamp when the token was created.
-
#deadline ⇒ Object
The timestamp when the Token will expire.
-
#duration ⇒ Object
Duration from token creation to expiration.
-
#id ⇒ Object
Unique identifier of the Token.
-
#name ⇒ Object
Unique human-readable name of the Token.
-
#permissions ⇒ Object
Permissions assigned to the token, e.g.
-
#rekeyed ⇒ Object
The timestamp when the Token was last rekeyed.
-
#suspended ⇒ Object
Reserved for future use.
-
#tags ⇒ Object
Tags is a map of key, value pairs.
Instance Method Summary collapse
-
#initialize(account_type: nil, created_at: nil, deadline: nil, duration: nil, id: nil, name: nil, permissions: nil, rekeyed: nil, suspended: nil, tags: nil) ⇒ Token
constructor
A new instance of Token.
- #to_json(options = {}) ⇒ Object
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 = account_type == nil ? "" : account_type @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 = == nil ? [] : @rekeyed = rekeyed == nil ? nil : rekeyed @suspended = suspended == nil ? false : suspended = == nil ? SDM::() : end |
Instance Attribute Details
#account_type ⇒ Object
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 @account_type end |
#created_at ⇒ Object
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 |
#deadline ⇒ Object
The timestamp when the Token will expire.
16389 16390 16391 |
# File 'lib/models/porcelain.rb', line 16389 def deadline @deadline end |
#duration ⇒ Object
Duration from token creation to expiration.
16391 16392 16393 |
# File 'lib/models/porcelain.rb', line 16391 def duration @duration end |
#id ⇒ Object
Unique identifier of the Token.
16393 16394 16395 |
# File 'lib/models/porcelain.rb', line 16393 def id @id end |
#name ⇒ Object
Unique human-readable name of the Token.
16395 16396 16397 |
# File 'lib/models/porcelain.rb', line 16395 def name @name end |
#permissions ⇒ Object
Permissions assigned to the token, e.g. role:create.
16397 16398 16399 |
# File 'lib/models/porcelain.rb', line 16397 def end |
#rekeyed ⇒ Object
The timestamp when the Token was last rekeyed.
16399 16400 16401 |
# File 'lib/models/porcelain.rb', line 16399 def rekeyed @rekeyed end |
#suspended ⇒ Object
Reserved for future use. Always false for tokens.
16401 16402 16403 |
# File 'lib/models/porcelain.rb', line 16401 def suspended @suspended end |
#tags ⇒ Object
Tags is a map of key, value pairs.
16403 16404 16405 |
# File 'lib/models/porcelain.rb', line 16403 def 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( = {}) hash = {} self.instance_variables.each do |var| hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var end hash.to_json end |