Class: WorkOS::Role

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/authorization/role.rb

Constant Summary collapse

HASH_ATTRS =
{
  slug: :slug,
  object: :object,
  id: :id,
  name: :name,
  description: :description,
  type: :type,
  resource_type_slug: :resource_type_slug,
  permissions: :permissions,
  created_at: :created_at,
  updated_at: :updated_at
}.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) ⇒ Role

Returns a new instance of Role.



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/workos/authorization/role.rb', line 32

def initialize(json)
  hash = self.class.normalize(json)
  @slug = hash[:slug]
  @object = hash[:object]
  @id = hash[:id]
  @name = hash[:name]
  @description = hash[:description]
  @type = hash[:type]
  @resource_type_slug = hash[:resource_type_slug]
  @permissions = hash[:permissions] || []
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def description
  @description
end

#idObject

Returns the value of attribute id.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def id
  @id
end

#nameObject

Returns the value of attribute name.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def name
  @name
end

#objectObject

Returns the value of attribute object.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def object
  @object
end

#permissionsObject

Returns the value of attribute permissions.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def permissions
  @permissions
end

#resource_type_slugObject

Returns the value of attribute resource_type_slug.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def resource_type_slug
  @resource_type_slug
end

#slugObject

Returns the value of attribute slug.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def slug
  @slug
end

#typeObject

Returns the value of attribute type.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def type
  @type
end

#updated_atObject

Returns the value of attribute updated_at.



20
21
22
# File 'lib/workos/authorization/role.rb', line 20

def updated_at
  @updated_at
end