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.



14517
14518
14519
14520
14521
14522
14523
14524
14525
# File 'lib/models/porcelain.rb', line 14517

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.



14511
14512
14513
# File 'lib/models/porcelain.rb', line 14511

def granted_at
  @granted_at
end

#resource_idObject

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



14513
14514
14515
# File 'lib/models/porcelain.rb', line 14513

def resource_id
  @resource_id
end

#role_idObject

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



14515
14516
14517
# File 'lib/models/porcelain.rb', line 14515

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



14527
14528
14529
14530
14531
14532
14533
# File 'lib/models/porcelain.rb', line 14527

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