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



942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
# File 'lib/models/porcelain.rb', line 942

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.



914
915
916
# File 'lib/models/porcelain.rb', line 914

def 
  @account_id
end

#durationObject

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



917
918
919
# File 'lib/models/porcelain.rb', line 917

def duration
  @duration
end

#grant_idObject

The account grant created, if it exists.



919
920
921
# File 'lib/models/porcelain.rb', line 919

def grant_id
  @grant_id
end

#idObject

The access request id.



921
922
923
# File 'lib/models/porcelain.rb', line 921

def id
  @id
end

#reasonObject

The reason the access was requested.



923
924
925
# File 'lib/models/porcelain.rb', line 923

def reason
  @reason
end

#requesteddurationObject

The duration that access was requested for, if any.



925
926
927
# File 'lib/models/porcelain.rb', line 925

def requestedduration
  @requestedduration
end

#resource_idObject

The resource id.



927
928
929
# File 'lib/models/porcelain.rb', line 927

def resource_id
  @resource_id
end

#resultdurationObject

The duration that results from an approved request.



929
930
931
# File 'lib/models/porcelain.rb', line 929

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.



932
933
934
# File 'lib/models/porcelain.rb', line 932

def start_from
  @start_from
end

#statusObject

The status of the access request.



934
935
936
# File 'lib/models/porcelain.rb', line 934

def status
  @status
end

#status_atObject

The timestamp when the status changed.



936
937
938
# File 'lib/models/porcelain.rb', line 936

def status_at
  @status_at
end

#valid_untilObject

The timestamp when the requested access will expire.



938
939
940
# File 'lib/models/porcelain.rb', line 938

def valid_until
  @valid_until
end

#workflow_idObject

The workflow the request bound to.



940
941
942
# File 'lib/models/porcelain.rb', line 940

def workflow_id
  @workflow_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



972
973
974
975
976
977
978
# File 'lib/models/porcelain.rb', line 972

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