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



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 34

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

Returns The API key to use for authentication. This will only be returned upon creation of the API key. All other times, this value will be `null`. For more information, see [API Keys](developer.lockstep.io/docs/api-keys).

Returns:

  • (String)

    The API key to use for authentication. This will only be returned upon creation of the API key. All other times, this value will be `null`. For more information, see [API Keys](developer.lockstep.io/docs/api-keys).



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

def api_key
  @api_key
end

#api_key_idUuid

Returns The unique identifier for the API key.

Returns:

  • (Uuid)

    The unique identifier for the API key.



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

def api_key_id
  @api_key_id
end

#createdDate-time

Returns The date the API key was created.

Returns:

  • (Date-time)

    The date the API key was created.



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

def created
  @created
end

#created_user_idUuid

Returns The user that created the API key.

Returns:

  • (Uuid)

    The user that created the API key.



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

def created_user_id
  @created_user_id
end

#environmentString

Returns For convenience, a call to createApiKey will contain the name of the environment for this API key, typically SBX or PRD. This can help you distinguish between keys created on the Sandbox environment from those created on Production.

Returns:

  • (String)

    For convenience, a call to createApiKey will contain the name of the environment for this API key, typically SBX or PRD. This can help you distinguish between keys created on the Sandbox environment from those created on Production.



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

def environment
  @environment
end

#expiresDate-time

Returns The UTC datetime when the API key expires.

Returns:

  • (Date-time)

    The UTC datetime when the API key expires.



90
91
92
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 90

def expires
  @expires
end

#group_keyUuid

Returns The GroupKey uniquely identifies a single Lockstep Platform account. All records for this account will share the same GroupKey value. GroupKey values cannot be changed once created. For more information, see [Accounts and GroupKeys](developer.lockstep.io/docs/accounts-and-groupkeys).

Returns:

  • (Uuid)

    The GroupKey uniquely identifies a single Lockstep Platform account. All records for this account will share the same GroupKey value. GroupKey values cannot be changed once created. For more information, see [Accounts and GroupKeys](developer.lockstep.io/docs/accounts-and-groupkeys).



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

def group_key
  @group_key
end

#key_prefixString

Returns The first 10 characters of the API key. This information can be used to ensure that you are looking at the correct API Key, but cannot be used for authentication.

Returns:

  • (String)

    The first 10 characters of the API key. This information can be used to ensure that you are looking at the correct API Key, but cannot be used for authentication.



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

def key_prefix
  @key_prefix
end

#nameString

Returns The name of the API key.

Returns:

  • (String)

    The name of the API key.



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

def name
  @name
end

#revokedDate-time

Returns The date the API key was revoked.

Returns:

  • (Date-time)

    The date the API key was revoked.



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

def revoked
  @revoked
end

#revoked_user_idUuid

Returns The user who revoked the API key.

Returns:

  • (Uuid)

    The user who revoked the API key.



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

def revoked_user_id
  @revoked_user_id
end

Instance Method Details

#as_json(options = {}) ⇒ object

Returns This object as a JSON key-value structure.

Returns:

  • (object)

    This object as a JSON key-value structure



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

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

Returns This object converted to a JSON string.

Returns:

  • (String)

    This object converted to a JSON string



112
113
114
# File 'lib/lockstep_sdk/models/api_key_model.rb', line 112

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