Class: SDM::WorkflowApprovers
- Inherits:
-
Object
- Object
- SDM::WorkflowApprovers
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/svc.rb
Overview
WorkflowApprovers is an account or a role with the ability to approve requests bound to a workflow.
See WorkflowApprover.
Instance Method Summary collapse
-
#create(workflow_approver, deadline: nil) ⇒ Object
Create creates a new workflow approver.
-
#delete(id, deadline: nil) ⇒ Object
Delete deletes a workflow approver.
-
#get(id, deadline: nil) ⇒ Object
Get reads one workflow approver by ID.
-
#initialize(channel, parent) ⇒ WorkflowApprovers
constructor
A new instance of WorkflowApprovers.
-
#list(filter, *args, deadline: nil) ⇒ Object
Lists existing workflow approvers.
Constructor Details
#initialize(channel, parent) ⇒ WorkflowApprovers
Returns a new instance of WorkflowApprovers.
5842 5843 5844 5845 5846 5847 5848 5849 |
# File 'lib/svc.rb', line 5842 def initialize(channel, parent) begin @stub = V1::WorkflowApprovers::Stub.new(nil, nil, channel_override: channel) rescue => exception raise Plumbing::convert_error_to_porcelain(exception) end @parent = parent end |
Instance Method Details
#create(workflow_approver, deadline: nil) ⇒ Object
Create creates a new workflow approver
5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 |
# File 'lib/svc.rb', line 5852 def create( workflow_approver, deadline: nil ) req = V1::WorkflowApproversCreateRequest.new() req.workflow_approver = Plumbing::convert_workflow_approver_to_plumbing(workflow_approver) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.create(req, metadata: @parent.("WorkflowApprovers.Create", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = WorkflowApproversCreateResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.workflow_approver = Plumbing::convert_workflow_approver_to_porcelain(plumbing_response.workflow_approver) resp end |
#delete(id, deadline: nil) ⇒ Object
Delete deletes a workflow approver
5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 |
# File 'lib/svc.rb', line 5915 def delete( id, deadline: nil ) req = V1::WorkflowApproversDeleteRequest.new() req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.delete(req, metadata: @parent.("WorkflowApprovers.Delete", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = WorkflowApproversDeleteResponse.new() resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp end |
#get(id, deadline: nil) ⇒ Object
Get reads one workflow approver by ID.
5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 |
# File 'lib/svc.rb', line 5881 def get( id, deadline: nil ) req = V1::WorkflowApproverGetRequest.new() if not @parent.snapshot_time.nil? req. = V1::GetRequestMetadata.new() req..snapshot_at = @parent.snapshot_time end req.id = (id) tries = 0 plumbing_response = nil loop do begin plumbing_response = @stub.get(req, metadata: @parent.("WorkflowApprovers.Get", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end break end resp = WorkflowApproverGetResponse.new() resp. = Plumbing::(plumbing_response.) resp.rate_limit = Plumbing::(plumbing_response.rate_limit) resp.workflow_approver = Plumbing::convert_workflow_approver_to_porcelain(plumbing_response.workflow_approver) resp end |
#list(filter, *args, deadline: nil) ⇒ Object
Lists existing workflow approvers.
5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 |
# File 'lib/svc.rb', line 5943 def list( filter, *args, deadline: nil ) req = V1::WorkflowApproversListRequest.new() req. = V1::ListRequestMetadata.new() if @parent.page_limit > 0 req..limit = @parent.page_limit end if not @parent.snapshot_time.nil? req..snapshot_at = @parent.snapshot_time end req.filter = Plumbing::quote_filter_args(filter, *args) resp = Enumerator::Generator.new { |g| tries = 0 loop do begin plumbing_response = @stub.list(req, metadata: @parent.("WorkflowApprovers.List", req), deadline: deadline) rescue => exception if (@parent.shouldRetry(tries, exception)) tries + +@parent.jitterSleep(tries) next end raise Plumbing::convert_error_to_porcelain(exception) end tries = 0 plumbing_response.workflow_approvers.each do |plumbing_item| g.yield Plumbing::convert_workflow_approver_to_porcelain(plumbing_item) end break if plumbing_response..next_cursor == "" req..cursor = plumbing_response..next_cursor end } resp end |