smplkit 3.0.112 → 3.0.113

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: 2e838dad6d55b34ff943e6098ef70867585eaacfdf3598bbebdfaa04c41243be
4
- data.tar.gz: bb246e8ac29688fc37d4ebc687d31a1231a2be1eb0625c18e453a31e4ea4a0e2
3
+ metadata.gz: 2a17d3fa81a862f3b33087a957eab5c99db055027b39c914d2c1cbac05854961
4
+ data.tar.gz: ee3716c54c5d56ae8e956bf672774b494e0f1698ed795dec829c30365fea0dce
5
5
  SHA512:
6
- metadata.gz: b0b3291a8c8f129f16b36f0e271c6c9519c0ac6f4a40bf3b391501c512c22e069e6500c60e95b3c03ea9c0211af2f6b5a0c227f84a3b161c64e5803b4e378024
7
- data.tar.gz: d9c58b7d15d2b49810ffd56a2d900ff9c17dd9818ad6176baae8178ad1957107b610efc375951b0f43b18ea652681eb14d32147da000a3af62932d084db9af11
6
+ metadata.gz: f10c44c9a4c8e784e55f630b8c136ec3f53a1cf2d42b3284e47e37cf218f579e730bb4dfe483deaff75ea165c8be5460cd45b53e7fb1c03cc717e92f98b18d6c
7
+ data.tar.gz: 0daec91acc15dc5cb3b7c7041a9765237d8a71bc59ea8f41df58fe657bf9b67e37b66184bfb2c7b0f4f0eb6c9326402a2f660629000ca97f02bcf9aa39fce705
@@ -215,12 +215,11 @@ module SmplkitGeneratedClient::Jobs
215
215
  end
216
216
 
217
217
  # List Jobs
218
- # List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, `updated_at`, `next_run_at`, or `enabled`, ascending or descending (prefix `-` for descending). Filter with `filter[enabled]` (enabled in at least one environment), `filter[recurring]`, and `filter[name]` (case-insensitive substring match on the name); filters compose with AND. A scoped caller sees each job's `environments` map narrowed to the environments it may access.
218
+ # List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, or `updated_at`, ascending or descending (prefix `-` for descending). Filter with `filter[recurring]` and `filter[name]` (case-insensitive substring match on the name); filters compose with AND. Each job reports its per-environment enablement and `next_run_at` inside its `environments` map; a scoped caller sees that map narrowed to the environments it may access.
219
219
  # @param [Hash] opts the optional parameters
220
- # @option opts [Boolean] :filter_enabled
221
220
  # @option opts [Boolean] :filter_recurring
222
221
  # @option opts [String] :filter_name Case-insensitive substring match on the job `name` (matches when the name contains the given text).
223
- # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `name`. Allowed values: `created_at`, `-created_at`, `enabled`, `-enabled`, `name`, `-name`, `next_run_at`, `-next_run_at`, `updated_at`, `-updated_at`. (default to 'name')
222
+ # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `name`. Allowed values: `created_at`, `-created_at`, `name`, `-name`, `updated_at`, `-updated_at`. (default to 'name')
224
223
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to `1` when omitted. Must be `>= 1` — requests with a smaller value are rejected with a 400 error. (default to 1)
225
224
  # @option opts [Integer] :page_size Number of items per page. Optional; defaults to `1000` when omitted. Must be between `1` and `1000` inclusive — requests outside that range are rejected with a 400 error. (default to 1000)
226
225
  # @option opts [Boolean] :meta_total When `true`, the response's `meta.pagination` block includes `total` (the total number of matching items across all pages) and `total_pages`. Computing these requires an extra `COUNT` query, so omit (or pass `false`) when the totals are not needed. Defaults to `false`. (default to false)
@@ -231,12 +230,11 @@ module SmplkitGeneratedClient::Jobs
231
230
  end
232
231
 
233
232
  # List Jobs
234
- # List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, `updated_at`, `next_run_at`, or `enabled`, ascending or descending (prefix `-` for descending). Filter with `filter[enabled]` (enabled in at least one environment), `filter[recurring]`, and `filter[name]` (case-insensitive substring match on the name); filters compose with AND. A scoped caller sees each job's `environments` map narrowed to the environments it may access.
233
+ # List this account's jobs. Default sort is `name` ascending. Sort by `name`, `created_at`, or `updated_at`, ascending or descending (prefix `-` for descending). Filter with `filter[recurring]` and `filter[name]` (case-insensitive substring match on the name); filters compose with AND. Each job reports its per-environment enablement and `next_run_at` inside its `environments` map; a scoped caller sees that map narrowed to the environments it may access.
235
234
  # @param [Hash] opts the optional parameters
236
- # @option opts [Boolean] :filter_enabled
237
235
  # @option opts [Boolean] :filter_recurring
238
236
  # @option opts [String] :filter_name Case-insensitive substring match on the job `name` (matches when the name contains the given text).
239
- # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `name`. Allowed values: `created_at`, `-created_at`, `enabled`, `-enabled`, `name`, `-name`, `next_run_at`, `-next_run_at`, `updated_at`, `-updated_at`. (default to 'name')
237
+ # @option opts [String] :sort Field to sort by. Prefix with `-` for descending order. Default: `name`. Allowed values: `created_at`, `-created_at`, `name`, `-name`, `updated_at`, `-updated_at`. (default to 'name')
240
238
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to `1` when omitted. Must be `>= 1` — requests with a smaller value are rejected with a 400 error. (default to 1)
241
239
  # @option opts [Integer] :page_size Number of items per page. Optional; defaults to `1000` when omitted. Must be between `1` and `1000` inclusive — requests outside that range are rejected with a 400 error. (default to 1000)
