Module: Smplkit::Jobs

Defined in:
lib/smplkit/jobs/models.rb

Overview

Smpl Jobs surface — exposed through mgmt.jobs.*.

Unlike Config/Flags/Logging, Jobs has no live “phone-home” agent — no environment registration, no WebSocket — so its entire surface lives on the management client rather than a runtime client. A Job is an active record: build it with mgmt.jobs.new(…), set fields, and call Job#save (create when new, full-replace update when it already exists) or Job#delete. Runs are read-only views; run actions live on mgmt.jobs.runs.

Defined Under Namespace

Modules: HttpMethod Classes: HttpConfig, HttpHeader, Job, Run, Usage

Class Method Summary collapse

Class Method Details

.call_apiObject

Wrap a generated-jobs-API call and translate ApiError into the Smplkit::Error hierarchy. Connection-level failures (no response code) become ConnectionError; status-coded failures route through Errors.raise_for_status, which emits PaymentRequiredError / NotFoundError / ConflictError / ValidationError / Error depending on the JSON:API body.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/smplkit/jobs/models.rb', line 20

def self.call_api
  yield
rescue SmplkitGeneratedClient::Jobs::ApiError => e
  raise Smplkit::ConnectionError, e.message.to_s if e.code.nil? || e.code.zero?

  Smplkit::Errors.raise_for_status(e.code, e.response_body.to_s)
  # raise_for_status only returns on 2xx; if we get here the generated
  # layer raised on a 2xx (shouldn't happen) — re-raise the original so
  # the caller can inspect.
  raise
end