Class: SDM::ApprovalWorkflowSteps

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

Overview

ApprovalWorkflowSteps link approval workflow steps to an ApprovalWorkflow

See ApprovalWorkflowStep.

Instance Method Summary collapse

Constructor Details

#initialize(channel, parent) ⇒ ApprovalWorkflowSteps



1836
1837
1838
1839
1840
1841
1842
1843
# File 'lib/svc.rb', line 1836

def initialize(channel, parent)
  begin
    @stub = V1::ApprovalWorkflowSteps::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_step, deadline: nil) ⇒ Object

Deprecated: Create creates a new approval workflow step.



1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
# File 'lib/svc.rb', line 1846

def create(
  approval_workflow_step,
  deadline: nil
)
  req = V1::ApprovalWorkflowStepCreateRequest.new()

  req.approval_workflow_step = Plumbing::convert_approval_workflow_step_to_plumbing(approval_workflow_step)
  # Execute before interceptor hooks
  req = @parent.interceptor.execute_before("ApprovalWorkflowSteps.Create", self, req)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.create(req, metadata: @parent.("ApprovalWorkflowSteps.Create", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception, deadline))
        tries + +sleep(@parent.exponentialBackoff(tries, deadline))
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  # Execute after interceptor hooks
  plumbing_response = @parent.interceptor.execute_after("ApprovalWorkflowSteps.Create", self, req, plumbing_response)

  resp = ApprovalWorkflowStepCreateResponse.new()
  resp.approval_workflow_step = Plumbing::convert_approval_workflow_step_to_porcelain(plumbing_response.approval_workflow_step)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end

#delete(id, deadline: nil) ⇒ Object

Deprecated: Delete deletes an existing approval workflow step.



1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
# File 'lib/svc.rb', line 1919

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

  req.id = (id)
  # Execute before interceptor hooks
  req = @parent.interceptor.execute_before("ApprovalWorkflowSteps.Delete", self, req)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.delete(req, metadata: @parent.("ApprovalWorkflowSteps.Delete", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception, deadline))
        tries + +sleep(@parent.exponentialBackoff(tries, deadline))
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  # Execute after interceptor hooks
  plumbing_response = @parent.interceptor.execute_after("ApprovalWorkflowSteps.Delete", self, req, plumbing_response)

  resp = ApprovalWorkflowStepDeleteResponse.new()
  resp.id = (plumbing_response.id)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end

#get(id, deadline: nil) ⇒ Object

Deprecated: Get reads one approval workflow step by ID.



1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
# File 'lib/svc.rb', line 1880

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

  req.id = (id)
  # Execute before interceptor hooks
  req = @parent.interceptor.execute_before("ApprovalWorkflowSteps.Get", self, req)
  tries = 0
  plumbing_response = nil
  loop do
    begin
      plumbing_response = @stub.get(req, metadata: @parent.("ApprovalWorkflowSteps.Get", req), deadline: deadline)
    rescue => exception
      if (@parent.shouldRetry(tries, exception, deadline))
        tries + +sleep(@parent.exponentialBackoff(tries, deadline))
        next
      end
      raise Plumbing::convert_error_to_porcelain(exception)
    end
    break
  end

  # Execute after interceptor hooks
  plumbing_response = @parent.interceptor.execute_after("ApprovalWorkflowSteps.Get", self, req, plumbing_response)

  resp = ApprovalWorkflowStepGetResponse.new()
  resp.approval_workflow_step = Plumbing::convert_approval_workflow_step_to_porcelain(plumbing_response.approval_workflow_step)
  resp.meta = Plumbing::(plumbing_response.meta)
  resp.rate_limit = Plumbing::(plumbing_response.rate_limit)
  resp
end

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

Deprecated: Lists existing approval workflow steps.



1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
# File 'lib/svc.rb', line 1953

def list(
  filter,
  *args,
  deadline: nil
)
  req = V1::ApprovalWorkflowStepListRequest.new()
  req.meta = V1::.new()
  if not @parent.page_limit.nil?
    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.("ApprovalWorkflowSteps.List", req), deadline: deadline)
      rescue => exception
        if (@parent.shouldRetry(tries, exception, deadline))
          tries + +sleep(@parent.exponentialBackoff(tries, deadline))
          next
        end
        raise Plumbing::convert_error_to_porcelain(exception)
      end
      tries = 0
      plumbing_response.approval_workflow_steps.each do |plumbing_item|
        g.yield Plumbing::convert_approval_workflow_step_to_porcelain(plumbing_item)
      end
      break if plumbing_response.meta.next_cursor == ""
      req.meta.cursor = plumbing_response.meta.next_cursor
    end
  }
  resp
end