Class: SDM::AccountResource

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

Overview

AccountResource represents an individual access grant of a Account to a Resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_grant_id: nil, account_id: nil, expires_at: nil, granted_at: nil, resource_id: nil, role_id: nil) ⇒ AccountResource

Returns a new instance of AccountResource.



1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
# File 'lib/models/porcelain.rb', line 1101

def initialize(
  account_grant_id: nil,
  account_id: nil,
  expires_at: nil,
  granted_at: nil,
  resource_id: nil,
  role_id: nil
)
  @account_grant_id =  == nil ? "" : 
  @account_id =  == nil ? "" : 
  @expires_at = expires_at == nil ? nil : expires_at
  @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

#account_grant_idObject

The unique identifier of the AccountGrant through which the Account was granted access to the Resource. If empty, access was not granted through an AccountGrant.



1087
1088
1089
# File 'lib/models/porcelain.rb', line 1087

def 
  @account_grant_id
end

#account_idObject

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



1089
1090
1091
# File 'lib/models/porcelain.rb', line 1089

def 
  @account_id
end

#expires_atObject

The time at which access will expire. If empty, this access has no expiration.



1091
1092
1093
# File 'lib/models/porcelain.rb', line 1091

def expires_at
  @expires_at
end

#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.



1094
1095
1096
# File 'lib/models/porcelain.rb', line 1094

def granted_at
  @granted_at
end

#resource_idObject

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



1096
1097
1098
# File 'lib/models/porcelain.rb', line 1096

def resource_id
  @resource_id
end

#role_idObject

The unique identifier of the Role through which the Account was granted access to the Resource. If empty, access was not granted through an AccountAttachment to a Role.



1099
1100
1101
# File 'lib/models/porcelain.rb', line 1099

def role_id
  @role_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1117
1118
1119
1120
1121
1122
1123
# File 'lib/models/porcelain.rb', line 1117

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