Class: Rafflesia::Jobs
- Inherits:
-
Object
- Object
- Rafflesia::Jobs
- Defined in:
- lib/rafflesia/jobs.rb
Instance Method Summary collapse
-
#cancel(job_id:, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/cancel.
-
#cleanup(delete_terminal: nil, dry_run: nil, limit: nil, mark_stale_running: nil, reason: nil, stale_after_ms: nil, terminal_older_than_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobCleanupData
POST /v1/jobs/cleanup.
-
#create(operation:, idempotency_key: nil, input: nil, max_retries: nil, timeout_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/create.
-
#diagnostics(stale_after_ms: nil, limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobDiagnosticData
GET /v1/jobs/diagnostics.
-
#events(job_id:, type: nil, limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobEventListData
GET /v1/jobs/events.
-
#initialize(client) ⇒ Jobs
constructor
A new instance of Jobs.
-
#list(operation: nil, status: nil, worker_id: nil, has_error: nil, stale_after_ms: nil, limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobListData
GET /v1/jobs/list.
-
#markFailed(reason:, job_id:, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/mark-failed.
-
#metrics(stale_after_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobMetricsData
GET /v1/jobs/metrics.
-
#operations(request_options: {}) ⇒ Rafflesia::EnvelopeJobOperationListData
GET /v1/jobs/operations.
-
#queue(limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobQueueData
GET /v1/jobs/queue.
-
#requeue(job_id:, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/requeue.
-
#result(job_id:, wait_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
GET /v1/jobs/result.
-
#retries(limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobRetryData
GET /v1/jobs/retries.
-
#retriesRun(task_id:, request_options: {}) ⇒ Rafflesia::EnvelopeEmptyData
POST /v1/jobs/retries/run.
-
#retry(job_id:, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/retry.
-
#show(job_id:, wait_ms: nil, since_version: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
GET /v1/jobs/show.
Constructor Details
#initialize(client) ⇒ Jobs
Returns a new instance of Jobs.
9 10 11 |
# File 'lib/rafflesia/jobs.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#cancel(job_id:, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/cancel
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rafflesia/jobs.rb', line 17 def cancel( job_id:, request_options: {} ) params = { 'job_id' => job_id } response = @client.request( method: :post, path: '/v1/jobs/cancel', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#cleanup(delete_terminal: nil, dry_run: nil, limit: nil, mark_stale_running: nil, reason: nil, stale_after_ms: nil, terminal_older_than_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobCleanupData
POST /v1/jobs/cleanup
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 |
# File 'lib/rafflesia/jobs.rb', line 46 def cleanup( delete_terminal: nil, dry_run: nil, limit: nil, mark_stale_running: nil, reason: nil, stale_after_ms: nil, terminal_older_than_ms: nil, request_options: {} ) body = { 'delete_terminal' => delete_terminal, 'dry_run' => dry_run, 'limit' => limit, 'mark_stale_running' => mark_stale_running, 'reason' => reason, 'stale_after_ms' => stale_after_ms, 'terminal_older_than_ms' => terminal_older_than_ms }.compact response = @client.request( method: :post, path: '/v1/jobs/cleanup', auth: true, body: body, request_options: ) result = Rafflesia::EnvelopeJobCleanupData.new(response.body) result.last_response = Rafflesia::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(operation:, idempotency_key: nil, input: nil, max_retries: nil, timeout_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/create
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 |
# File 'lib/rafflesia/jobs.rb', line 85 def create( operation:, idempotency_key: nil, input: nil, max_retries: nil, timeout_ms: nil, request_options: {} ) body = { 'idempotency_key' => idempotency_key, 'input' => input, 'max_retries' => max_retries, 'operation' => operation, 'timeout_ms' => timeout_ms }.compact response = @client.request( method: :post, path: '/v1/jobs/create', auth: true, body: body, request_options: ) result = Rafflesia::EnvelopeJobData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#diagnostics(stale_after_ms: nil, limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobDiagnosticData
GET /v1/jobs/diagnostics
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/rafflesia/jobs.rb', line 117 def diagnostics( stale_after_ms: nil, limit: nil, request_options: {} ) params = { 'stale_after_ms' => stale_after_ms, 'limit' => limit }.compact response = @client.request( method: :get, path: '/v1/jobs/diagnostics', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobDiagnosticData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#events(job_id:, type: nil, limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobEventListData
GET /v1/jobs/events
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/rafflesia/jobs.rb', line 144 def events( job_id:, type: nil, limit: nil, request_options: {} ) params = { 'job_id' => job_id, 'type' => type, 'limit' => limit }.compact response = @client.request( method: :get, path: '/v1/jobs/events', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobEventListData.new(response.body) result.last_response = Rafflesia::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(operation: nil, status: nil, worker_id: nil, has_error: nil, stale_after_ms: nil, limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobListData
GET /v1/jobs/list
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 |
# File 'lib/rafflesia/jobs.rb', line 176 def list( operation: nil, status: nil, worker_id: nil, has_error: nil, stale_after_ms: nil, limit: nil, request_options: {} ) params = { 'operation' => operation, 'status' => status, 'worker_id' => worker_id, 'has_error' => has_error, 'stale_after_ms' => stale_after_ms, 'limit' => limit }.compact response = @client.request( method: :get, path: '/v1/jobs/list', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobListData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#markFailed(reason:, job_id:, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/mark-failed
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/rafflesia/jobs.rb', line 210 def markFailed( reason:, job_id:, request_options: {} ) params = { 'job_id' => job_id } body = { 'reason' => reason } response = @client.request( method: :post, path: '/v1/jobs/mark-failed', auth: true, params: params, body: body, request_options: ) result = Rafflesia::EnvelopeJobData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#metrics(stale_after_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobMetricsData
GET /v1/jobs/metrics
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/rafflesia/jobs.rb', line 238 def metrics( stale_after_ms: nil, request_options: {} ) params = { 'stale_after_ms' => stale_after_ms }.compact response = @client.request( method: :get, path: '/v1/jobs/metrics', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobMetricsData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#operations(request_options: {}) ⇒ Rafflesia::EnvelopeJobOperationListData
GET /v1/jobs/operations
260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/rafflesia/jobs.rb', line 260 def operations(request_options: {}) response = @client.request( method: :get, path: '/v1/jobs/operations', auth: true, request_options: ) result = Rafflesia::EnvelopeJobOperationListData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#queue(limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobQueueData
GET /v1/jobs/queue
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/rafflesia/jobs.rb', line 276 def queue( limit: nil, request_options: {} ) params = { 'limit' => limit }.compact response = @client.request( method: :get, path: '/v1/jobs/queue', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobQueueData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#requeue(job_id:, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/requeue
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/rafflesia/jobs.rb', line 299 def requeue( job_id:, request_options: {} ) params = { 'job_id' => job_id } response = @client.request( method: :post, path: '/v1/jobs/requeue', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#result(job_id:, wait_ms: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
GET /v1/jobs/result
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/rafflesia/jobs.rb', line 323 def result( job_id:, wait_ms: nil, request_options: {} ) params = { 'job_id' => job_id, 'wait_ms' => wait_ms }.compact response = @client.request( method: :get, path: '/v1/jobs/result', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#retries(limit: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobRetryData
GET /v1/jobs/retries
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/rafflesia/jobs.rb', line 348 def retries( limit: nil, request_options: {} ) params = { 'limit' => limit }.compact response = @client.request( method: :get, path: '/v1/jobs/retries', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobRetryData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#retriesRun(task_id:, request_options: {}) ⇒ Rafflesia::EnvelopeEmptyData
POST /v1/jobs/retries/run
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'lib/rafflesia/jobs.rb', line 371 def retriesRun( task_id:, request_options: {} ) params = { 'task_id' => task_id } response = @client.request( method: :post, path: '/v1/jobs/retries/run', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeEmptyData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#retry(job_id:, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
POST /v1/jobs/retry
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/rafflesia/jobs.rb', line 394 def retry( job_id:, request_options: {} ) params = { 'job_id' => job_id } response = @client.request( method: :post, path: '/v1/jobs/retry', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |
#show(job_id:, wait_ms: nil, since_version: nil, request_options: {}) ⇒ Rafflesia::EnvelopeJobData
GET /v1/jobs/show
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/rafflesia/jobs.rb', line 419 def show( job_id:, wait_ms: nil, since_version: nil, request_options: {} ) params = { 'job_id' => job_id, 'wait_ms' => wait_ms, 'since_version' => since_version }.compact response = @client.request( method: :get, path: '/v1/jobs/show', auth: true, params: params, request_options: ) result = Rafflesia::EnvelopeJobData.new(response.body) result.last_response = Rafflesia::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) result end |