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.
4046 4047 4048 4049 4050 4051 4052 4053 |
# File 'lib/svc.rb', line 4046 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
4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 |
# File 'lib/svc.rb', line 4056 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
4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 |
# File 'lib/svc.rb', line 4119 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.
4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 |
# File 'lib/svc.rb', line 4085 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.
4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 |
# File 'lib/svc.rb', line 4147 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 |