Class: SDM::AccessRequest

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

Overview

AccessRequests are requests for access to a resource that may match a Workflow.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id: nil, duration: nil, grant_id: nil, id: nil, reason: nil, requestedduration: nil, resource_id: nil, resultduration: nil, start_from: nil, status: nil, status_at: nil, valid_until: nil, workflow_id: nil) ⇒ AccessRequest

Returns a new instance of AccessRequest.



1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
# File 'lib/models/porcelain.rb', line 1247

def initialize(
  account_id: nil,
  duration: nil,
  grant_id: nil,
  id: nil,
  reason: nil,
  requestedduration: nil,
  resource_id: nil,
  resultduration: nil,
  start_from: nil,
  status: nil,
  status_at: nil,
  valid_until: nil,
  workflow_id: nil
)
  @account_id =  == nil ? "" : 
  @duration = duration == nil ? 0 : duration
  @grant_id = grant_id == nil ? "" : grant_id
  @id = id == nil ? "" : id
  @reason = reason == nil ? "" : reason
  @requestedduration = requestedduration == nil ? nil : requestedduration
  @resource_id = resource_id == nil ? "" : resource_id
  @resultduration = resultduration == nil ? nil : resultduration
  @start_from = start_from == nil ? nil : start_from
  @status = status == nil ? "" : status
  @status_at = status_at == nil ? nil : status_at
  @valid_until = valid_until == nil ? nil : valid_until
  @workflow_id = workflow_id == nil ? "" : workflow_id
end

Instance Attribute Details

#account_idObject

The account that initiated the request.



1219
1220
1221
# File 'lib/models/porcelain.rb', line 1219

def 
  @account_id
end

#durationObject

Duration of the access request. Deprecated: use requested/result duration instead



1222
1223
1224
# File 'lib/models/porcelain.rb', line 1222

def duration
  @duration
end

#grant_idObject

The account grant created, if it exists.



1224
1225
1226
# File 'lib/models/porcelain.rb', line 1224

def grant_id
  @grant_id
end

#idObject

The access request id.



1226
1227
1228
# File 'lib/models/porcelain.rb', line 1226

def id
  @id
end

#reasonObject

The reason the access was requested.



1228
1229
1230
# File 'lib/models/porcelain.rb', line 1228

def reason
  @reason
end

#requesteddurationObject

The duration that access was requested for, if any.



1230
1231
1232
# File 'lib/models/porcelain.rb', line 1230

def requestedduration
  @requestedduration
end

#resource_idObject

The resource id.



1232
1233
1234
# File 'lib/models/porcelain.rb', line 1232

def resource_id
  @resource_id
end

#resultdurationObject

The duration that results from an approved request.



1234
1235
1236
# File 'lib/models/porcelain.rb', line 1234

def resultduration
  @resultduration
end

#start_fromObject

The timestamp when the requested access will be granted. If this field is not specified it will default to the current time.



1237
1238
1239
# File 'lib/models/porcelain.rb', line 1237

def start_from
  @start_from
end

#statusObject

The status of the access request.



1239
1240
1241
# File 'lib/models/porcelain.rb', line 1239

def status
  @status
end

#status_atObject

The timestamp when the status changed.



1241
1242
1243
# File 'lib/models/porcelain.rb', line 1241

def status_at
  @status_at
end

#valid_untilObject

The timestamp when the requested access will expire.



1243
1244
1245
# File 'lib/models/porcelain.rb', line 1243

def valid_until
  @valid_until
end

#workflow_idObject

The workflow the request bound to.



1245
1246
1247
# File 'lib/models/porcelain.rb', line 1245

def workflow_id
  @workflow_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1277
1278
1279
1280
1281
1282
1283
# File 'lib/models/porcelain.rb', line 1277

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