Class: WorkOS::ApiKeyUpdatedData

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/api_keys/api_key_updated_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  object: :object,
  id: :id,
  owner: :owner,
  name: :name,
  obfuscated_value: :obfuscated_value,
  last_used_at: :last_used_at,
  expires_at: :expires_at,
  permissions: :permissions,
  created_at: :created_at,
  updated_at: :updated_at,
  previous_attributes: :previous_attributes
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

normalize

Methods included from HashProvider

#inspect, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ ApiKeyUpdatedData

Returns a new instance of ApiKeyUpdatedData.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 34

def initialize(json)
  hash = self.class.normalize(json)
  @object = hash[:object]
  @id = hash[:id]
  @owner = hash[:owner] ? (case hash[:owner][:type] when "organization" then WorkOS::ApiKeyUpdatedDataOwner.new(hash[:owner]) when "user" then WorkOS::UserApiKeyUpdatedDataOwner.new(hash[:owner]) else hash[:owner] end) : nil
  @name = hash[:name]
  @obfuscated_value = hash[:obfuscated_value]
  @last_used_at = hash[:last_used_at]
  @expires_at = hash[:expires_at]
  @permissions = hash[:permissions] || []
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
  @previous_attributes = hash[:previous_attributes] ? WorkOS::ApiKeyUpdatedDataPreviousAttribute.new(hash[:previous_attributes]) : nil
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def created_at
  @created_at
end

#expires_atObject

Returns the value of attribute expires_at.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def expires_at
  @expires_at
end

#idObject

Returns the value of attribute id.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def id
  @id
end

#last_used_atObject

Returns the value of attribute last_used_at.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def last_used_at
  @last_used_at
end

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def name
  @name
end

#obfuscated_valueObject

Returns the value of attribute obfuscated_value.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def obfuscated_value
  @obfuscated_value
end

#objectObject

Returns the value of attribute object.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def object
  @object
end

#ownerObject

Returns the value of attribute owner.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def owner
  @owner
end

#permissionsObject

Returns the value of attribute permissions.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def permissions
  @permissions
end

#previous_attributesObject

Returns the value of attribute previous_attributes.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def previous_attributes
  @previous_attributes
end

#updated_atObject

Returns the value of attribute updated_at.



21
22
23
# File 'lib/workos/api_keys/api_key_updated_data.rb', line 21

def updated_at
  @updated_at
end