smplkit 3.0.115 → 3.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d24fdc29df5e09eeb9aced770603d9166f8afb58e38ab20c3dbe73ff2ce551b
|
|
4
|
+
data.tar.gz: 3b517f4874247ea7acdf945fcaa569a9049f8cde042457d270cf4a45a193b9d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c18a392a7507b18fed79333f2c951507af3e8243d6eff12de84cd78ebfcd49d455ae45377ace9c125a8083571ac66524bc4599b1cd0f1b3674f7b59d1b6a405
|
|
7
|
+
data.tar.gz: ae50568454496b81f22fc3a28545bd0aa531b854443b33e865bebe5e2ede08bded4405b450412a5bfcdbbc365c687967bb2e10427701aeeaea0931d5ec1fbe90
|
|
@@ -146,7 +146,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
# List Runs
|
|
149
|
-
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
149
|
+
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax). Set `last_run_only=true` to collapse the result to the last completed run for each job-and-environment combination. \"Completed\" means a terminal state — succeeded, failed, or canceled; in-flight runs (pending or running) are not included, so a job that is mid-run still surfaces its previous completed result and a combination with no completed run yet returns nothing. The filters above still apply, evaluated before the collapse, so each row is the most recent completed run in its group that also satisfies them.
|
|
150
150
|
# @param [Hash] opts the optional parameters
|
|
151
151
|
# @option opts [String] :filter_job
|
|
152
152
|
# @option opts [String] :filter_status Restrict to runs in the given lifecycle state. One of `PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELED`, or a comma-separated list of them to match any (e.g. `SUCCEEDED,FAILED`).
|
|
@@ -155,6 +155,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
155
155
|
# @option opts [String] :filter_started_at Restrict to runs whose `started_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
156
156
|
# @option opts [String] :filter_finished_at Restrict to runs whose `finished_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
157
157
|
# @option opts [String] :filter_scheduled_for Restrict to runs whose `scheduled_for` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
158
|
+
# @option opts [Boolean] :last_run_only Return only the last completed run for each job-and-environment combination. \"Completed\" means a terminal state — succeeded, failed, or canceled; runs still in flight (pending or running) are not included, so a job that is currently running still shows its previous completed result. The other filters and date ranges apply first, then the results collapse, so each row is the most recent completed run in its group that also matches them. Defaults to `false`. (default to false)
|
|
158
159
|
# @option opts [Integer] :page_size Number of runs per page. Optional; defaults to `50` when omitted. Must be between `1` and `1000` inclusive — requests outside that range are rejected with a 400 error.
|
|
159
160
|
# @option opts [String] :page_after
|
|
160
161
|
# @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `-created_at`. Allowed values: `created_at`, `-created_at`, `finished_at`, `-finished_at`, `job`, `-job`, `scheduled_for`, `-scheduled_for`, `started_at`, `-started_at`, `status`, `-status`, `total_duration_ms`, `-total_duration_ms`. (default to '-created_at')
|
|
@@ -165,7 +166,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
165
166
|
end
|
|
166
167
|
|
|
167
168
|
# List Runs
|
|
168
|
-
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
169
|
+
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax). Set `last_run_only=true` to collapse the result to the last completed run for each job-and-environment combination. \"Completed\" means a terminal state — succeeded, failed, or canceled; in-flight runs (pending or running) are not included, so a job that is mid-run still surfaces its previous completed result and a combination with no completed run yet returns nothing. The filters above still apply, evaluated before the collapse, so each row is the most recent completed run in its group that also satisfies them.
|
|
169
170
|
# @param [Hash] opts the optional parameters
|
|
170
171
|
# @option opts [String] :filter_job
|
|
171
172
|
# @option opts [String] :filter_status Restrict to runs in the given lifecycle state. One of `PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELED`, or a comma-separated list of them to match any (e.g. `SUCCEEDED,FAILED`).
|
|
@@ -174,6 +175,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
174
175
|
# @option opts [String] :filter_started_at Restrict to runs whose `started_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
175
176
|
# @option opts [String] :filter_finished_at Restrict to runs whose `finished_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
176
177
|
# @option opts [String] :filter_scheduled_for Restrict to runs whose `scheduled_for` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
178
|
+
# @option opts [Boolean] :last_run_only Return only the last completed run for each job-and-environment combination. \"Completed\" means a terminal state — succeeded, failed, or canceled; runs still in flight (pending or running) are not included, so a job that is currently running still shows its previous completed result. The other filters and date ranges apply first, then the results collapse, so each row is the most recent completed run in its group that also matches them. Defaults to `false`. (default to false)
|
|
177
179
|
# @option opts [Integer] :page_size Number of runs per page. Optional; defaults to `50` when omitted. Must be between `1` and `1000` inclusive — requests outside that range are rejected with a 400 error.
|
|
178
180
|
# @option opts [String] :page_after
|
|
179
181
|
# @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `-created_at`. Allowed values: `created_at`, `-created_at`, `finished_at`, `-finished_at`, `job`, `-job`, `scheduled_for`, `-scheduled_for`, `started_at`, `-started_at`, `status`, `-status`, `total_duration_ms`, `-total_duration_ms`. (default to '-created_at')
|
|
@@ -202,6 +204,7 @@ module SmplkitGeneratedClient::Jobs
|
|
|
202
204
|
query_params[:'filter[started_at]'] = opts[:'filter_started_at'] if !opts[:'filter_started_at'].nil?
|
|
203
205
|
query_params[:'filter[finished_at]'] = opts[:'filter_finished_at'] if !opts[:'filter_finished_at'].nil?
|
|
204
206
|
query_params[:'filter[scheduled_for]'] = opts[:'filter_scheduled_for'] if !opts[:'filter_scheduled_for'].nil?
|
|
207
|
+
query_params[:'last_run_only'] = opts[:'last_run_only'] if !opts[:'last_run_only'].nil?
|
|
205
208
|
query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
|
|
206
209
|
query_params[:'page[after]'] = opts[:'page_after'] if !opts[:'page_after'].nil?
|
|
207
210
|
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
|
@@ -58,7 +58,7 @@ describe 'RunsApi' do
|
|
|
58
58
|
|
|
59
59
|
# unit tests for list_runs
|
|
60
60
|
# List Runs
|
|
61
|
-
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax).
|
|
61
|
+
# List runs for this account (cursor paginated). Default sort is `-created_at` (newest first). Sort by `created_at`, `started_at`, `finished_at`, `scheduled_for`, `status`, `job`, or `total_duration_ms`, ascending or descending (prefix `-` for descending). Keep the same `sort` value across paginated requests so the cursor stays consistent. Runs that have not reached the relevant lifecycle point (`started_at`, `finished_at`, `scheduled_for`, `total_duration_ms` unset) sort to the end regardless of direction. Filters compose with AND: - `filter[job]={id}` — a single job's run history. - `filter[status]` — one state or a comma-separated list (any-of). - `filter[environment]` — one environment key or a comma-separated list (any-of); omitted covers every environment you can access. - `filter[created_at]` / `filter[started_at]` / `filter[finished_at]` / `filter[scheduled_for]` — half-open `[start,end)` date ranges (see each parameter for the interval syntax). Set `last_run_only=true` to collapse the result to the last completed run for each job-and-environment combination. \"Completed\" means a terminal state — succeeded, failed, or canceled; in-flight runs (pending or running) are not included, so a job that is mid-run still surfaces its previous completed result and a combination with no completed run yet returns nothing. The filters above still apply, evaluated before the collapse, so each row is the most recent completed run in its group that also satisfies them.
|
|
62
62
|
# @param [Hash] opts the optional parameters
|
|
63
63
|
# @option opts [String] :filter_job
|
|
64
64
|
# @option opts [String] :filter_status Restrict to runs in the given lifecycle state. One of `PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELED`, or a comma-separated list of them to match any (e.g. `SUCCEEDED,FAILED`).
|
|
@@ -67,6 +67,7 @@ describe 'RunsApi' do
|
|
|
67
67
|
# @option opts [String] :filter_started_at Restrict to runs whose `started_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
68
68
|
# @option opts [String] :filter_finished_at Restrict to runs whose `finished_at` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
69
69
|
# @option opts [String] :filter_scheduled_for Restrict to runs whose `scheduled_for` falls in a half-open `[start,end)` interval. Bounds are ISO-8601 timestamps; `*` leaves a bound open. The leading bracket is `[` (inclusive) or `(` (exclusive) and the trailing bracket is `]` (inclusive) or `)` (exclusive). Example: `[2026-06-01T00:00:00Z,2026-06-08T00:00:00Z)` selects the first week of June; `[2026-06-01T00:00:00Z,*)` is everything from then onward.
|
|
70
|
+
# @option opts [Boolean] :last_run_only Return only the last completed run for each job-and-environment combination. \"Completed\" means a terminal state — succeeded, failed, or canceled; runs still in flight (pending or running) are not included, so a job that is currently running still shows its previous completed result. The other filters and date ranges apply first, then the results collapse, so each row is the most recent completed run in its group that also matches them. Defaults to `false`.
|
|
70
71
|
# @option opts [Integer] :page_size Number of runs per page. Optional; defaults to `50` when omitted. Must be between `1` and `1000` inclusive — requests outside that range are rejected with a 400 error.
|
|
71
72
|
# @option opts [String] :page_after
|
|
72
73
|
# @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `-created_at`. Allowed values: `created_at`, `-created_at`, `finished_at`, `-finished_at`, `job`, `-job`, `scheduled_for`, `-scheduled_for`, `started_at`, `-started_at`, `status`, `-status`, `total_duration_ms`, `-total_duration_ms`.
|
data/lib/smplkit/jobs/client.rb
CHANGED
|
@@ -394,13 +394,15 @@ module Smplkit
|
|
|
394
394
|
# Convert the wrapper +environments+ map to the generated model hash.
|
|
395
395
|
#
|
|
396
396
|
# Each entry's +enabled+ is always written; a per-environment +schedule+
|
|
397
|
-
# (cron) override and +configuration+ override are
|
|
398
|
-
# present (omit to inherit the job's base +schedule+ /
|
|
399
|
-
# The read-only per-environment
|
|
397
|
+
# (cron) override, +timezone+ override, and +configuration+ override are
|
|
398
|
+
# each sent only when present (omit to inherit the job's base +schedule+ /
|
|
399
|
+
# +timezone+ / +configuration+). The read-only per-environment
|
|
400
|
+
# +next_run_at+ is never written.
|
|
400
401
|
def environments_to_wire(environments)
|
|
401
402
|
(environments || {}).each_with_object({}) do |(env_key, env), out|
|
|
402
403
|
attrs = { enabled: env.enabled }
|
|
403
404
|
attrs[:schedule] = env.schedule unless env.schedule.nil?
|
|
405
|
+
attrs[:timezone] = env.timezone unless env.timezone.nil?
|
|
404
406
|
attrs[:configuration] = HttpConfig.to_wire(env.configuration) unless env.configuration.nil?
|
|
405
407
|
out[env_key.to_s] = SmplkitGeneratedClient::Jobs::JobEnvironment.new(attrs)
|
|
406
408
|
end
|
|
@@ -418,6 +420,11 @@ module Smplkit
|
|
|
418
420
|
configuration: HttpConfig.to_wire(job.configuration),
|
|
419
421
|
concurrency_policy: job.concurrency_policy
|
|
420
422
|
}
|
|
423
|
+
# +timezone+ is only valid on a recurring (cron) job; an unset +nil+ is
|
|
424
|
+
# omitted, leaving the server default of UTC. (Unlike +schedule+, whose
|
|
425
|
+
# explicit +null+ creates a manual job, omitting +timezone+ simply
|
|
426
|
+
# inherits UTC — so it is sent only when present.)
|
|
427
|
+
attrs[:timezone] = job.timezone unless job.timezone.nil?
|
|
421
428
|
environments = job.environments
|
|
422
429
|
attrs[:environments] = environments_to_wire(environments) unless environments.nil? || environments.empty?
|
|
423
430
|
SmplkitGeneratedClient::Jobs::Job.new(attrs)
|
data/lib/smplkit/jobs/models.rb
CHANGED
|
@@ -79,7 +79,8 @@ module Smplkit
|
|
|
79
79
|
# (+{ enabled: true, schedule: "0 3 * * *", configuration: HttpConfig.new(...) }+)
|
|
80
80
|
# so callers can use the lightweight hash form without importing the model. A
|
|
81
81
|
# dict-form +configuration+ override is coerced to an {HttpConfig} so it
|
|
82
|
-
# serializes on save;
|
|
82
|
+
# serializes on save; optional +schedule+ cron and +timezone+ overrides pass
|
|
83
|
+
# through.
|
|
83
84
|
#
|
|
84
85
|
# @api private
|
|
85
86
|
def self.normalize_environments(environments)
|
|
@@ -94,6 +95,7 @@ module Smplkit
|
|
|
94
95
|
JobEnvironment.new(
|
|
95
96
|
enabled: value[:enabled] || value["enabled"] || false,
|
|
96
97
|
schedule: value[:schedule] || value["schedule"],
|
|
98
|
+
timezone: value[:timezone] || value["timezone"],
|
|
97
99
|
configuration: cfg
|
|
98
100
|
)
|
|
99
101
|
end
|
|
@@ -291,6 +293,13 @@ module Smplkit
|
|
|
291
293
|
# inherits the job's base {Job#schedule}. When present, it must be a
|
|
292
294
|
# 5-field UTC cron expression and is only meaningful on a recurring job —
|
|
293
295
|
# it cannot turn a one-off job recurring or vice-versa.
|
|
296
|
+
# @!attribute [rw] timezone
|
|
297
|
+
# @return [String, nil] Optional per-environment IANA timezone override for
|
|
298
|
+
# evaluating this environment's cron {#schedule} (recurring jobs only).
|
|
299
|
+
# +nil+ (the default) inherits the base {Job#timezone}, else UTC. When
|
|
300
|
+
# present, it must be a valid IANA zone key (e.g. +"America/New_York"+);
|
|
301
|
+
# it may be set on an environment that inherits the base schedule (it
|
|
302
|
+
# need not also override {#schedule}). Sent on writes only when present.
|
|
294
303
|
# @!attribute [rw] configuration
|
|
295
304
|
# @return [HttpConfig, nil] Optional per-environment request configuration
|
|
296
305
|
# that fully replaces the job's base {Job#configuration} for this
|
|
@@ -301,8 +310,8 @@ module Smplkit
|
|
|
301
310
|
# @return [String, nil] Read-only. The next scheduled fire time in this
|
|
302
311
|
# environment. +nil+ when the environment is not enabled, or once a
|
|
303
312
|
# one-off run has fired. Never written back on save.
|
|
304
|
-
JobEnvironment = Struct.new(:enabled, :schedule, :configuration, :next_run_at, keyword_init: true) do
|
|
305
|
-
def initialize(enabled: false, schedule: nil, configuration: nil, next_run_at: nil)
|
|
313
|
+
JobEnvironment = Struct.new(:enabled, :schedule, :timezone, :configuration, :next_run_at, keyword_init: true) do
|
|
314
|
+
def initialize(enabled: false, schedule: nil, timezone: nil, configuration: nil, next_run_at: nil)
|
|
306
315
|
super
|
|
307
316
|
end
|
|
308
317
|
|
|
@@ -318,6 +327,7 @@ module Smplkit
|
|
|
318
327
|
new(
|
|
319
328
|
enabled: src.enabled.nil? ? false : src.enabled,
|
|
320
329
|
schedule: src.schedule,
|
|
330
|
+
timezone: src.timezone,
|
|
321
331
|
configuration: cfg.nil? ? nil : HttpConfig.from_wire(cfg),
|
|
322
332
|
next_run_at: src.next_run_at
|
|
323
333
|
)
|
|
@@ -386,6 +396,16 @@ module Smplkit
|
|
|
386
396
|
# {#set_schedule}.
|
|
387
397
|
attr_accessor :schedule
|
|
388
398
|
|
|
399
|
+
# @return [String, nil] The base IANA timezone the cron {#schedule} is
|
|
400
|
+
# evaluated in (e.g. +"America/New_York"+); +nil+ (the default) means
|
|
401
|
+
# UTC. The base every environment inherits unless it sets its own
|
|
402
|
+
# {JobEnvironment#timezone}. The cron fires on this zone's wall clock
|
|
403
|
+
# (DST-aware) while +next_run_at+ is still reported as a UTC instant.
|
|
404
|
+
# Only valid on a recurring (cron) job — leave +nil+ for a manual or
|
|
405
|
+
# one-off job. Set it with {#set_timezone}; sent on writes only when
|
|
406
|
+
# present.
|
|
407
|
+
attr_accessor :timezone
|
|
408
|
+
|
|
389
409
|
# @return [HttpConfig] The base HTTP request to perform when the job fires.
|
|
390
410
|
# Per-environment overrides live in {#environments}.
|
|
391
411
|
attr_accessor :configuration
|
|
@@ -416,7 +436,7 @@ module Smplkit
|
|
|
416
436
|
attr_accessor :birth_environment
|
|
417
437
|
|
|
418
438
|
def initialize(client = nil, id:, name:, configuration:, schedule: nil,
|
|
419
|
-
description: nil, environments: nil,
|
|
439
|
+
timezone: nil, description: nil, environments: nil,
|
|
420
440
|
kind: nil, type: "http", concurrency_policy: "ALLOW",
|
|
421
441
|
birth_environment: nil, created_at: nil,
|
|
422
442
|
updated_at: nil, deleted_at: nil, version: nil)
|
|
@@ -428,6 +448,7 @@ module Smplkit
|
|
|
428
448
|
@kind = kind
|
|
429
449
|
@type = type
|
|
430
450
|
@schedule = schedule
|
|
451
|
+
@timezone = timezone
|
|
431
452
|
@configuration = configuration
|
|
432
453
|
@concurrency_policy = concurrency_policy
|
|
433
454
|
@birth_environment = birth_environment
|
|
@@ -580,6 +601,29 @@ module Smplkit
|
|
|
580
601
|
end
|
|
581
602
|
end
|
|
582
603
|
|
|
604
|
+
# Set the IANA timezone the cron schedule is evaluated in — base
|
|
605
|
+
# (+environment+ omitted) or per-environment.
|
|
606
|
+
#
|
|
607
|
+
# With +environment+ omitted (the default), sets the base {#timezone}
|
|
608
|
+
# every environment inherits unless it overrides it. With an +environment+
|
|
609
|
+
# given, sets that environment's per-environment +timezone+ override on
|
|
610
|
+
# {#environments}, creating the override entry if it doesn't exist yet
|
|
611
|
+
# (preserving any already-set +enabled+ / +schedule+ / +configuration+ on
|
|
612
|
+
# it). A timezone is only valid on a recurring (cron) job; +nil+ means UTC
|
|
613
|
+
# (base) or "inherit the base" (per-environment). Call {#save} to persist.
|
|
614
|
+
#
|
|
615
|
+
# @param timezone [String, nil] A valid IANA timezone key (e.g.
|
|
616
|
+
# +"America/New_York"+), or +nil+ for UTC / inherit.
|
|
617
|
+
# @param environment [String, nil] An environment key for a per-environment
|
|
618
|
+
# override, or +nil+ to set the base timezone.
|
|
619
|
+
def set_timezone(timezone, environment: nil)
|
|
620
|
+
if environment.nil?
|
|
621
|
+
@timezone = timezone
|
|
622
|
+
else
|
|
623
|
+
_environment_override(environment).timezone = timezone
|
|
624
|
+
end
|
|
625
|
+
end
|
|
626
|
+
|
|
583
627
|
# Trigger one immediate, manual run of this job (a +MANUAL+ run).
|
|
584
628
|
#
|
|
585
629
|
# @param environment [String, nil] Environment the run executes in.
|
|
@@ -633,6 +677,7 @@ module Smplkit
|
|
|
633
677
|
@kind = other.kind
|
|
634
678
|
@type = other.type
|
|
635
679
|
@schedule = other.schedule
|
|
680
|
+
@timezone = other.timezone
|
|
636
681
|
@configuration = other.configuration
|
|
637
682
|
@concurrency_policy = other.concurrency_policy
|
|
638
683
|
@created_at = other.created_at
|
|
@@ -663,6 +708,7 @@ module Smplkit
|
|
|
663
708
|
kind: a.kind,
|
|
664
709
|
type: a.type || "http",
|
|
665
710
|
schedule: a.schedule,
|
|
711
|
+
timezone: a.timezone,
|
|
666
712
|
configuration: HttpConfig.from_wire(a.configuration),
|
|
667
713
|
concurrency_policy: a.concurrency_policy || "ALLOW",
|
|
668
714
|
created_at: a.created_at,
|