Class: Files::ExpectationIncident

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ExpectationIncident.



7
8
9
10
# File 'lib/files.com/models/expectation_incident.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_incident.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Class Method Details

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

Acknowledge an expectation incident



189
190
191
192
193
194
195
196
197
# File 'lib/files.com/models/expectation_incident.rb', line 189

def self.acknowledge(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("/expectation_incidents/#{params[:id]}/acknowledge", :post, params, options)
  ExpectationIncident.new(response.data, options)
end

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



141
142
143
# File 'lib/files.com/models/expectation_incident.rb', line 141

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

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

Parameters:

id (required) - int64 - Expectation Incident ID.


147
148
149
150
151
152
153
154
155
# File 'lib/files.com/models/expectation_incident.rb', line 147

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("/expectation_incidents/#{params[:id]}", :get, params, options)
  ExpectationIncident.new(response.data, options)
end

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



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

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: 10,000, 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`, `created_at` or `expectation_id`.
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 ]`.


130
131
132
133
134
135
136
137
138
139
# File 'lib/files.com/models/expectation_incident.rb', line 130

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(ExpectationIncident, params) do
    Api.send_request("/expectation_incidents", :get, params, options)
  end
end

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

Resolve an expectation incident



162
163
164
165
166
167
168
169
170
# File 'lib/files.com/models/expectation_incident.rb', line 162

def self.resolve(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("/expectation_incidents/#{params[:id]}/resolve", :post, params, options)
  ExpectationIncident.new(response.data, options)
end

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

Snooze an expectation incident until a specified time

Parameters:

snoozed_until (required) - string - Time until which the incident should remain snoozed.


176
177
178
179
180
181
182
183
184
185
186
# File 'lib/files.com/models/expectation_incident.rb', line 176

def self.snooze(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: snoozed_until must be an String") if params[:snoozed_until] and !params[:snoozed_until].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
  raise MissingParameterError.new("Parameter missing: snoozed_until") unless params[:snoozed_until]

  response, options = Api.send_request("/expectation_incidents/#{params[:id]}/snooze", :post, params, options)
  ExpectationIncident.new(response.data, options)
end

Instance Method Details

#acknowledge(params = {}) ⇒ Object

Acknowledge an expectation incident



115
116
117
118
119
120
121
122
123
# File 'lib/files.com/models/expectation_incident.rb', line 115

def acknowledge(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("/expectation_incidents/#{@attributes[:id]}/acknowledge", :post, params, @options)
end

#acknowledged_atObject

date-time - When the incident was acknowledged.



43
44
45
# File 'lib/files.com/models/expectation_incident.rb', line 43

def acknowledged_at
  @attributes[:acknowledged_at]
end

#created_atObject

date-time - Creation time.



78
79
80
# File 'lib/files.com/models/expectation_incident.rb', line 78

def created_at
  @attributes[:created_at]
end

#expectation_idObject

int64 - Expectation ID.



23
24
25
# File 'lib/files.com/models/expectation_incident.rb', line 23

def expectation_id
  @attributes[:expectation_id]
end

#idObject

int64 - Expectation Incident ID



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

def id
  @attributes[:id]
end

#last_evaluation_idObject

int64 - Most recent evaluation linked to the incident.



63
64
65
# File 'lib/files.com/models/expectation_incident.rb', line 63

def last_evaluation_id
  @attributes[:last_evaluation_id]
end

#last_failed_atObject

date-time - When the most recent failing evaluation contributing to the incident occurred.



38
39
40
# File 'lib/files.com/models/expectation_incident.rb', line 38

def last_failed_at
  @attributes[:last_failed_at]
end

#opened_atObject

date-time - When the incident was opened.



33
34
35
# File 'lib/files.com/models/expectation_incident.rb', line 33

def opened_at
  @attributes[:opened_at]
end

#opened_by_evaluation_idObject

int64 - Evaluation that first opened the incident.



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

def opened_by_evaluation_id
  @attributes[:opened_by_evaluation_id]
end

#resolve(params = {}) ⇒ Object

Resolve an expectation incident



88
89
90
91
92
93
94
95
96
# File 'lib/files.com/models/expectation_incident.rb', line 88

def resolve(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("/expectation_incidents/#{@attributes[:id]}/resolve", :post, params, @options)
end

#resolved_atObject

date-time - When the incident was resolved.



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

def resolved_at
  @attributes[:resolved_at]
end

#resolved_by_evaluation_idObject

int64 - Evaluation that resolved the incident.



68
69
70
# File 'lib/files.com/models/expectation_incident.rb', line 68

def resolved_by_evaluation_id
  @attributes[:resolved_by_evaluation_id]
end

#snooze(params = {}) ⇒ Object

Snooze an expectation incident until a specified time

Parameters:

snoozed_until (required) - string - Time until which the incident should remain snoozed.


102
103
104
105
106
107
108
109
110
111
112
# File 'lib/files.com/models/expectation_incident.rb', line 102

def snooze(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: snoozed_until must be an String") if params[:snoozed_until] and !params[:snoozed_until].is_a?(String)
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
  raise MissingParameterError.new("Parameter missing: snoozed_until") unless params[:snoozed_until]

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

#snoozed_untilObject

date-time - When the current snooze expires.



48
49
50
# File 'lib/files.com/models/expectation_incident.rb', line 48

def snoozed_until
  @attributes[:snoozed_until]
end

#statusObject

string - Incident status.



28
29
30
# File 'lib/files.com/models/expectation_incident.rb', line 28

def status
  @attributes[:status]
end

#summaryObject

object - Compact incident summary payload.



73
74
75
# File 'lib/files.com/models/expectation_incident.rb', line 73

def summary
  @attributes[:summary]
end

#updated_atObject

date-time - Last update time.



83
84
85
# File 'lib/files.com/models/expectation_incident.rb', line 83

def updated_at
  @attributes[:updated_at]
end

#workspace_idObject

int64 - Workspace ID. ‘0` means the default workspace.



18
19
20
# File 'lib/files.com/models/expectation_incident.rb', line 18

def workspace_id
  @attributes[:workspace_id]
end