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.



6977
6978
6979
6980
6981
6982
6983
6984
6985
# File 'lib/models/porcelain.rb', line 6977

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.



6971
6972
6973
# File 'lib/models/porcelain.rb', line 6971

def granted_at
  @granted_at
end

#resource_idObject

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



6973
6974
6975
# File 'lib/models/porcelain.rb', line 6973

def resource_id
  @resource_id
end

#role_idObject

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



6975
6976
6977
# File 'lib/models/porcelain.rb', line 6975

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



6987
6988
6989
6990
6991
6992
6993
# File 'lib/models/porcelain.rb', line 6987

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