Class: Files::Expectation

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/expectation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ Expectation

Returns a new instance of Expectation.



7
8
9
10
# File 'lib/files.com/models/expectation.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/expectation.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/expectation.rb', line 5

def options
  @options
end

Class Method Details

.all(params = {}, options = {}) ⇒ Object



358
359
360
# File 'lib/files.com/models/expectation.rb', line 358

def self.all(params = {}, options = {})
  list(params, options)
end

.create(params = {}, options = {}) ⇒ Object

Parameters:

name - string - Expectation name.
description - string - Expectation description.
path - string - Path scope for the expectation. Supports workspace-relative presentation.
source - string - Source glob used to select candidate files.
exclude_pattern - string - Optional source exclusion glob.
disabled - boolean - If true, the expectation is disabled.
trigger - string - How this expectation opens windows.
interval - string - If trigger is `daily`, this specifies how often to run the expectation.
recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
schedule_id - int64 - If trigger is `custom_schedule`, the reusable Schedule used instead of the Expectation's schedule fields.
schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
schedule_times_of_day - array(string) - Times of day in HH:MM format for the Expectation schedule.
schedule_time_zone - string - Time zone used by the Expectation schedule.
holiday_region - string - Optional holiday region used by the Expectation schedule.
lookback_interval - int64 - How many seconds before the due boundary the window starts.
late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
inactivity_interval - int64 - How many quiet seconds are required before final closure.
max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
criteria - object - Versioned success criteria definition for the expectation, including optional Files Transform Script content validation in criteria v2.
workspace_id - int64 - Workspace ID. `0` means the default workspace.


399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/files.com/models/expectation.rb', line 399

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: schedule_id must be an Integer") if params[:schedule_id] and !params[:schedule_id].is_a?(Integer)
  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)
  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)
  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)
  raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: lookback_interval must be an Integer") if params[:lookback_interval] and !params[:lookback_interval].is_a?(Integer)
  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)
  raise InvalidParameterError.new("Bad parameter: inactivity_interval must be an Integer") if params[:inactivity_interval] and !params[:inactivity_interval].is_a?(Integer)
  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)
  raise InvalidParameterError.new("Bad parameter: criteria must be an Hash") if params[:criteria] and !params[:criteria].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)

  response, options = Api.send_request("/expectations", :post, params, options)
  Expectation.new(response.data, options)
end

.delete(id, params = {}, options = {}) ⇒ Object



485
486
487
488
489
490
491
492
493
# File 'lib/files.com/models/expectation.rb', line 485

