Class: LockstepSdk::ApiKeyModel

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

Overview

An API Key is an authentication token that you may use with the Lockstep API. Because API Keys do not have an expiration date, they are well suited for unattended processes. Each API Key is associated with a user, and may be revoked to prevent it from accessing the Lockstep API. When you create an API Key, make sure to save the value in a secure location. Lockstep cannot retrieve an API Key once it is created.

For more information, see [API Keys](developer.lockstep.io/docs/api-keys).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ ApiKeyModel

Initialize the ApiKeyModel using the provided prototype



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 31

def initialize(params = {})
    @api_key_id = params.dig(:api_key_id)
    @group_key = params.dig(:group_key)
    @name = params.dig(:name)
    @environment = params.dig(:environment)
    @api_key = params.dig(:api_key)
    @key_prefix = params.dig(:key_prefix)
    @created = params.dig(:created)
    @created_user_id = params.dig(:created_user_id)
    @revoked = params.dig(:revoked)
    @revoked_user_id = params.dig(:revoked_user_id)
    @expires = params.dig(:expires)
end

Instance Attribute Details

#api_keyString



63
64
65
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 63

def api_key
  @api_key
end

#api_key_idUuid



47
48
49
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 47

def api_key_id
  @api_key_id
end

#createdDate-time



71
72
73
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 71

def created
  @created
end

#created_user_idUuid



75
76
77
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 75

def created_user_id
  @created_user_id
end

#environmentString



59
60
61
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 59

def environment
  @environment
end

#expiresDate-time



87
88
89
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 87

def expires
  @expires
end

#group_keyUuid



51
52
53
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 51

def group_key
  @group_key
end

#key_prefixString



67
68
69
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 67

def key_prefix
  @key_prefix
end

#nameString



55
56
57
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 55

def name
  @name
end

#revokedDate-time



79
80
81
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 79

def revoked
  @revoked
end

#revoked_user_idUuid



83
84
85
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 83

def revoked_user_id
  @revoked_user_id
end

Instance Method Details

#as_json(options = {}) ⇒ object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 91

def as_json(options={})
    {
        'apiKeyId' => @api_key_id,
        'groupKey' => @group_key,
        'name' => @name,
        'environment' => @environment,
        'apiKey' => @api_key,
        'keyPrefix' => @key_prefix,
        'created' => @created,
        'createdUserId' => @created_user_id,
        'revoked' => @revoked,
        'revokedUserId' => @revoked_user_id,
        'expires' => @expires,
    }
end

#to_json(*options) ⇒ String



109
110
111
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 109

def to_json(*options)
    "[#{as_json(*options).to_json(*options)}]"
end