Class: SDM::ApprovalWorkflowApprovers

Inherits:
Object
  • Object
show all
Extended by:
Gem::Deprecate
Defined in:
lib/svc.rb

Overview

ApprovalWorkflowApprovers link approval workflow approvers to an ApprovalWorkflowStep

See ApprovalWorkflowApprover.

Instance Method Summary collapse

Constructor Details

#initialize(channel, parent) ⇒ ApprovalWorkflowApprovers

Returns a new instance of ApprovalWorkflowApprovers.



1278
1279
1280
1281
1282
1283
1284
1285
# File 'lib/svc.rb', line 1278

def initialize(channel, parent)
  begin
    @stub = V1::ApprovalWorkflowApprovers::Stub.new(nil, nil, channel_override: channel)
  rescue => exception
    raise Plumbing::convert_error_to_porcelain(exception)
  end
  @parent = parent
end

Instance Method Details

#create(approval_workflow_approver, deadline: nil) ⇒ Object

Create creates a new approval workflow approver.



1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
# File 'lib/svc.rb', line 1288

def create(
  approval_workflow_approver,
  deadline: nil
)
  req = V1::ApprovalWorkflowApproverCreateRequest.new()

  req.approval_workflow_approver = Plumbing::convert_approval_workflow_approver_to_plumbing(approval_workflow_approver)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.create(req, metadata: @parent.("ApprovalWorkflowApprovers.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 = ApprovalWorkflowApproverCreateResponse.new()
  resp.approval_workflow_approver = Plumbing::convert_approval_workflow_approver_to_porcelain(plumbing_response.approval_workflow_approver)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end

#delete(id, deadline: nil) ⇒ Object

Delete deletes an existing approval workflow approver.



1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
# File 'lib/svc.rb', line 1351

def delete(
  id,
  deadline: nil
)
  req = V1::ApprovalWorkflowApproverDeleteRequest.new()

  req.id = (id)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.delete(req, metadata: @parent.("ApprovalWorkflowApprovers.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 = ApprovalWorkflowApproverDeleteResponse.new()
  resp.id = (plumbing_response.id)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end

#get(id, deadline: nil) ⇒ Object

Get reads one approval workflow approver by ID.



1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
# File 'lib/svc.rb', line 1317

def get(
  id,
  deadline: nil
)
  req = V1::ApprovalWorkflowApproverGetRequest.new()
  if not @parent.snapshot_time.nil?
    req.meta = V1::GetRequestMetadata.new()
    req.meta.snapshot_at = @parent.snapshot_time
  end

  req.id = (id)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.get(req, metadata: @parent.("ApprovalWorkflowApprovers.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 = ApprovalWorkflowApproverGetResponse.new()
  resp.approval_workflow_approver = Plumbing::convert_approval_workflow_approver_to_porcelain(plumbing_response.approval_workflow_approver)
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end

#list(filter, *args, deadline: nil) ⇒ Object

Lists existing approval workflow approvers.



1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
# File 'lib/svc.rb', line 1380

def list(
  filter,
  *args,
  deadline: nil
)
  req = V1::ApprovalWorkflowApproverListRequest.new()
  req.meta = V1::ListRequestMetadata.new()
  if @parent.page_limit > 0
    req.meta.limit = @parent.page_limit
  end
  if not @parent.snapshot_time.nil?
    req.meta.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.("ApprovalWorkflowApprovers.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.approval_workflow_approvers.each do |plumbing_item|
        g.yield Plumbing::convert_approval_workflow_approver_to_porcelain(plumbing_item)
      end
      break if plumbing_response.meta.next_cursor == ""
      req.meta.cursor = plumbing_response.meta.next_cursor
    end
  }
  resp
end