def self.delete(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/expectations/#{params[:id]}", :delete, params, options)
  nil
end

.destroy(id, params = {}, options = {}) ⇒ Object



495
496
497
498
# File 'lib/files.com/models/expectation.rb', line 495

def self.destroy(id, params = {}, options = {})
  delete(id, params, options)
  nil
end

.find(id, params = {}, options = {}) ⇒ Object

Parameters:

id (required) - int64 - Expectation ID.


364
365
366
367
368
369
370
371
372
# File 'lib/files.com/models/expectation.rb', line 364

def self.find(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/expectations/#{params[:id]}", :get, params, options)
  Expectation.new(response.data, options)
end

.get(id, params = {}, options = {}) ⇒ Object



374
375
376
# File 'lib/files.com/models/expectation.rb', line 374

def self.get(id, params = {}, options = {})
  find(id, params, options)
end

.list(params = {}, options = {}) ⇒ Object

Parameters:

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.
per_page - int64 - Number of records to show per page.  (Max: 10000, 1,000 or less is recommended).
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`.
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 ]`.


347
348
349
350
351
352
353
354
355
356
# File 'lib/files.com/models/expectation.rb', line 347

def self.list(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)

  List.new(Expectation, params) do
    Api.send_request("/expectations", :get, params, options)
  end
end

.trigger_evaluation(id, params = {}, options = {}) ⇒ Object

Manually open an Expectation window



425
426
427
428
429
430
431
432
433
# File 'lib/files.com/models/expectation.rb', line 425

def self.trigger_evaluation(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/expectations/#{params[:id]}/trigger_evaluation", :post, params, options)
  ExpectationEvaluation.new(response.data, options)
end

.update(id, params = {}, options = {}) ⇒ Object

Parameters:

name - string - Expectation name.
description - string - Expectation description.
path - string - Path scope for the expectation. Supports workspace-relative presentation.
source - string - Source glob used to select candidate files.
exclude_pattern - string - Optional source exclusion glob.
disabled - boolean - If true, the expectation is disabled.
trigger - string - How this expectation opens windows.
interval - string - If trigger is `daily`, this specifies how often to run the expectation.
recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
schedule_id - int64 - If trigger is `custom_schedule`, the reusable Schedule used instead of the Expectation's schedule fields.
schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
schedule_times_of_day - array(string) - Times of day in HH:MM format for the Expectation schedule.
schedule_time_zone - string - Time zone used by the Expectation schedule.
holiday_region - string - Optional holiday region used by the Expectation schedule.
lookback_interval - int64 - How many seconds before the due boundary the window starts.
late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
inactivity_interval - int64 - How many quiet seconds are required before final closure.
max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
criteria - object - Versioned success criteria definition for the expectation, including optional Files Transform Script content validation in criteria v2.
workspace_id - int64 - Workspace ID. `0` means the default workspace.


456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/files.com/models/expectation.rb', line 456

def self.update(id, params = {}, options = {})
  params ||= {}
  params[:id] = id
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: schedule_id must be an Integer") if params[:schedule_id] and !params[:schedule_id].is_a?(Integer)
  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)
  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)
  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)
  raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: lookback_interval must be an Integer") if params[:lookback_interval] and !params[:lookback_interval].is_a?(Integer)
  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)
  raise InvalidParameterError.new("Bad parameter: inactivity_interval must be an Integer") if params[:inactivity_interval] and !params[:inactivity_interval].is_a?(Integer)
  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)
  raise InvalidParameterError.new("Bad parameter: criteria must be an Hash") if params[:criteria] and !params[:criteria].is_a?(Hash)
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  response, options = Api.send_request("/expectations/#{params[:id]}", :patch, params, options)
  Expectation.new(response.data, options)
end

Instance Method Details

#created_atObject

date-time - Creation time.



247
248
249
# File 'lib/files.com/models/expectation.rb', line 247

def created_at
  @attributes[:created_at]
end

#criteriaObject

object - Versioned success criteria definition for the expectation. Criteria v2 supports optional FTS content validation.



202
203
204
# File 'lib/files.com/models/expectation.rb', line 202

def criteria
  @attributes[:criteria]
end

#criteria=(value) ⇒ Object



206
207
208
# File 'lib/files.com/models/expectation.rb', line 206

def criteria=(value)
  @attributes[:criteria] = value
end

#delete(params = {}) ⇒ Object



316
317
318
319
320
321
322
323
324
# File 'lib/files.com/models/expectation.rb', line 316