242
240
  # @option opts [Boolean] :meta_total When `true`, the response's `meta.pagination` block includes `total` (the total number of matching items across all pages) and `total_pages`. Computing these requires an extra `COUNT` query, so omit (or pass `false`) when the totals are not needed. Defaults to `false`. (default to false)
@@ -245,7 +243,7 @@ module SmplkitGeneratedClient::Jobs
245
243
  if @api_client.config.debugging
246
244
  @api_client.config.logger.debug 'Calling API: JobsApi.list_jobs ...'
247
245
  end
248
- allowable_values = ["created_at", "-created_at", "enabled", "-enabled", "name", "-name", "next_run_at", "-next_run_at", "updated_at", "-updated_at"]
246
+ allowable_values = ["created_at", "-created_at", "name", "-name", "updated_at", "-updated_at"]
249
247
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
250
248
  fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
251
249
  end
@@ -254,7 +252,6 @@ module SmplkitGeneratedClient::Jobs
254
252
 
255
253
  # query parameters
256
254
  query_params = opts[:query_params] || {}
257
- query_params[:'filter[enabled]'] = opts[:'filter_enabled'] if !opts[:'filter_enabled'].nil?
258
255
  query_params[:'filter[recurring]'] = opts[:'filter_recurring'] if !opts[:'filter_recurring'].nil?
