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.
5329 5330 5331 5332 5333 5334 5335 5336 |
# File 'lib/svc.rb', line 5329 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
5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 |
# File 'lib/svc.rb', line 5339 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
5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 |
# File 'lib/svc.rb', line 5402 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.
5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 |
# File 'lib/svc.rb', line 5368 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.
5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 |
# File 'lib/svc.rb', line 5430 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 |