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_types: 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, statuses: nil, exclude_status: nil, trigger_type: nil, trigger_types: 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
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/retab/workflow_runs.rb', line 269 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
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/retab/workflow_runs.rb', line 128 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
251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/retab/workflow_runs.rb', line 251 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_types: nil, preferred_columns: nil, delimiter: nil, line_delimiter: nil, quote: nil, request_options: {}) ⇒ Retab::WorkflowExportPayloadResponse
Get Workflow Export Payload
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 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/retab/workflow_runs.rb', line 175 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_types: 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_types" => trigger_types, "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
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/retab/workflow_runs.rb', line 228 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, statuses: nil, exclude_status: nil, trigger_type: nil, trigger_types: 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
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 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/retab/workflow_runs.rb', line 32 def list( workflow_id: nil, status: nil, statuses: nil, exclude_status: nil, trigger_type: nil, trigger_types: 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, "statuses" => statuses, "exclude_status" => exclude_status, "trigger_type" => trigger_type, "trigger_types" => trigger_types, "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, statuses: statuses, exclude_status: exclude_status, trigger_type: trigger_type, trigger_types: trigger_types, 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, statuses: statuses, exclude_status: exclude_status, trigger_type: trigger_type, trigger_types: trigger_types, 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 |