def delete(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/expectations/#{@attributes[:id]}", :delete, params, @options)
end

#descriptionObject

string - Expectation description.



40
41
42
# File 'lib/files.com/models/expectation.rb', line 40

def description
  @attributes[:description]
end

#description=(value) ⇒ Object



44
45
46
# File 'lib/files.com/models/expectation.rb', line 44

def description=(value)
  @attributes[:description] = value
end

#destroy(params = {}) ⇒ Object



326
327
328
329
# File 'lib/files.com/models/expectation.rb', line 326

def destroy(params = {})
  delete(params)
  nil
end

#disabledObject

boolean - If true, the expectation is disabled.



76
77
78
# File 'lib/files.com/models/expectation.rb', line 76

def disabled
  @attributes[:disabled]
end

#disabled=(value) ⇒ Object



80
81
82
# File 'lib/files.com/models/expectation.rb', line 80

def disabled=(value)
  @attributes[:disabled] = value
end

#exclude_patternObject

string - Optional source exclusion glob.



67
68
69
# File 'lib/files.com/models/expectation.rb', line 67

def exclude_pattern
  @attributes[:exclude_pattern]
end

#exclude_pattern=(value) ⇒ Object



71
72
73
# File 'lib/files.com/models/expectation.rb', line 71

def exclude_pattern=(value)
  @attributes[:exclude_pattern] = value
end

#expectations_versionObject

int64 - Criteria schema version for this expectation.



85
86
87
# File 'lib/files.com/models/expectation.rb', line 85

def expectations_version
  @attributes[:expectations_version]
end

#expectations_version=(value) ⇒ Object



89
90
91
# File 'lib/files.com/models/expectation.rb', line 89

def expectations_version=(value)
  @attributes[:expectations_version] = value
end

#holiday_regionObject

string - Optional holiday region used by the Expectation schedule.



157
158
159
# File 'lib/files.com/models/expectation.rb', line 157

def holiday_region
  @attributes[:holiday_region]
end

#holiday_region=(value) ⇒ Object



161
162
163
# File 'lib/files.com/models/expectation.rb', line 161

def holiday_region=(value)
  @attributes[:holiday_region] = value
end

#idObject

int64 - Expectation ID



13
14
15
# File 'lib/files.com/models/expectation.rb', line 13

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



17
18
19
# File 'lib/files.com/models/expectation.rb', line 17

def id=(value)
  @attributes[:id] = value
end

#inactivity_intervalObject

int64 - How many quiet seconds are required before final closure.



184
185
186
# File 'lib/files.com/models/expectation.rb', line 184

def inactivity_interval
  @attributes[:inactivity_interval]
end

#inactivity_interval=(value) ⇒ Object



188
189
190
# File 'lib/files.com/models/expectation.rb', line 188

def inactivity_interval=(value)
  @attributes[:inactivity_interval] = value
end

#intervalObject

string - If trigger is daily, this specifies how often to run the expectation.



103
104
105
# File 'lib/files.com/models/expectation.rb', line 103

def interval
  @attributes[:interval]
end

#interval=(value) ⇒ Object



107
108
109
# File 'lib/files.com/models/expectation.rb', line 107

def interval=(value)
  @attributes[:interval] = value
end

#last_evaluated_atObject

date-time - Last time this expectation was evaluated.



211
212
213
# File 'lib/files.com/models/expectation.rb', line 211

def last_evaluated_at
  @attributes[:last_evaluated_at]
end

#last_evaluated_at=(value) ⇒ Object



215
216
217
# File 'lib/files.com/models/expectation.rb', line 215

def last_evaluated_at=(value)
  @attributes[:last_evaluated_at] = value
end

#last_failure_atObject

date-time - Last time this expectation closed with a failure result.



229
230
231
# File 'lib/files.com/models/expectation.rb', line 229

def last_failure_at
  @attributes[:last_failure_at]
end

#last_failure_at=(value) ⇒ Object



233
234
235
# File 'lib/files.com/models/expectation.rb', line 233

def last_failure_at=(value)
  @attributes[:last_failure_at] = value
end

#last_resultObject

string - Most recent terminal result for this expectation.



238
239
240
# File 'lib/files.com/models/expectation.rb', line 238

def last_result
  @attributes[:last_result]
end

#last_result=(value) ⇒ Object



242
243
244
# File 'lib/files.com/models/expectation.rb', line 242

def last_result=(value)
  @attributes[:last_result] = value
end

#last_success_atObject

date-time - Last time this expectation closed successfully.



220
221
222
# File 'lib/files.com/models/expectation.rb', line 220

def last_success_at
  @attributes[:last_success_at]
end

#last_success_at=(value) ⇒ Object



224
225
226
# File 'lib/files.com/models/expectation.rb', line 224

def last_success_at=(value)
  @attributes[:last_success_at] = value
end

#late_acceptance_intervalObject

int64 - How many seconds a schedule-driven window may remain eligible to close as late.



175
176
177
# File 'lib/files.com/models/expectation.rb', line 175

def late_acceptance_interval
  @attributes[:late_acceptance_interval]
end

#late_acceptance_interval=(value) ⇒ Object



179
180
181
# File 'lib/files.com/models/expectation.rb', line 179

def late_acceptance_interval=(value)
  @attributes[:late_acceptance_interval] = value
end

#lookback_intervalObject

int64 - How many seconds before the due boundary the window starts.



166
167
168
# File 'lib/files.com/models/expectation.rb', line 166

def lookback_interval
  @attributes[:lookback_interval]
end

#lookback_interval=(value) ⇒ Object



170
171
172
# File 'lib/files.com/models/expectation.rb', line 170

def lookback_interval=(value)
  @attributes[:lookback_interval] = value
end

#max_open_intervalObject

int64 - Hard-stop duration in seconds for unscheduled expectations.



193
194
195
# File 'lib/files.com/models/expectation.rb', line 193

def max_open_interval
  @attributes[:max_open_interval]
end

#max_open_interval=(value) ⇒ Object



197
198
199
# File 'lib/files.com/models/expectation.rb', line 197

def max_open_interval=(value)
  @attributes[:max_open_interval] = value
end

#nameObject

string - Expectation name.



31
32
33
# File 'lib/files.com/models/expectation.rb', line 31

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



35
36
37
# File 'lib/files.com/models/expectation.rb', line 35

def name=(value)
  @attributes[:name] = value
end

#pathObject

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
50
51
# File 'lib/files.com/models/expectation.rb', line 49

def path
  @attributes[:path]
end

#path=(value) ⇒ Object



53
54
55
# File 'lib/files.com/models/expectation.rb', line 53

def path=(value)
  @attributes[:path] = value
end

#recurring_dayObject

int64 - If trigger is daily, this selects the day number inside the chosen interval.



112
113
114
# File 'lib/files.com/models/expectation.rb', line 112

def recurring_day
  @attributes[:recurring_day]
end

#recurring_day=(value) ⇒ Object



116
117
118
# File 'lib/files.com/models/expectation.rb', line 116

def recurring_day=(value)
  @attributes[:recurring_day] = value
end

#saveObject



331
332
333
334
335
336
337
338
339
340
# File 'lib/files.com/models/expectation.rb', line 331

def save
  if @attributes[:id]
    new_obj = update(@attributes)
  else
    new_obj = Expectation.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end

#schedule_days_of_weekObject

array(int64) - If trigger is custom_schedule, the 0-based weekdays used by the schedule.



130
131
132
# File 'lib/files.com/models/expectation.rb', line 130

def schedule_days_of_week
  @attributes[:schedule_days_of_week]
end

#schedule_days_of_week=(value) ⇒ Object



134
135
136
# File 'lib/files.com/models/expectation.rb', line 134

def schedule_days_of_week=(value)
  @attributes[:schedule_days_of_week] = value
end

#schedule_idObject

int64 - If trigger is custom_schedule, the reusable Schedule used instead of the Expectation's schedule fields.



121
122
123
# File 'lib/files.com/models/expectation.rb', line 121

def schedule_id
  @attributes[:schedule_id]
end

#schedule_id=(value) ⇒ Object



125
126
127
# File 'lib/files.com/models/expectation.rb', line 125

def schedule_id=(value)
  @attributes[:schedule_id] = value
end

#schedule_time_zoneObject

string - Time zone used by the Expectation schedule.



148
149
150
# File 'lib/files.com/models/expectation.rb', line 148

def schedule_time_zone
  @attributes[:schedule_time_zone]
end

#schedule_time_zone=(value) ⇒ Object



152
153
154
# File 'lib/files.com/models/expectation.rb', line 152

def schedule_time_zone=(value)
  @attributes[:schedule_time_zone] = value
end

#schedule_times_of_dayObject

array(string) - Times of day in HH:MM format for the Expectation schedule.



139
140
141
# File 'lib/files.com/models/expectation.rb', line 139

def schedule_times_of_day
  @attributes[:schedule_times_of_day]
end

#schedule_times_of_day=(value) ⇒ Object



143
144
145
# File 'lib/files.com/models/expectation.rb', line 143

def schedule_times_of_day=(value)
  @attributes[:schedule_times_of_day] = value
end

#sourceObject

string - Source glob used to select candidate files.



58
59
60
# File 'lib/files.com/models/expectation.rb', line 58

def source
  @attributes[:source]
end

#source=(value) ⇒ Object



62
63
64
# File 'lib/files.com/models/expectation.rb', line 62

def source=(value)
  @attributes[:source] = value
end

#triggerObject

string - How this expectation opens windows.



94
95
96
# File 'lib/files.com/models/expectation.rb', line 94

def trigger
  @attributes[:trigger]
end

#trigger=(value) ⇒ Object



98
99
100
# File 'lib/files.com/models/expectation.rb', line 98

def trigger=(value)
  @attributes[:trigger] = value
end

#trigger_evaluation(params = {}) ⇒ Object

Manually open an Expectation window



257
258
259
260
261
262
263
264
265
# File 'lib/files.com/models/expectation.rb', line 257

def trigger_evaluation(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/expectations/#{@attributes[:id]}/trigger_evaluation", :post, params, @options)
end

#update(params = {}) ⇒ Object

Parameters:

name - string - Expectation name.
description - string - Expectation description.
path - string - Path scope for the expectation. Supports workspace-relative presentation.
source - string - Source glob used to select candidate files.
exclude_pattern - string - Optional source exclusion glob.
disabled - boolean - If true, the expectation is disabled.
trigger - string - How this expectation opens windows.
interval - string - If trigger is `daily`, this specifies how often to run the expectation.
recurring_day - int64 - If trigger is `daily`, this selects the day number inside the chosen interval.
schedule_id - int64 - If trigger is `custom_schedule`, the reusable Schedule used instead of the Expectation's schedule fields.
schedule_days_of_week - array(int64) - If trigger is `custom_schedule`, the 0-based weekdays used by the schedule.
schedule_times_of_day - array(string) - Times of day in HH:MM format for the Expectation schedule.
schedule_time_zone - string - Time zone used by the Expectation schedule.
holiday_region - string - Optional holiday region used by the Expectation schedule.
lookback_interval - int64 - How many seconds before the due boundary the window starts.
late_acceptance_interval - int64 - How many seconds a schedule-driven window may remain eligible to close as late.
inactivity_interval - int64 - How many quiet seconds are required before final closure.
max_open_interval - int64 - Hard-stop duration in seconds for unscheduled expectations.
criteria - object - Versioned success criteria definition for the expectation, including optional Files Transform Script content validation in criteria v2.
workspace_id - int64 - Workspace ID. `0` means the default workspace.


288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/files.com/models/expectation.rb', line 288

def update(params = {})
  params ||= {}
  params[:id] = @attributes[:id]
  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: source must be an String") if params[:source] and !params[:source].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: exclude_pattern must be an String") if params[:exclude_pattern] and !params[:exclude_pattern].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: trigger must be an String") if params[:trigger] and !params[:trigger].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: interval must be an String") if params[:interval] and !params[:interval].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: recurring_day must be an Integer") if params[:recurring_day] and !params[:recurring_day].is_a?(Integer)
  raise InvalidParameterError.new("Bad parameter: schedule_id must be an Integer") if params[:schedule_id] and !params[:schedule_id].is_a?(Integer)
  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)
  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)
  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)
  raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: lookback_interval must be an Integer") if params[:lookback_interval] and !params[:lookback_interval].is_a?(Integer)
  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)
  raise InvalidParameterError.new("Bad parameter: inactivity_interval must be an Integer") if params[:inactivity_interval] and !params[:inactivity_interval].is_a?(Integer)
  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)
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]

  Api.send_request("/expectations/#{@attributes[:id]}", :patch, params, @options)
end

#updated_atObject

date-time - Last update time.



252
253
254
# File 'lib/files.com/models/expectation.rb', line 252

def updated_at
  @attributes[:updated_at]
end

#workspace_idObject

int64 - Workspace ID. 0 means the default workspace.



22
23
24
# File 'lib/files.com/models/expectation.rb', line 22

def workspace_id
  @attributes[:workspace_id]
end

#workspace_id=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/expectation.rb', line 26

def workspace_id=(value)
  @attributes[:workspace_id] = value
end