Class: SDM::RoleResource

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

Overview

RoleResource represents an individual access grant of a Role to a Resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(granted_at: nil, resource_id: nil, role_id: nil) ⇒ RoleResource

Returns a new instance of RoleResource.



11375
11376
11377
11378
11379
11380
11381
11382
11383
# File 'lib/models/porcelain.rb', line 11375

def initialize(
  granted_at: nil,
  resource_id: nil,
  role_id: nil
)
  @granted_at = granted_at == nil ? nil : granted_at
  @resource_id = resource_id == nil ? "" : resource_id
  @role_id = role_id == nil ? "" : role_id
end

Instance Attribute Details

#granted_atObject

The most recent time at which access was granted. If access was granted, revoked, and granted again, this will reflect the later time.



11369
11370
11371
# File 'lib/models/porcelain.rb', line 11369

def granted_at
  @granted_at
end

#resource_idObject

The unique identifier of the Resource to which access is granted.



11371
11372
11373
# File 'lib/models/porcelain.rb', line 11371

def resource_id
  @resource_id
end

#role_idObject

The unique identifier of the Role to which access is granted.



11373
11374
11375
# File 'lib/models/porcelain.rb', line 11373

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



11385
11386
11387
11388
11389
11390
11391
# File 'lib/models/porcelain.rb', line 11385

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end