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.



864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
# File 'lib/models/porcelain.rb', line 864

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.



836
837
838
# File 'lib/models/porcelain.rb', line 836

def 
  @account_id
end

#durationObject

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



839
840
841
# File 'lib/models/porcelain.rb', line 839

def duration
  @duration
end

#grant_idObject

The account grant created, if it exists.



841
842
843
# File 'lib/models/porcelain.rb', line 841

def grant_id
  @grant_id
end

#idObject

The access request id.



843
844
845
# File 'lib/models/porcelain.rb', line 843

def id
  @id
end

#reasonObject

The reason the access was requested.



845
846
847
# File 'lib/models/porcelain.rb', line 845

def reason
  @reason
end

#requesteddurationObject

The duration that access was requested for, if any.



847
848
849
# File 'lib/models/porcelain.rb', line 847

def requestedduration
  @requestedduration
end

#resource_idObject

The resource id.



849
850
851
# File 'lib/models/porcelain.rb', line 849

def resource_id
  @resource_id
end

#resultdurationObject

The duration that results from an approved request.



851
852
853
# File 'lib/models/porcelain.rb', line 851

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.



854
855
856
# File 'lib/models/porcelain.rb', line 854

def start_from
  @start_from
end

#statusObject

The status of the access request.



856
857
858
# File 'lib/models/porcelain.rb', line 856

def status
  @status
end

#status_atObject

The timestamp when the status changed.



858
859
860
# File 'lib/models/porcelain.rb', line 858

def status_at
  @status_at
end

#valid_untilObject

The timestamp when the requested access will expire.



860
861
862
# File 'lib/models/porcelain.rb', line 860

def valid_until
  @valid_until
end

#workflow_idObject

The workflow the request bound to.



862
863
864
# File 'lib/models/porcelain.rb', line 862

def workflow_id
  @workflow_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



894
895
896
897
898
899
900
# File 'lib/models/porcelain.rb', line 894

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