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.



10542
10543
10544
10545
10546
10547
10548
10549
10550
# File 'lib/models/porcelain.rb', line 10542

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.



10536
10537
10538
# File 'lib/models/porcelain.rb', line 10536

def granted_at
  @granted_at
end

#resource_idObject

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



10538
10539
10540
# File 'lib/models/porcelain.rb', line 10538

def resource_id
  @resource_id
end

#role_idObject

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



10540
10541
10542
# File 'lib/models/porcelain.rb', line 10540

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



10552
10553
10554
10555
10556
10557
10558
# File 'lib/models/porcelain.rb', line 10552

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