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, resource_id: nil, start_from: nil, status: nil, status_at: nil, valid_until: nil, workflow_id: nil) ⇒ AccessRequest

Returns a new instance of AccessRequest.



788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
# File 'lib/models/porcelain.rb', line 788

def initialize(
  account_id: nil,
  duration: nil,
  grant_id: nil,
  id: nil,
  reason: nil,
  resource_id: 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
  @resource_id = resource_id == nil ? "" : resource_id
  @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.



765
766
767
# File 'lib/models/porcelain.rb', line 765

def 
  @account_id
end

#durationObject

Duration of the access request.



767
768
769
# File 'lib/models/porcelain.rb', line 767

def duration
  @duration
end

#grant_idObject

The account grant created, if it exists.



769
770
771
# File 'lib/models/porcelain.rb', line 769

def grant_id
  @grant_id
end

#idObject

The access request id.



771
772
773
# File 'lib/models/porcelain.rb', line 771

def id
  @id
end

#reasonObject

The reason the access was requested.



773
774
775
# File 'lib/models/porcelain.rb', line 773

def reason
  @reason
end

#resource_idObject

The resource id.



775
776
777
# File 'lib/models/porcelain.rb', line 775

def resource_id
  @resource_id
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.



778
779
780
# File 'lib/models/porcelain.rb', line 778

def start_from
  @start_from
end

#statusObject

The status of the access request.



780
781
782
# File 'lib/models/porcelain.rb', line 780

def status
  @status
end

#status_atObject

The timestamp when the status changed.



782
783
784
# File 'lib/models/porcelain.rb', line 782

def status_at
  @status_at
end

#valid_untilObject

The timestamp when the requested access will expire.



784
785
786
# File 'lib/models/porcelain.rb', line 784

def valid_until
  @valid_until
end

#workflow_idObject

The workflow the request bound to.



786
787
788
# File 'lib/models/porcelain.rb', line 786

def workflow_id
  @workflow_id
end

Instance Method Details

#to_json(options = {}) ⇒ Object



814
815
816
817
818
819
820
# File 'lib/models/porcelain.rb', line 814

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