Class: Retab::WorkflowTestRunResults

Inherits:
Object
  • Object
show all
Defined in:
lib/retab/workflow_test_run_results.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ WorkflowTestRunResults

Returns a new instance of WorkflowTestRunResults.



9
10
11
# File 'lib/retab/workflow_test_run_results.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#get(result_id:, request_options: {}) ⇒ Retab::WorkflowTestResult

Get Test Execution Result

Parameters:

  • result_id (String)
  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/retab/workflow_test_run_results.rb', line 65

def get(
  result_id:,
  request_options: {}
)
  response = @client.request(
    method: :get,
    path: "/v1/workflows/tests/results/#{Retab::Util.encode_path(result_id)}",
    auth: true,
    request_options: request_options
  )
  result = Retab::WorkflowTestResult.new(response.body)
  result.last_response = Retab::Types::ApiResponse.new(
    http_status: response.code.to_i,
    http_headers: response.each_header.to_h,
    request_id: response["x-request-id"]
  )
  result
end

#list(run_id:, before: nil, after: nil, limit: 20, order: "desc", request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowTestResult>

List Test Execution Results

Parameters:

  • run_id (String)
  • before (String, nil) (defaults to: nil)
  • after (String, nil) (defaults to: nil)
  • limit (Integer, nil) (defaults to: 20)
  • order (Retab::Types::WorkflowTestRunResultsOrder, nil) (defaults to: "desc")
  • request_options (Hash) (defaults to: {})

    (see Retab::Types::RequestOptions)

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/retab/workflow_test_run_results.rb', line 21

def list(
  run_id:,
  before: nil,
  after: nil,
  limit: 20,
  order: "desc",
  request_options: {}
)
  params = {
    "run_id" => run_id,
    "before" => before,
    "after" => after,
    "limit" => limit,
    "order" => order
  }.compact
  response = @client.request(
    method: :get,
    path: "/v1/workflows/tests/results",
    auth: true,
    params: params,
    request_options: request_options
  )
  fetch_next = -> (cursor) {
    list(
      run_id: run_id,
      before: before,
      after: cursor,
      limit: limit,
      order: order,
      request_options: request_options
    )
  }
  Retab::PaginatedList.from_response(
    response,
    model: Retab::WorkflowTestResult,
    filters: {run_id: run_id, before: before, limit: limit, order: order},
    fetch_next: fetch_next
  )
end