259
256
  query_params[:'filter[name]'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?
260
257
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
@@ -363,7 +360,7 @@ module SmplkitGeneratedClient::Jobs
363
360
  end
364
361
 
365
362
  # Update Job
366
- # Replace an existing job. Every writable field is overwritten. Set enablement per environment via the `environments` map (a recurring job), or by recreating a one-off job in the desired environment. Editing the schedule recomputes the next fire time; changing only which environments are enabled preserves the existing cadence.
363
+ # Replace an existing job. Every writable field is overwritten. Set enablement per environment via the `environments` map (a recurring job), or by recreating a one-off job in the desired environment. Each environment may carry its own cron `schedule` override. Editing an environment's effective schedule recomputes its next fire time; an edit that leaves an environment's schedule unchanged preserves its existing cadence.
367
364
  # @param job_id [String]
368
365
  # @param job_request [JobRequest]
369
366
  # @param [Hash] opts the optional parameters
@@ -375,7 +372,7 @@ module SmplkitGeneratedClient::Jobs
375
372
  end
376
373
 
377
374
  # Update Job
378
- # Replace an existing job. Every writable field is overwritten. Set enablement per environment via the `environments` map (a recurring job), or by recreating a one-off job in the desired environment. Editing the schedule recomputes the next fire time; changing only which environments are enabled preserves the existing cadence.
375
+ # Replace an existing job. Every writable field is overwritten. Set enablement per environment via the `environments` map (a recurring job), or by recreating a one-off job in the desired environment. Each environment may carry its own cron `schedule` override. Editing an environment's effective schedule recomputes its next fire time; an edit that leaves an environment's schedule unchanged preserves its existing cadence.
379
376
  # @param job_id [String]
380
377
  # @param job_request [JobRequest]
381
378
  # @param [Hash] opts the optional parameters
@@ -20,7 +20,7 @@ module SmplkitGeneratedClient::Jobs
20
20
  @api_client = api_client
21
21
  end
22
22
  # Get Usage
23
- # Report this account's current-period usage against its plan allotments. `runs_used` is the number of runs metered so far this calendar month; `active_jobs` is the number of currently-enabled jobs.
23
+ # Report this account's current-period usage against its plan allotments. `runs_used` is the number of runs metered so far this calendar month; `active_jobs` is the number of recurring (scheduled) jobs, which is what the plan's job limit bounds.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [String] :filter_period (default to 'current')
26
26
  # @return [UsageResponse]
@@ -30,7 +30,7 @@ module SmplkitGeneratedClient::Jobs
30
30
  end
31
31
 
32
32
  # Get Usage
33
- # Report this account's current-period usage against its plan allotments. `runs_used` is the number of runs metered so far this calendar month; `active_jobs` is the number of currently-enabled jobs.
33
+ # Report this account's current-period usage against its plan allotments. `runs_used` is the number of runs metered so far this calendar month; `active_jobs` is the number of recurring (scheduled) jobs, which is what the plan's job limit bounds.
34
34
  # @param [Hash] opts the optional parameters
35
35
  # @option opts [String] :filter_period (default to 'current')
36
36
  # @return [Array<(UsageResponse, Integer, Hash)>] UsageResponse data, response status code and response headers
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Jobs
17
- # A scheduled unit of work: an HTTP request run on a schedule. The job is the definition; each time it fires the service records a run capturing the request, response, timing, and outcome. A job is enabled per environment: set `environments[<env>].enabled` to schedule runs there. A recurring (cron) job may be enabled in several environments at once and fires once per enabled environment; a one-off (`now` or future datetime) job runs a single time in the environment it was created in.
17
+ # A scheduled unit of work: an HTTP request run on a schedule. The job is the definition; each time it fires the service records a run capturing the request, response, timing, and outcome. A job runs per environment: set `environments[<env>].enabled` to schedule runs there, and optionally give that environment its own `schedule` or `configuration`. A recurring (cron) job may be enabled in several environments at once and fires once per enabled environment, each on its own next-fire schedule; a one-off (`now` or future datetime) job runs a single time in the environment it was created in.
18
18
  class Job < ApiModelBase
19
19
  # Human-readable name for the job.
20
20
  attr_accessor :name
@@ -22,28 +22,22 @@ module SmplkitGeneratedClient::Jobs
22
22
  # Free-text description for the job.
23
23
  attr_accessor :description
24
24
 
25
- # Whether the job is enabled in at least one environment. Read-only roll-up of `environments[*].enabled`; set enablement per environment via `environments`.
26
- attr_accessor :enabled
27
-
28
25
  # Job type. Only `http` is supported today.
29
26
  attr_accessor :type
30
27
 
31
- # When the job runs. One of: an ISO-8601 datetime (a one-off run at that instant), a 5-field cron expression evaluated in **UTC** (recurring), or the literal `now` (run once, as soon as possible). A datetime or `now` job disables itself after it fires.
28
+ # The base schedule every environment inherits unless it overrides it. One of: an ISO-8601 datetime (a one-off run at that instant), a 5-field cron expression evaluated in **UTC** (recurring), or the literal `now` (run once, as soon as possible). A datetime or `now` job disables itself after it fires.
32
29
  attr_accessor :schedule
33
30
 
34
31
  # The HTTP request to perform, including method, url, headers, body, and timeout.
35
32
  attr_accessor :configuration
36
33
 
37
- # Per-environment overrides keyed by environment key (e.g. `production`, `staging`). Each entry sets `enabled` (whether the job schedules runs in that environment) and an optional `configuration` override (omit to inherit the base `configuration`). A job with no entry for an environment is disabled there. For a recurring job, supply this map to choose where it runs. For a one-off job, the environment it is created in is recorded here automatically — name it with the `X-Smplkit-Environment` header. Every referenced environment must exist for the account.
34
+ # Per-environment overrides keyed by environment key (e.g. `production`, `staging`). Each entry sets `enabled` (whether the job schedules runs in that environment), an optional `schedule` override (a cron expression for recurring jobs; omit to inherit the base `schedule`), and an optional `configuration` override (omit to inherit the base `configuration`); it also reports the read-only `next_run_at` for that environment. A job with no entry for an environment is disabled there. For a recurring job, supply this map to choose where and how it runs. For a one-off job, the environment it is created in is recorded here automatically — name it with the `X-Smplkit-Environment` header. Every referenced environment must exist for the account.
38
35
  attr_accessor :environments
39
36
 
40
37
  # How overlapping runs are handled. `ALLOW` (the only value today) permits them.
41
38
  attr_accessor :concurrency_policy
42
39
 
43
- # The next scheduled fire time. `null` once a one-off job has fired.
44
- attr_accessor :next_run_at
45
-
46
- # Whether the job runs on a repeating schedule. `true` for a cron schedule; `false` for a one-off datetime or `now` schedule, which runs a single time. Derived from `schedule`.
40
+ # Whether the job runs on a repeating schedule. `true` for a cron schedule; `false` for a one-off datetime or `now` schedule, which runs a single time. Derived from the base `schedule`.
47
41
  attr_accessor :recurring
48
42
 
49
43
  # When the job was created.
@@ -85,13 +79,11 @@ module SmplkitGeneratedClient::Jobs
85
79
  {
86
80
  :'name' => :'name',
87
81
  :'description' => :'description',
88
- :'enabled' => :'enabled',
89
82
  :'type' => :'type',
90
83
  :'schedule' => :'schedule',
91
84
  :'configuration' => :'configuration',
92
85
  :'environments' => :'environments',
93
86
  :'concurrency_policy' => :'concurrency_policy',
94
- :'next_run_at' => :'next_run_at',
95
87
  :'recurring' => :'recurring',
96
88
  :'created_at' => :'created_at',
97
89
  :'updated_at' => :'updated_at',
@@ -115,13 +107,11 @@ module SmplkitGeneratedClient::Jobs
115
107
  {
116
108
  :'name' => :'String',
117
109
  :'description' => :'String',
118
- :'enabled' => :'Boolean',
119
110
  :'type' => :'String',
120
111
  :'schedule' => :'String',
121
112
  :'configuration' => :'JobHttpConfiguration',
122
113
  :'environments' => :'Hash<String, JobEnvironment>',
123
114
  :'concurrency_policy' => :'String',
124
- :'next_run_at' => :'Time',
125
115
  :'recurring' => :'Boolean',
126
116
  :'created_at' => :'Time',
127
117
  :'updated_at' => :'Time',
@@ -134,8 +124,6 @@ module SmplkitGeneratedClient::Jobs
134
124
  def self.openapi_nullable
135
125
  Set.new([
136
126
  :'description',
137
- :'enabled',
138
- :'next_run_at',
139
127
  :'recurring',
140
128
  :'created_at',
141
129
  :'updated_at',
@@ -170,10 +158,6 @@ module SmplkitGeneratedClient::Jobs
170
158
  self.description = attributes[:'description']
171
159
  end
172
160
 
173
- if attributes.key?(:'enabled')
174
- self.enabled = attributes[:'enabled']
175
- end
176
-
177
161
  if attributes.key?(:'type')
178
162
  self.type = attributes[:'type']
179
163
  else
@@ -204,10 +188,6 @@ module SmplkitGeneratedClient::Jobs
204
188
  self.concurrency_policy = 'ALLOW'
205
189
  end
206
190
 
207
- if attributes.key?(:'next_run_at')
208
- self.next_run_at = attributes[:'next_run_at']
209
- end
210
-
211
191
  if attributes.key?(:'recurring')
212
192
  self.recurring = attributes[:'recurring']
213
193
  end
@@ -353,13 +333,11 @@ module SmplkitGeneratedClient::Jobs
353
333
  self.class == o.class &&
354
334
  name == o.name &&
355
335
  description == o.description &&
356
- enabled == o.enabled &&
357
336
  type == o.type &&
358
337
  schedule == o.schedule &&
359
338
  configuration == o.configuration &&
360
339
  environments == o.environments &&
361
340
  concurrency_policy == o.concurrency_policy &&
362
- next_run_at == o.next_run_at &&
363
341
  recurring == o.recurring &&
364
342
  created_at == o.created_at &&
365
343
  updated_at == o.updated_at &&
@@ -376,7 +354,7 @@ module SmplkitGeneratedClient::Jobs
376
354
  # Calculates hash code according to all attributes.
377
355
  # @return [Integer] Hash code
378
356
  def hash
379
- [name, description, enabled, type, schedule, configuration, environments, concurrency_policy, next_run_at, recurring, created_at, updated_at, deleted_at, version].hash
357
+ [name, description, type, schedule, configuration, environments, concurrency_policy, recurring, created_at, updated_at, deleted_at, version].hash
380
358
  end
381
359
 
382
360
  # Builds the object from hash
@@ -14,19 +14,27 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module SmplkitGeneratedClient::Jobs
17
- # Per-environment override for a job's enablement and configuration.
17
+ # Per-environment override for a job's enablement, schedule, and configuration.
18
18
  class JobEnvironment < ApiModelBase
19
19
  # Whether the job schedules runs in this environment. A job runs in an environment only via this field; it is disabled in every environment by default.
20
20
  attr_accessor :enabled
21
21
 
22
+ # Per-environment schedule override. Omit to inherit the job's base `schedule`. When present, it must be a 5-field cron expression evaluated in **UTC** (e.g. `0 3 * * *`), and is only allowed on a recurring (cron) job — it varies the cadence within that environment, it cannot turn a one-off job recurring or vice-versa.
23
+ attr_accessor :schedule
24
+
22
25
  # Per-environment HTTP request override. Omit to inherit the job's base `configuration`. When present, it fully replaces the base configuration for runs in this environment.
23
26
  attr_accessor :configuration
24
27
 
28
+ # The next scheduled fire time in this environment. `null` when the environment is not enabled, or once a one-off run has fired.
29
+ attr_accessor :next_run_at
30
+
25
31
  # Attribute mapping from ruby-style variable name to JSON key.
26
32
  def self.attribute_map
27
33
  {
28
34
  :'enabled' => :'enabled',
29
- :'configuration' => :'configuration'
35
+ :'schedule' => :'schedule',
36
+ :'configuration' => :'configuration',
37
+ :'next_run_at' => :'next_run_at'
30
38
  }
31
39
  end
32
40
 
@@ -44,14 +52,18 @@ module SmplkitGeneratedClient::Jobs
44
52
  def self.openapi_types
45
53
  {
46
54
  :'enabled' => :'Boolean',
47
- :'configuration' => :'JobHttpConfiguration'
55
+ :'schedule' => :'String',
56
+ :'configuration' => :'JobHttpConfiguration',
57
+ :'next_run_at' => :'Time'
48
58
  }
49
59
  end
50
60
 
51
61
  # List of attributes with nullable: true
52
62
  def self.openapi_nullable
53
63
  Set.new([
54
- :'configuration'
64
+ :'schedule',
65
+ :'configuration',
66
+ :'next_run_at'
55
67
  ])
56
68
  end
57
69
 
@@ -77,9 +89,17 @@ module SmplkitGeneratedClient::Jobs
77
89
  self.enabled = false
78
90
  end
79
91
 
92
+ if attributes.key?(:'schedule')
93
+ self.schedule = attributes[:'schedule']
94
+ end
95
+
80
96
  if attributes.key?(:'configuration')
81
97
  self.configuration = attributes[:'configuration']
82
98
  end
99
+
100
+ if attributes.key?(:'next_run_at')
101
+ self.next_run_at = attributes[:'next_run_at']
102
+ end
83
103
  end
84
104
 
85
105
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -103,7 +123,9 @@ module SmplkitGeneratedClient::Jobs
103
123
  return true if self.equal?(o)
104
124
  self.class == o.class &&
105
125
  enabled == o.enabled &&
106
- configuration == o.configuration
126
+ schedule == o.schedule &&
127
+ configuration == o.configuration &&
128
+ next_run_at == o.next_run_at
107
129
  end
108
130
 
109
131
  # @see the `==` method
@@ -115,7 +137,7 @@ module SmplkitGeneratedClient::Jobs
115
137
  # Calculates hash code according to all attributes.
116
138
  # @return [Integer] Hash code
117
139
  def hash
118
- [enabled, configuration].hash
140
+ [enabled, schedule, configuration, next_run_at].hash
119
141
  end
120
142
 
121
143
  # Builds the object from hash
@@ -25,10 +25,10 @@ module SmplkitGeneratedClient::Jobs
25
25
  # Runs included in the plan this period (`-1` means unlimited).
26
26
  attr_accessor :runs_included
27
27
 
28
- # Number of currently-enabled jobs.
28
+ # Number of recurring (scheduled) jobs.
29
29
  attr_accessor :active_jobs
30
30
 
31
- # Maximum enabled jobs the plan allows (`-1` means unlimited).
31
+ # Maximum recurring jobs the plan allows (`-1` means unlimited).
32
32
  attr_accessor :active_jobs_limit
33
33
 
34
34
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -71,12 +71,11 @@ describe 'JobsApi' do
71
71
 
72
72
  # unit tests for list_jobs
73
73
  # List Jobs
74
- # List this account&#39;s jobs. Default sort is &#x60;name&#x60; ascending. Sort by &#x60;name&#x60;, &#x60;created_at&#x60;, &#x60;updated_at&#x60;, &#x60;next_run_at&#x60;, or &#x60;enabled&#x60;, ascending or descending (prefix &#x60;-&#x60; for descending). Filter with &#x60;filter[enabled]&#x60; (enabled in at least one environment), &#x60;filter[recurring]&#x60;, and &#x60;filter[name]&#x60; (case-insensitive substring match on the name); filters compose with AND. A scoped caller sees each job&#39;s &#x60;environments&#x60; map narrowed to the environments it may access.
74
+ # List this account&#39;s jobs. Default sort is &#x60;name&#x60; ascending. Sort by &#x60;name&#x60;, &#x60;created_at&#x60;, or &#x60;updated_at&#x60;, ascending or descending (prefix &#x60;-&#x60; for descending). Filter with &#x60;filter[recurring]&#x60; and &#x60;filter[name]&#x60; (case-insensitive substring match on the name); filters compose with AND. Each job reports its per-environment enablement and &#x60;next_run_at&#x60; inside its &#x60;environments&#x60; map; a scoped caller sees that map narrowed to the environments it may access.
75
75
  # @param [Hash] opts the optional parameters
76
- # @option opts [Boolean] :filter_enabled
77
76
  # @option opts [Boolean] :filter_recurring
78
77
  # @option opts [String] :filter_name Case-insensitive substring match on the job &#x60;name&#x60; (matches when the name contains the given text).
79
- # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;name&#x60;. Allowed values: &#x60;created_at&#x60;, &#x60;-created_at&#x60;, &#x60;enabled&#x60;, &#x60;-enabled&#x60;, &#x60;name&#x60;, &#x60;-name&#x60;, &#x60;next_run_at&#x60;, &#x60;-next_run_at&#x60;, &#x60;updated_at&#x60;, &#x60;-updated_at&#x60;.
78
+ # @option opts [String] :sort Field to sort by. Prefix with &#x60;-&#x60; for descending order. Default: &#x60;name&#x60;. Allowed values: &#x60;created_at&#x60;, &#x60;-created_at&#x60;, &#x60;name&#x60;, &#x60;-name&#x60;, &#x60;updated_at&#x60;, &#x60;-updated_at&#x60;.
80
79
  # @option opts [Integer] :page_number 1-based page number to return. Optional; defaults to &#x60;1&#x60; when omitted. Must be &#x60;&gt;&#x3D; 1&#x60; — requests with a smaller value are rejected with a 400 error.
81
80
  # @option opts [Integer] :page_size Number of items per page. Optional; defaults to &#x60;1000&#x60; when omitted. Must be between &#x60;1&#x60; and &#x60;1000&#x60; inclusive — requests outside that range are rejected with a 400 error.
82
81
  # @option opts [Boolean] :meta_total When &#x60;true&#x60;, the response&#39;s &#x60;meta.pagination&#x60; block includes &#x60;total&#x60; (the total number of matching items across all pages) and &#x60;total_pages&#x60;. Computing these requires an extra &#x60;COUNT&#x60; query, so omit (or pass &#x60;false&#x60;) when the totals are not needed. Defaults to &#x60;false&#x60;.
@@ -102,7 +101,7 @@ describe 'JobsApi' do
102
101
 
103
102
  # unit tests for update_job
104
103
  # Update Job
105
- # Replace an existing job. Every writable field is overwritten. Set enablement per environment via the &#x60;environments&#x60; map (a recurring job), or by recreating a one-off job in the desired environment. Editing the schedule recomputes the next fire time; changing only which environments are enabled preserves the existing cadence.
104
+ # Replace an existing job. Every writable field is overwritten. Set enablement per environment via the &#x60;environments&#x60; map (a recurring job), or by recreating a one-off job in the desired environment. Each environment may carry its own cron &#x60;schedule&#x60; override. Editing an environment&#39;s effective schedule recomputes its next fire time; an edit that leaves an environment&#39;s schedule unchanged preserves its existing cadence.
106
105
  # @param job_id
107
106
  # @param job_request
108
107
  # @param [Hash] opts the optional parameters
@@ -34,7 +34,7 @@ describe 'UsageApi' do
34
34
 
35
35
  # unit tests for get_usage
36
36
  # Get Usage
37
- # Report this account&#39;s current-period usage against its plan allotments. &#x60;runs_used&#x60; is the number of runs metered so far this calendar month; &#x60;active_jobs&#x60; is the number of currently-enabled jobs.
37
+ # Report this account&#39;s current-period usage against its plan allotments. &#x60;runs_used&#x60; is the number of runs metered so far this calendar month; &#x60;active_jobs&#x60; is the number of recurring (scheduled) jobs, which is what the plan&#39;s job limit bounds.
38
38
  # @param [Hash] opts the optional parameters
39
39
  # @option opts [String] :filter_period
40
40
  # @return [UsageResponse]
@@ -33,10 +33,22 @@ describe SmplkitGeneratedClient::Jobs::JobEnvironment do
33
33
  end
34
34
  end
35
35
 
36
+ describe 'test attribute "schedule"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
36
42
  describe 'test attribute "configuration"' do
37
43
  it 'should work' do
38
44
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
45
  end
40
46
  end
41
47
 
48
+ describe 'test attribute "next_run_at"' do
49
+ it 'should work' do
50
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
51
+ end
52
+ end
53
+
42
54
  end
@@ -39,12 +39,6 @@ describe SmplkitGeneratedClient::Jobs::Job do
39
39
  end
40
40
  end
41
41
 
42
- describe 'test attribute "enabled"' do
43
- it 'should work' do
44
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
- end
46
- end
47
-
48
42
  describe 'test attribute "type"' do
49
43
  it 'should work' do
50
44
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -83,12 +77,6 @@ describe SmplkitGeneratedClient::Jobs::Job do
83
77
  end
84
78
  end
85
79
 
86
- describe 'test attribute "next_run_at"' do
87
- it 'should work' do
88
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
89
- end
90
- end
91
-
92
80
  describe 'test attribute "recurring"' do
93
81
  it 'should work' do
94
82
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -194,10 +194,10 @@ module Smplkit
194
194
  # @param environments [Hash{String => Smplkit::Jobs::JobEnvironment, Hash}, nil]
195
195
  # Per-environment overrides for a recurring job, keyed by environment key
196
196
  # — each a {Smplkit::Jobs::JobEnvironment}, or a plain hash
197
- # (+{ enabled: true }+, optionally with a +:configuration+
198
- # {Smplkit::Jobs::HttpConfig} override). A recurring job fires only in
199
- # environments enabled here. Ignored for a one-off job, which is born in
200
- # +environment+ below.
197
+ # (+{ enabled: true }+, optionally with a +:schedule+ cron override and/or
198
+ # a +:configuration+ {Smplkit::Jobs::HttpConfig} override). A recurring
199
+ # job fires only in environments enabled here. Ignored for a one-off job,
200
+ # which is born in +environment+ below.
201
201
  # @param concurrency_policy [String] How overlapping runs are handled.
202
202
  # Defaults to +"ALLOW"+.
203
203
  # @param environment [String, nil] For a one-off job (+"now"+ / datetime
@@ -221,8 +221,6 @@ module Smplkit
221
221
 
222
222
  # List jobs for the authenticated account.
223
223
  #
224
- # @param enabled [Boolean, nil] Filter to jobs matching this enabled state
225
- # (the server-derived roll-up across environments).
226
224
  # @param recurring [Boolean, nil] Filter to recurring (+true+) or one-off
227
225
  # (+false+) jobs. +nil+ lists both.
228
226
  # @param name [String, nil] Filter to jobs whose name contains this text
@@ -230,9 +228,8 @@ module Smplkit
230
228
  # @param page_number [Integer, nil] 1-based page number to return.
231
229
  # @param page_size [Integer, nil] Items per page.
232
230
  # @return [Array<Smplkit::Jobs::Job>]
233
- def list(enabled: nil, recurring: nil, name: nil, page_number: nil, page_size: nil)
231
+ def list(recurring: nil, name: nil, page_number: nil, page_size: nil)
234
232
  opts = {}
235
- opts[:filter_enabled] = enabled unless enabled.nil?
236
233
  opts[:filter_recurring] = recurring unless recurring.nil?
237
234
  opts[:filter_name] = name unless name.nil?
238
235
  opts[:page_number] = page_number unless page_number.nil?
@@ -318,12 +315,14 @@ module Smplkit
318
315
 
319
316
  # Convert the wrapper +environments+ map to the generated model hash.
320
317
  #
321
- # Each entry's +enabled+ is always written; a per-environment
322
- # +configuration+ override is sent as a full {HttpConfig} payload only when
323
- # present (omit to inherit the base configuration).
318
+ # Each entry's +enabled+ is always written; a per-environment +schedule+
319
+ # (cron) override and +configuration+ override are each sent only when
320
+ # present (omit to inherit the job's base +schedule+ / +configuration+).
321
+ # The read-only per-environment +next_run_at+ is never written.
324
322
  def environments_to_wire(environments)
325
323
  (environments || {}).each_with_object({}) do |(env_key, env), out|
326
324
  attrs = { enabled: env.enabled }
325
+ attrs[:schedule] = env.schedule unless env.schedule.nil?
327
326
  attrs[:configuration] = HttpConfig.to_wire(env.configuration) unless env.configuration.nil?
328
327
  out[env_key.to_s] = SmplkitGeneratedClient::Jobs::JobEnvironment.new(attrs)
329
328
  end
@@ -13,8 +13,9 @@ module Smplkit
13
13
  #
14
14
  # A job is enabled per environment: a recurring (cron) job may run in several
15
15
  # environments at once, a one-off (+now+ / future datetime) job runs a single
16
- # time in the environment it was created in. Base +enabled+ is a read-only,
17
- # server-derived roll-up (+true+ when enabled in at least one environment).
16
+ # time in the environment it was created in. Base {Job#enabled} is a derived
17
+ # roll-up (+true+ when enabled in at least one environment), computed from the
18
+ # per-environment {Job#environments} map.
18
19
  module Jobs
19
20
  # Wrap a generated-jobs-API call and translate +ApiError+ into the
20
21
  # +Smplkit::Error+ hierarchy. Connection-level failures (no response
@@ -73,10 +74,10 @@ module Smplkit
73
74
  # Coerce a caller's +environments+ map to {JobEnvironment} instances.
74
75
  #
75
76
  # Accepts either {JobEnvironment} values or plain hashes
76
- # (+{ enabled: true, configuration: HttpConfig.new(...) }+) so callers can
77
- # use the lightweight hash form without importing the model. A dict-form
78
- # +configuration+ override is coerced to an {HttpConfig} so it serializes on
79
- # save.
77
+ # (+{ enabled: true, schedule: "0 3 * * *", configuration: HttpConfig.new(...) }+)
78
+ # so callers can use the lightweight hash form without importing the model. A
79
+ # dict-form +configuration+ override is coerced to an {HttpConfig} so it
80
+ # serializes on save; an optional +schedule+ cron override passes through.
80
81
  #
81
82
  # @api private
82
83
  def self.normalize_environments(environments)
@@ -90,6 +91,7 @@ module Smplkit
90
91
  cfg = HttpConfig.new(**cfg) if cfg.is_a?(Hash)
91
92
  JobEnvironment.new(
92
93
  enabled: value[:enabled] || value["enabled"] || false,
94
+ schedule: value[:schedule] || value["schedule"],
93
95
  configuration: cfg
94
96
  )
95
97
  end
@@ -244,7 +246,7 @@ module Smplkit
244
246
  end
245
247
  # rubocop:enable Lint/StructNewOverride
246
248
 
247
- # Per-environment enablement and optional configuration override for a job.
249
+ # Per-environment enablement, schedule, and configuration override for a job.
248
250
  #
249
251
  # A recurring job fires in a given environment only when that environment
250
252
  # has an entry in {Job#environments} with +enabled: true+; an environment
@@ -253,14 +255,24 @@ module Smplkit
253
255
  # @!attribute [rw] enabled
254
256
  # @return [Boolean] Whether the job fires in this environment. Defaults to
255
257
  # +false+.
258
+ # @!attribute [rw] schedule
259
+ # @return [String, nil] Optional per-environment cron schedule override
260
+ # that varies the cadence in this environment. +nil+ (the default)
261
+ # inherits the job's base {Job#schedule}. When present, it must be a
262
+ # 5-field UTC cron expression and is only meaningful on a recurring job —
263
+ # it cannot turn a one-off job recurring or vice-versa.
256
264
  # @!attribute [rw] configuration
257
265
  # @return [HttpConfig, nil] Optional per-environment request configuration
258
266
  # that fully replaces the job's base {Job#configuration} for this
259
267
  # environment. +nil+ (the default) inherits the base configuration. As
260
268
  # with the base configuration, header values are returned in plaintext on
261
269
  # reads, so a get-mutate-put round-trip preserves them.
262
- JobEnvironment = Struct.new(:enabled, :configuration, keyword_init: true) do
263
- def initialize(enabled: false, configuration: nil)
270
+ # @!attribute [rw] next_run_at
271
+ # @return [String, nil] Read-only. The next scheduled fire time in this
272
+ # environment. +nil+ when the environment is not enabled, or once a
273
+ # one-off run has fired. Never written back on save.
274
+ JobEnvironment = Struct.new(:enabled, :schedule, :configuration, :next_run_at, keyword_init: true) do
275
+ def initialize(enabled: false, schedule: nil, configuration: nil, next_run_at: nil)
264
276
  super
265
277
  end
266
278
 
@@ -275,7 +287,9 @@ module Smplkit
275
287
  cfg = src.configuration
276
288
  new(
277
289
  enabled: src.enabled.nil? ? false : src.enabled,
278
- configuration: cfg.nil? ? nil : HttpConfig.from_wire(cfg)
290
+ schedule: src.schedule,
291
+ configuration: cfg.nil? ? nil : HttpConfig.from_wire(cfg),
292
+ next_run_at: src.next_run_at
279
293
  )
280
294
  end
281
295
  end
@@ -289,9 +303,10 @@ module Smplkit
289
303
  # values without re-entering secrets.
290
304
  #
291
305
  # Enablement is per environment, set via {#set_enabled} (and read via
292
- # {#is_enabled}); base {#enabled} is a read-only roll-up. The schedule is
293
- # environment-agnostic — one cron / datetime / +now+ shared across every
294
- # environment the job runs in.
306
+ # {#is_enabled}); base {#enabled} is a derived roll-up over {#environments}.
307
+ # The base schedule is environment-agnostic — one cron / datetime / +now+
308
+ # shared across every environment the job runs in — while each environment
309
+ # may carry its own cron {#set_schedule} override.
295
310
  class Job
296
311
  # @return [String] Caller-supplied unique identifier for the job (the
297
312
  # resource +id+). Unique within the account and immutable; the service
@@ -304,11 +319,13 @@ module Smplkit
304
319
  # @return [String, nil] Free-text description. +nil+ when unset.
305
320
  attr_accessor :description
306
321
 
307
- # @return [Boolean] Read-only, server-derived roll-up: +true+ when the job
308
- # is enabled in at least one environment. Set enablement per environment
309
- # via {#set_enabled} / {#environments}; mutating this field directly has
310
- # no effect on the server (it is never written).
311
- attr_accessor :enabled
322
+ # @return [Boolean] Derived roll-up: +true+ when the job is enabled in at
323
+ # least one environment. Computed from {#environments} rather than read
324
+ # from the wire the API no longer carries a top-level +enabled+. Set
325
+ # enablement per environment via {#set_enabled} / {#environments}.
326
+ def enabled
327
+ (@environments || {}).each_value.any?(&:enabled)
328
+ end
312
329
 
313
330
  # @return [Hash{String => JobEnvironment}] Per-environment overrides keyed
314
331
  # by environment key (e.g. +"production"+). The writable surface for
@@ -341,10 +358,6 @@ module Smplkit
341
358
  # value) permits them.
342
359
  attr_accessor :concurrency_policy
343
360
 
344
- # @return [String, nil] The next scheduled fire time. +nil+ once a one-off
345
- # job has fired.
346
- attr_accessor :next_run_at
347
-
348
361
  # @return [String, nil] ISO-8601 timestamp of first persist. +nil+ for an
349
362
  # unsaved instance.
350
363
  attr_accessor :created_at
@@ -366,23 +379,21 @@ module Smplkit
366
379
  attr_accessor :birth_environment
367
380
 
368
381
  def initialize(client = nil, id:, name:, schedule:, configuration:,
369
- description: nil, environments: nil, enabled: false,
382
+ description: nil, environments: nil,
370
383
  recurring: nil, type: "http", concurrency_policy: "ALLOW",
371
- birth_environment: nil, next_run_at: nil, created_at: nil,
384
+ birth_environment: nil, created_at: nil,
372
385
  updated_at: nil, deleted_at: nil, version: nil)
373
386
  @client = client
374
387
  @id = id
375
388
  @name = name
376
389
  @description = description
377
390
  @environments = environments || {}
378
- @enabled = enabled
379
391
  @recurring = recurring
380
392
  @type = type
381
393
  @schedule = schedule
382
394
  @configuration = configuration
383
395
  @concurrency_policy = concurrency_policy
384
396
  @birth_environment = birth_environment
385
- @next_run_at = next_run_at
386
397
  @created_at = created_at
387
398
  @updated_at = updated_at
388
399
  @deleted_at = deleted_at
@@ -394,8 +405,8 @@ module Smplkit
394
405
  # Upsert behavior is driven by {#created_at}: a job with no +created_at+
395
406
  # is created (POST); otherwise it's full-replace updated (PUT). After the
396
407
  # call, every field is refreshed from the server response (including
397
- # newly-assigned +created_at+, +version+, +next_run_at+, and the derived
398
- # +enabled+ roll-up).
408
+ # newly-assigned +created_at+, +version+, and per-environment +next_run_at+
409
+ # inside {#environments}).
399
410
  #
400
411
  # @return [self]
401
412
  def save
@@ -440,7 +451,7 @@ module Smplkit
440
451
  # roll-up across every environment.
441
452
  # @return [Boolean]
442
453
  def is_enabled(environment: nil)
443
- return @enabled if environment.nil?
454
+ return enabled if environment.nil?
444
455
 
445
456
  override = @environments[environment]
446
457
  return false if override.nil?
@@ -485,17 +496,30 @@ module Smplkit
485
496
  @configuration
486
497
  end
487
498
 
488
- # Set the job's schedule.
499
+ # Set the job's schedule — base (+environment+ omitted) or per-environment.
489
500
  #
490
- # The schedule is environment-agnostic a job has a single cron /
491
- # datetime / +"now"+ schedule shared across every environment it runs in
492
- # (each enabled environment fires on the same cadence). There is no
493
- # per-environment schedule, so this setter takes no +environment+.
501
+ # With +environment+ omitted (the default), sets the base {#schedule}
502
+ # an ISO-8601 datetime, a 5-field UTC cron expression, or the literal
503
+ # +"now"+ which every environment inherits unless it overrides it.
504
+ #
505
+ # With +environment+ given, sets that environment's per-environment cron
506
+ # +schedule+ override on {#environments}, creating the override entry if it
507
+ # doesn't exist yet (preserving any already-set +enabled+ / +configuration+
508
+ # on it). A per-environment override is a cron expression only and varies
509
+ # the cadence within that environment; it cannot turn a one-off job
510
+ # recurring or vice-versa. Call {#save} to persist.
494
511
  #
495
512
  # @param schedule [String] An ISO-8601 datetime, a 5-field UTC cron
496
- # expression, or the literal +"now"+.
497
- def set_schedule(schedule)
498
- @schedule = schedule
513
+ # expression, or the literal +"now"+ (base); a 5-field UTC cron
514
+ # expression (per-environment).
515
+ # @param environment [String, nil] An environment key for a per-environment
516
+ # override, or +nil+ to set the base schedule.
517
+ def set_schedule(schedule, environment: nil)
518
+ if environment.nil?
519
+ @schedule = schedule
520
+ else
521
+ _environment_override(environment).schedule = schedule
522
+ end
499
523
  end
500
524
 
501
525
  # Trigger one immediate, manual run of this job (a +MANUAL+ run).
@@ -547,14 +571,12 @@ module Smplkit
547
571
  @id = other.id
548
572
  @name = other.name
549
573
  @description = other.description
550
- @enabled = other.enabled
551
574
  @environments = other.environments
552
575
  @recurring = other.recurring
553
576
  @type = other.type
554
577
  @schedule = other.schedule
555
578
  @configuration = other.configuration
556
579
  @concurrency_policy = other.concurrency_policy
557
- @next_run_at = other.next_run_at
558
580
  @created_at = other.created_at
559
581
  @updated_at = other.updated_at
560
582
  @deleted_at = other.deleted_at
@@ -577,16 +599,14 @@ module Smplkit
577
599
  id: resource.id,
578
600
  name: a.name,
579
601
  description: a.description,
580
- # The base +enabled+ is a server-derived roll-up; round-trip whatever
581
- # the server returned without assuming a default of true.
582
- enabled: a.enabled.nil? ? false : a.enabled,
602
+ # The base +enabled+ roll-up is derived from +environments+, not read
603
+ # from the wire the API no longer carries a top-level +enabled+.
583
604
  environments: environments,
584
605
  recurring: a.recurring,
585
606
  type: a.type || "http",
586
607
  schedule: a.schedule,
587
608
  configuration: HttpConfig.from_wire(a.configuration),
588
609
  concurrency_policy: a.concurrency_policy || "ALLOW",
589
- next_run_at: a.next_run_at,
590
610
  created_at: a.created_at,
591
611
  updated_at: a.updated_at,
592
612
  deleted_at: a.deleted_at,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smplkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.112
4
+ version: 3.0.113
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smpl Solutions LLC