Class: Retab::WorkflowRuns
- Inherits:
-
Object
- Object
- Retab::WorkflowRuns
- Defined in:
- lib/retab/workflow_runs.rb
Instance Method Summary collapse
-
#cancel(run_id:, command_id: nil, request_options: {}) ⇒ Retab::CancelWorkflowResponse
Cancel Workflow Run.
-
#create(workflow_id:, documents: nil, json_inputs: nil, version: nil, request_options: {}) ⇒ Retab::WorkflowRun
Create Workflow Run Route.
-
#delete(run_id:, request_options: {}) ⇒ void
Delete Workflow Run.
-
#export(workflow_id:, block_id:, export_source: nil, selected_run_ids: nil, selected_doc_types: nil, status: nil, exclude_status: nil, from_date: nil, to_date: nil, trigger_type: nil, preferred_columns: nil, delimiter: nil, line_delimiter: nil, quote: nil, request_options: {}) ⇒ Retab::WorkflowExportPayloadResponse
Get Workflow Export Payload.
-
#get(run_id:, request_options: {}) ⇒ Retab::WorkflowRun
Get Workflow Run.
-
#initialize(client) ⇒ WorkflowRuns
constructor
A new instance of WorkflowRuns.
-
#list(workflow_id: nil, status: nil, exclude_status: nil, trigger_type: nil, from_date: nil, to_date: nil, min_duration_ms: nil, max_duration_ms: nil, search: nil, before: nil, after: nil, limit: 20, order: "desc", sort_by: "timing.created_at", request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowRun>
List Workflow Runs.
Constructor Details
#initialize(client) ⇒ WorkflowRuns
Returns a new instance of WorkflowRuns.
9 10 11 |
# File 'lib/retab/workflow_runs.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#cancel(run_id:, command_id: nil, request_options: {}) ⇒ Retab::CancelWorkflowResponse
Cancel Workflow Run
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/retab/workflow_runs.rb', line 259 def cancel( run_id:, command_id: nil, request_options: {} ) body = { "command_id" => command_id }.compact response = @client.request( method: :post, path: "/v1/workflows/runs/#{Retab::Util.encode_path(run_id)}/cancel", auth: true, body: body, request_options: ) result = Retab::CancelWorkflowResponse.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 |
#create(workflow_id:, documents: nil, json_inputs: nil, version: nil, request_options: {}) ⇒ Retab::WorkflowRun
Create Workflow Run Route
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/retab/workflow_runs.rb', line 118 def create( workflow_id:, documents: nil, json_inputs: nil, version: nil, request_options: {} ) documents = Retab::MimeData.coerce_document_map(documents) unless documents.nil? body = { "workflow_id" => workflow_id, "documents" => documents, "json_inputs" => json_inputs, "version" => version }.compact response = @client.request( method: :post, path: "/v1/workflows/runs", auth: true, body: body, request_options: ) result = Retab::WorkflowRun.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 |
#delete(run_id:, request_options: {}) ⇒ void
This method returns an undefined value.
Delete Workflow Run
241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/retab/workflow_runs.rb', line 241 def delete( run_id:, request_options: {} ) @client.request( method: :delete, path: "/v1/workflows/runs/#{Retab::Util.encode_path(run_id)}", auth: true, request_options: ) nil end |
#export(workflow_id:, block_id:, export_source: nil, selected_run_ids: nil, selected_doc_types: nil, status: nil, exclude_status: nil, from_date: nil, to_date: nil, trigger_type: nil, preferred_columns: nil, delimiter: nil, line_delimiter: nil, quote: nil, request_options: {}) ⇒ Retab::WorkflowExportPayloadResponse
Get Workflow Export Payload
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/retab/workflow_runs.rb', line 165 def export( workflow_id:, block_id:, export_source: nil, selected_run_ids: nil, selected_doc_types: nil, status: nil, exclude_status: nil, from_date: nil, to_date: nil, trigger_type: nil, preferred_columns: nil, delimiter: nil, line_delimiter: nil, quote: nil, request_options: {} ) body = { "workflow_id" => workflow_id, "block_id" => block_id, "export_source" => export_source, "selected_run_ids" => selected_run_ids, "selected_doc_types" => selected_doc_types, "status" => status, "exclude_status" => exclude_status, "from_date" => from_date, "to_date" => to_date, "trigger_type" => trigger_type, "preferred_columns" => preferred_columns, "delimiter" => delimiter, "line_delimiter" => line_delimiter, "quote" => quote }.compact response = @client.request( method: :post, path: "/v1/workflows/runs/export", auth: true, body: body, request_options: ) result = Retab::WorkflowExportPayloadResponse.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 |
#get(run_id:, request_options: {}) ⇒ Retab::WorkflowRun
Get Workflow Run
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/retab/workflow_runs.rb', line 218 def get( run_id:, request_options: {} ) response = @client.request( method: :get, path: "/v1/workflows/runs/#{Retab::Util.encode_path(run_id)}", auth: true, request_options: ) result = Retab::WorkflowRun.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(workflow_id: nil, status: nil, exclude_status: nil, trigger_type: nil, from_date: nil, to_date: nil, min_duration_ms: nil, max_duration_ms: nil, search: nil, before: nil, after: nil, limit: 20, order: "desc", sort_by: "timing.created_at", request_options: {}) ⇒ Retab::PaginatedList<Retab::WorkflowRun>
List Workflow Runs
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/retab/workflow_runs.rb', line 30 def list( workflow_id: nil, status: nil, exclude_status: nil, trigger_type: nil, from_date: nil, to_date: nil, min_duration_ms: nil, max_duration_ms: nil, search: nil, before: nil, after: nil, limit: 20, order: "desc", sort_by: "timing.created_at", request_options: {} ) params = { "workflow_id" => workflow_id, "status" => status, "exclude_status" => exclude_status, "trigger_type" => trigger_type, "from_date" => from_date, "to_date" => to_date, "min_duration_ms" => min_duration_ms, "max_duration_ms" => max_duration_ms, "search" => search, "before" => before, "after" => after, "limit" => limit, "order" => order, "sort_by" => sort_by }.compact response = @client.request( method: :get, path: "/v1/workflows/runs", auth: true, params: params, request_options: ) fetch_next = -> (cursor) { list( workflow_id: workflow_id, status: status, exclude_status: exclude_status, trigger_type: trigger_type, from_date: from_date, to_date: to_date, min_duration_ms: min_duration_ms, max_duration_ms: max_duration_ms, search: search, before: before, after: cursor, limit: limit, order: order, sort_by: sort_by, request_options: ) } Retab::PaginatedList.from_response( response, model: Retab::WorkflowRun, filters: { workflow_id: workflow_id, status: status, exclude_status: exclude_status, trigger_type: trigger_type, from_date: from_date, to_date: to_date, min_duration_ms: min_duration_ms, max_duration_ms: max_duration_ms, search: search, before: before, limit: limit, order: order, sort_by: sort_by }, fetch_next: fetch_next ) end |