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.



1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
# File 'lib/models/porcelain.rb', line 1003

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.



975
976
977
# File 'lib/models/porcelain.rb', line 975

def 
  @account_id
end

#durationObject

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



978
979
980
# File 'lib/models/porcelain.rb', line 978

def duration
  @duration
end

#grant_idObject

The account grant created, if it exists.



980
981
982
# File 'lib/models/porcelain.rb', line 980

def grant_id
  @grant_id
end

#idObject

The access request id.



982
983
984
# File 'lib/models/porcelain.rb', line 982

def id
  @id
end

#reasonObject

The reason the access was requested.



984
985
986
# File 'lib/models/porcelain.rb', line 984

def reason
  @reason
end

#requesteddurationObject

The duration that access was requested for, if any.



986
987
988
# File 'lib/models/porcelain.rb', line 986

def requestedduration
  @requestedduration
end

#resource_idObject

The resource id.



988
989
990
# File 'lib/models/porcelain.rb', line 988

def resource_id
  @resource_id
end

#resultdurationObject

The duration that results from an approved request.



990
991
992
# File 'lib/models/porcelain.rb', line 990

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.



993
994
995
# File 'lib/models/porcelain.rb', line 993

def start_from
  @start_from
end

#statusObject

The status of the access request.



995
996
997
# File 'lib/models/porcelain.rb', line 995

def status
  @status
end

#status_atObject

The timestamp when the status changed.



997
998
999
# File 'lib/models/porcelain.rb', line 997

def status_at
  @status_at
end

#valid_untilObject

The timestamp when the requested access will expire.



999
1000
1001
# File 'lib/models/porcelain.rb', line 999

def valid_until
  @valid_until
end

#workflow_idObject

The workflow the request bound to.



1001
1002
1003
# File 'lib/models/porcelain.rb', line 1001

def workflow_id
  @workflow_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1033
1034
1035
1036
1037
1038
1039
# File 'lib/models/porcelain.rb', line 1033

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