files.com 1.1.584 → 1.1.585

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.
@@ -0,0 +1,485 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class Expectation
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Expectation ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
21
+ # int64 - Workspace ID. `0` means the default workspace.
22
+ def workspace_id
23
+ @attributes[:workspace_id]
24
+ end
25
+
26
+ def workspace_id=(value)
27
+ @attributes[:workspace_id] = value
28
+ end
29
+
30
+ # string - Expectation name.
31
+ def name
32
+ @attributes[:name]
33
+ end
34
+
35
+ def name=(value)
36
+ @attributes[:name] = value
37
+ end
38
+
39
+ # string - Expectation description.
40
+ def description
41
+ @attributes[:description]
42
+ end
43
+
44
+ def description=(value)
45
+ @attributes[:description] = value
46
+ end
47
+
48
+ # string - Path scope for the expectation. Supports workspace-relative presentation. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
49
+ def path
50
+ @attributes[:path]
51
+ end
52
+
53
+ def path=(value)
54
+ @attributes[:path] = value
55
+ end
56
+
57
+ # string - Source glob used to select candidate files.
58
+ def source
59
+ @attributes[:source]
60
+ end
61
+
62
+ def source=(value)
63
+ @attributes[:source] = value
64
+ end
65
+
66
+ # string - Optional source exclusion glob.
67
+ def exclude_pattern
68
+ @attributes[:exclude_pattern]
69
+ end
70
+
71
+ def exclude_pattern=(value)
72
+ @attributes[:exclude_pattern] = value
73
+ end
74
+
75
+ # boolean - If true, the expectation is disabled.
76
+ def disabled
77
+ @attributes[:disabled]
78
+ end
79
+
80
+ def disabled=(value)
81
+ @attributes[:disabled] = value
82
+ end
83
+
84
+ # int64 - Criteria schema version for this expectation.
85
+ def expectations_version
86
+ @attributes[:expectations_version]
87
+ end
88
+
89
+ def expectations_version=(value)
90
+ @attributes[:expectations_version] = value
91
+ end
92
+
93
+ # string - How this expectation opens windows.
94
+ def trigger
95
+ @attributes[:trigger]
96
+ end
97
+
98
+ def trigger=(value)
99
+ @attributes[:trigger] = value
100
+ end
101
+
102
+ # string - If trigger is `daily`, this specifies how often to run the expectation.
103
+ def interval
104
+ @attributes[:interval]
105
+ end
106
+
107
+ def interval=(value)
108
+ @attributes[:interval] = value
109
+ end
110
+
111
+ # int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
112
+ def recurring_day
113
+ @attributes[:recurring_day]
114
+ end
115
+
116
+ def recurring_day=(value)
117
+ @attributes[:recurring_day] = value
118
+ end
119
+
120
+ # array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
121
+ def schedule_days_of_week
122
+ @attributes[:schedule_days_of_week]
123
+ end
124
+
125
+ def schedule_days_of_week=(value)
126
+ @attributes[:schedule_days_of_week] = value
127
+ end
128
+
129
+ # array(string) - Times of day in HH:MM format for schedule-driven expectations.
130
+ def schedule_times_of_day
131
+ @attributes[:schedule_times_of_day]
132
+ end
133
+
134
+ def schedule_times_of_day=(value)
135
+ @attributes[:schedule_times_of_day] = value
136
+ end
137
+
138
+ # string - Time zone used by the expectation schedule.
139
+ def schedule_time_zone
140
+ @attributes[:schedule_time_zone]
141
+ end
142
+
143
+ def schedule_time_zone=(value)
144
+ @attributes[:schedule_time_zone] = value
145
+ end
146
+
147
+ # string - Optional holiday region used by schedule-driven expectations.
148
+ def holiday_region
149
+ @attributes[:holiday_region]
150
+ end
151
+
152
+ def holiday_region=(value)
153
+ @attributes[:holiday_region] = value
154
+ end
155
+
156
+ # int64 - How many seconds before the due boundary the window starts.
157
+ def lookback_interval
158
+ @attributes[:lookback_interval]
159
+ end
160
+
161
+ def lookback_interval=(value)
162
+ @attributes[:lookback_interval] = value
163
+ end
164
+
165
+ # int64 - How many seconds a schedule-driven window may remain eligible to close as late.
166
+ def late_acceptance_interval
167
+ @attributes[:late_acceptance_interval]
168
+ end
169
+
170
+ def late_acceptance_interval=(value)
171
+ @attributes[:late_acceptance_interval] = value
172
+ end
173
+
174
+ # int64 - How many quiet seconds are required before final closure.
175
+ def inactivity_interval
176
+ @attributes[:inactivity_interval]
177
+ end
178
+
179
+ def inactivity_interval=(value)
180
+ @attributes[:inactivity_interval] = value
181
+ end
182
+
183
+ # int64 - Hard-stop duration in seconds for unscheduled expectations.
184
+ def max_open_interval
185
+ @attributes[:max_open_interval]
186
+ end
187
+
188
+ def max_open_interval=(value)
189
+ @attributes[:max_open_interval] = value
190
+ end
191
+
192
+ # object - Structured criteria v1 definition for the expectation.
193
+ def criteria
194
+ @attributes[:criteria]
195
+ end
196
+
197
+ def criteria=(value)
198
+ @attributes[:criteria] = value
199
+ end
200
+
201
+ # date-time - Last time this expectation was evaluated.
202
+ def last_evaluated_at
203
+ @attributes[:last_evaluated_at]
204
+ end
205
+
206
+ def last_evaluated_at=(value)
207
+ @attributes[:last_evaluated_at] = value
208
+ end
209
+
210
+ # date-time - Last time this expectation closed successfully.
211
+ def last_success_at
212
+ @attributes[:last_success_at]
213
+ end
214
+
215
+ def last_success_at=(value)
216
+ @attributes[:last_success_at] = value
217
+ end
218
+
219
+ # date-time - Last time this expectation closed with a failure result.
220
+ def last_failure_at
221
+ @attributes[:last_failure_at]
222
+ end
223
+
224
+ def last_failure_at=(value)
225
+ @attributes[:last_failure_at] = value
226
+ end
227
+
228
+ # string - Most recent terminal result for this expectation.
229
+ def last_result
230
+ @attributes[:last_result]
231
+ end
232
+
233
+ def last_result=(value)
234
+ @attributes[:last_result] = value
235
+ end
236
+
237
+ # date-time - Creation time.
238
+ def created_at
239
+ @attributes[:created_at]
240
+ end
241
+
242
+ # date-time - Last update time.
243
+ def updated_at
244
+ @attributes[:updated_at]
245
+ end
246
+
247
+ # Manually open an Expectation window
248
+ def trigger_evaluation(params = {})
249
+ params ||= {}
250
+ params[:id] = @attributes[:id]
251
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
252
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
253
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
254
+
255
+ Api.send_request("/expectations/#{@attributes[:id]}/trigger_evaluation", :post, params, @options)
256
+ end
257
+
258
+ # Parameters:
259
+ # name - string - Expectation name.
260
+ # description - string - Expectation description.
261
+ # path - string - Path scope for the expectation. Supports workspace-relative presentation.
262
+ # source - string - Source glob used to select candidate files.
263
+ # exclude_pattern - string - Optional source exclusion glob.
264
+ # disabled - boolean - If true, the expectation is disabled.
265
+ # trigger - string - How this expectation opens windows.
266
+ # interval - string - If trigger is `daily`, this specifies how often to run the expectation.
267
+ # recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
268
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
269
+ # schedule_times_of_day - array(string) - Times of day in HH:MM format for schedule-driven expectations.
270
+ # schedule_time_zone - string - Time zone used by the expectation schedule.
271
+ # holiday_region - string - Optional holiday region used by schedule-driven expectations.
272
+ # lookback_interval - int64 - How many seconds before the due boundary the window starts.
273
+ # late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
274
+ # inactivity_interval - int64 - How many quiet seconds are required before final closure.
275
+ # max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
276
+ # criteria - object - Structured criteria v1 definition for the expectation.
277
+ # workspace_id - int64 - Workspace ID. `0` means the default workspace.
278
+ def update(params = {})
279
+ params ||= {}
280
+ params[:id] = @attributes[:id]
281
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
282
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
283
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
284
+ raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
285
+ raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
286
+ raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String)
287
+ raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String)
288
+ raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String)
289
+ raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String)
290
+ raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer)
291
+ raise InvalidParameterError.new("Bad parameter: schedule_days_of_week must be an Array") if params[:schedule_days_of_week] and !params[:schedule_days_of_week].is_a?(Array)
292
+ raise InvalidParameterError.new("Bad parameter: schedule_times_of_day must be an Array") if params[:schedule_times_of_day] and !params[:schedule_times_of_day].is_a?(Array)
293
+ raise InvalidParameterError.new("Bad parameter: schedule_time_zone must be an String") if params[:schedule_time_zone] and !params[:schedule_time_zone].is_a?(String)
294
+ raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String)
295
+ raise InvalidParameterError.new("Bad parameter: lookback_interval must be an Integer") if params[:lookback_interval] and !params[:lookback_interval].is_a?(Integer)
296
+ raise InvalidParameterError.new("Bad parameter: late_acceptance_interval must be an Integer") if params[:late_acceptance_interval] and !params[:late_acceptance_interval].is_a?(Integer)
297
+ raise InvalidParameterError.new("Bad parameter: inactivity_interval must be an Integer") if params[:inactivity_interval] and !params[:inactivity_interval].is_a?(Integer)
298
+ raise InvalidParameterError.new("Bad parameter: max_open_interval must be an Integer") if params[:max_open_interval] and !params[:max_open_interval].is_a?(Integer)
299
+ raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
300
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
301
+
302
+ Api.send_request("/expectations/#{@attributes[:id]}", :patch, params, @options)
303
+ end
304
+
305
+ def delete(params = {})
306
+ params ||= {}
307
+ params[:id] = @attributes[:id]
308
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
309
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
310
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
311
+
312
+ Api.send_request("/expectations/#{@attributes[:id]}", :delete, params, @options)
313
+ end
314
+
315
+ def destroy(params = {})
316
+ delete(params)
317
+ nil
318
+ end
319
+
320
+ def save
321
+ if @attributes[:id]
322
+ new_obj = update(@attributes)
323
+ else
324
+ new_obj = Expectation.create(@attributes, @options)
325
+ end
326
+
327
+ @attributes = new_obj.attributes
328
+ true
329
+ end
330
+
331
+ # Parameters:
332
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
333
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
334
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `name` or `disabled`.
335
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `disabled` and `workspace_id`. Valid field combinations are `[ workspace_id, disabled ]`.
336
+ def self.list(params = {}, options = {})
337
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
338
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
339
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
340
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
341
+
342
+ List.new(Expectation, params) do
343
+ Api.send_request("/expectations", :get, params, options)
344
+ end
345
+ end
346
+
347
+ def self.all(params = {}, options = {})
348
+ list(params, options)
349
+ end
350
+
351
+ # Parameters:
352
+ # id (required) - int64 - Expectation ID.
353
+ def self.find(id, params = {}, options = {})
354
+ params ||= {}
355
+ params[:id] = id
356
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
357
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
358
+
359
+ response, options = Api.send_request("/expectations/#{params[:id]}", :get, params, options)
360
+ Expectation.new(response.data, options)
361
+ end
362
+
363
+ def self.get(id, params = {}, options = {})
364
+ find(id, params, options)
365
+ end
366
+
367
+ # Parameters:
368
+ # name - string - Expectation name.
369
+ # description - string - Expectation description.
370
+ # path - string - Path scope for the expectation. Supports workspace-relative presentation.
371
+ # source - string - Source glob used to select candidate files.
372
+ # exclude_pattern - string - Optional source exclusion glob.
373
+ # disabled - boolean - If true, the expectation is disabled.
374
+ # trigger - string - How this expectation opens windows.
375
+ # interval - string - If trigger is `daily`, this specifies how often to run the expectation.
376
+ # recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
377
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
378
+ # schedule_times_of_day - array(string) - Times of day in HH:MM format for schedule-driven expectations.
379
+ # schedule_time_zone - string - Time zone used by the expectation schedule.
380
+ # holiday_region - string - Optional holiday region used by schedule-driven expectations.
381
+ # lookback_interval - int64 - How many seconds before the due boundary the window starts.
382
+ # late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
383
+ # inactivity_interval - int64 - How many quiet seconds are required before final closure.
384
+ # max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
385
+ # criteria - object - Structured criteria v1 definition for the expectation.
386
+ # workspace_id - int64 - Workspace ID. `0` means the default workspace.
387
+ def self.create(params = {}, options = {})
388
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
389
+ raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
390
+ raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
391
+ raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String)
392
+ raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String)
393
+ raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String)
394
+ raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String)
395
+ raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer)
396
+ raise InvalidParameterError.new("Bad parameter: schedule_days_of_week must be an Array") if params[:schedule_days_of_week] and !params[:schedule_days_of_week].is_a?(Array)
397
+ raise InvalidParameterError.new("Bad parameter: schedule_times_of_day must be an Array") if params[:schedule_times_of_day] and !params[:schedule_times_of_day].is_a?(Array)
398
+ raise InvalidParameterError.new("Bad parameter: schedule_time_zone must be an String") if params[:schedule_time_zone] and !params[:schedule_time_zone].is_a?(String)
399
+ raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String)
400
+ raise InvalidParameterError.new("Bad parameter: lookback_interval must be an Integer") if params[:lookback_interval] and !params[:lookback_interval].is_a?(Integer)
401
+ raise InvalidParameterError.new("Bad parameter: late_acceptance_interval must be an Integer") if params[:late_acceptance_interval] and !params[:late_acceptance_interval].is_a?(Integer)
402
+ raise InvalidParameterError.new("Bad parameter: inactivity_interval must be an Integer") if params[:inactivity_interval] and !params[:inactivity_interval].is_a?(Integer)
403
+ raise InvalidParameterError.new("Bad parameter: max_open_interval must be an Integer") if params[:max_open_interval] and !params[:max_open_interval].is_a?(Integer)
404
+ raise InvalidParameterError.new("Bad parameter: criteria must be an Hash") if params[:criteria] and !params[:criteria].is_a?(Hash)
405
+ raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
406
+
407
+ response, options = Api.send_request("/expectations", :post, params, options)
408
+ Expectation.new(response.data, options)
409
+ end
410
+
411
+ # Manually open an Expectation window
412
+ def self.trigger_evaluation(id, params = {}, options = {})
413
+ params ||= {}
414
+ params[:id] = id
415
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
416
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
417
+
418
+ response, options = Api.send_request("/expectations/#{params[:id]}/trigger_evaluation", :post, params, options)
419
+ ExpectationEvaluation.new(response.data, options)
420
+ end
421
+
422
+ # Parameters:
423
+ # name - string - Expectation name.
424
+ # description - string - Expectation description.
425
+ # path - string - Path scope for the expectation. Supports workspace-relative presentation.
426
+ # source - string - Source glob used to select candidate files.
427
+ # exclude_pattern - string - Optional source exclusion glob.
428
+ # disabled - boolean - If true, the expectation is disabled.
429
+ # trigger - string - How this expectation opens windows.
430
+ # interval - string - If trigger is `daily`, this specifies how often to run the expectation.
431
+ # recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
432
+ # schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
433
+ # schedule_times_of_day - array(string) - Times of day in HH:MM format for schedule-driven expectations.
434
+ # schedule_time_zone - string - Time zone used by the expectation schedule.
435
+ # holiday_region - string - Optional holiday region used by schedule-driven expectations.
436
+ # lookback_interval - int64 - How many seconds before the due boundary the window starts.
437
+ # late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
438
+ # inactivity_interval - int64 - How many quiet seconds are required before final closure.
439
+ # max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
440
+ # criteria - object - Structured criteria v1 definition for the expectation.
441
+ # workspace_id - int64 - Workspace ID. `0` means the default workspace.
442
+ def self.update(id, params = {}, options = {})
443
+ params ||= {}
444
+ params[:id] = id
445
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
446
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
447
+ raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
448
+ raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
449
+ raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String)
450
+ raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String)
451
+ raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String)
452
+ raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String)
453
+ raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer)
454
+ raise InvalidParameterError.new("Bad parameter: schedule_days_of_week must be an Array") if params[:schedule_days_of_week] and !params[:schedule_days_of_week].is_a?(Array)
455
+ raise InvalidParameterError.new("Bad parameter: schedule_times_of_day must be an Array") if params[:schedule_times_of_day] and !params[:schedule_times_of_day].is_a?(Array)
456
+ raise InvalidParameterError.new("Bad parameter: schedule_time_zone must be an String") if params[:schedule_time_zone] and !params[:schedule_time_zone].is_a?(String)
457
+ raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String)
458
+ raise InvalidParameterError.new("Bad parameter: lookback_interval must be an Integer") if params[:lookback_interval] and !params[:lookback_interval].is_a?(Integer)
459
+ raise InvalidParameterError.new("Bad parameter: late_acceptance_interval must be an Integer") if params[:late_acceptance_interval] and !params[:late_acceptance_interval].is_a?(Integer)
460
+ raise InvalidParameterError.new("Bad parameter: inactivity_interval must be an Integer") if params[:inactivity_interval] and !params[:inactivity_interval].is_a?(Integer)
461
+ raise InvalidParameterError.new("Bad parameter: max_open_interval must be an Integer") if params[:max_open_interval] and !params[:max_open_interval].is_a?(Integer)
462
+ raise InvalidParameterError.new("Bad parameter: criteria must be an Hash") if params[:criteria] and !params[:criteria].is_a?(Hash)
463
+ raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
464
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
465
+
466
+ response, options = Api.send_request("/expectations/#{params[:id]}", :patch, params, options)
467
+ Expectation.new(response.data, options)
468
+ end
469
+
470
+ def self.delete(id, params = {}, options = {})
471
+ params ||= {}
472
+ params[:id] = id
473
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
474
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
475
+
476
+ Api.send_request("/expectations/#{params[:id]}", :delete, params, options)
477
+ nil
478
+ end
479
+
480
+ def self.destroy(id, params = {}, options = {})
481
+ delete(id, params, options)
482
+ nil
483
+ end
484
+ end
485
+ end
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class ExpectationEvaluation
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - ExpectationEvaluation ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # int64 - Workspace ID. `0` means the default workspace.
18
+ def workspace_id
19
+ @attributes[:workspace_id]
20
+ end
21
+
22
+ # int64 - Expectation ID.
23
+ def expectation_id
24
+ @attributes[:expectation_id]
25
+ end
26
+
27
+ # string - Evaluation status.
28
+ def status
29
+ @attributes[:status]
30
+ end
31
+
32
+ # string - How the evaluation window was opened.
33
+ def opened_via
34
+ @attributes[:opened_via]
35
+ end
36
+
37
+ # date-time - When the evaluation row was opened.
38
+ def opened_at
39
+ @attributes[:opened_at]
40
+ end
41
+
42
+ # date-time - Logical start of the candidate window.
43
+ def window_start_at
44
+ @attributes[:window_start_at]
45
+ end
46
+
47
+ # date-time - Actual candidate cutoff boundary for the window.
48
+ def window_end_at
49
+ @attributes[:window_end_at]
50
+ end
51
+
52
+ # date-time - Logical due boundary for schedule-driven windows.
53
+ def deadline_at
54
+ @attributes[:deadline_at]
55
+ end
56
+
57
+ # date-time - Logical cutoff for late acceptance, when present.
58
+ def late_acceptance_cutoff_at
59
+ @attributes[:late_acceptance_cutoff_at]
60
+ end
61
+
62
+ # date-time - Hard stop after which the window may not remain open.
63
+ def hard_close_at
64
+ @attributes[:hard_close_at]
65
+ end
66
+
67
+ # date-time - When the evaluation row was finalized.
68
+ def closed_at
69
+ @attributes[:closed_at]
70
+ end
71
+
72
+ # array(object) - Captured evidence for files that matched the window.
73
+ def matched_files
74
+ @attributes[:matched_files]
75
+ end
76
+
77
+ # array(object) - Captured evidence for required files that were missing.
78
+ def missing_files
79
+ @attributes[:missing_files]
80
+ end
81
+
82
+ # array(object) - Captured criteria failures for the window.
83
+ def criteria_errors
84
+ @attributes[:criteria_errors]
85
+ end
86
+
87
+ # object - Compact evaluator summary payload.
88
+ def summary
89
+ @attributes[:summary]
90
+ end
91
+
92
+ # date-time - Creation time.
93
+ def created_at
94
+ @attributes[:created_at]
95
+ end
96
+
97
+ # date-time - Last update time.
98
+ def updated_at
99
+ @attributes[:updated_at]
100
+ end
101
+
102
+ # Parameters:
103
+ # cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
104
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
105
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `created_at` or `expectation_id`.
106
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `expectation_id` and `workspace_id`. Valid field combinations are `[ workspace_id, expectation_id ]`.
107
+ def self.list(params = {}, options = {})
108
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
109
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
110
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
111
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
112
+
113
+ List.new(ExpectationEvaluation, params) do
114
+ Api.send_request("/expectation_evaluations", :get, params, options)
115
+ end
116
+ end
117
+
118
+ def self.all(params = {}, options = {})
119
+ list(params, options)
120
+ end
121
+
122
+ # Parameters:
123
+ # id (required) - int64 - Expectation Evaluation ID.
124
+ def self.find(id, params = {}, options = {})
125
+ params ||= {}
126
+ params[:id] = id
127
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
128
+ raise MissingParameterError.new("Parameter missing: id") unless params[:id]
129
+
130
+ response, options = Api.send_request("/expectation_evaluations/#{params[:id]}", :get, params, options)
131
+ ExpectationEvaluation.new(response.data, options)
132
+ end
133
+
134
+ def self.get(id, params = {}, options = {})
135
+ find(id, params, options)
136
+ end
137
+ end
138
+ end