Class: MuxRuby::IncidentsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mux_ruby/api/incidents_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ IncidentsApi

Returns a new instance of IncidentsApi.



19
20
21
# File 'lib/mux_ruby/api/incidents_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/mux_ruby/api/incidents_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_incident(incident_id, opts = {}) ⇒ IncidentResponse

Get an Incident Returns the details of an incident.

Parameters:

  • incident_id (String)

    ID of the Incident

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/mux_ruby/api/incidents_api.rb', line 27

def get_incident(incident_id, opts = {})
  data, _status_code, _headers = get_incident_with_http_info(incident_id, opts)
  data
end

#get_incident_with_http_info(incident_id, opts = {}) ⇒ Array<(IncidentResponse, Integer, Hash)>

Get an Incident Returns the details of an incident.

Parameters:

  • incident_id (String)

    ID of the Incident

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(IncidentResponse, Integer, Hash)>)

    IncidentResponse data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/mux_ruby/api/incidents_api.rb', line 37

def get_incident_with_http_info(incident_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IncidentsApi.get_incident ...'
  end
  # verify the required parameter 'incident_id' is set
  if @api_client.config.client_side_validation && incident_id.nil?
    fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsApi.get_incident"
  end
  # resource path
  local_var_path = '/data/v1/incidents/{INCIDENT_ID}'.sub('{' + 'INCIDENT_ID' + '}', CGI.escape(incident_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'IncidentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['accessToken']

  new_options = opts.merge(
    :operation => :"IncidentsApi.get_incident",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IncidentsApi#get_incident\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_incidents(opts = {}) ⇒ ListIncidentsResponse

List Incidents Returns a list of incidents.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of items to include in the response (default to 25)

  • :page (Integer)

    Offset by this many pages, of the size of &#x60;limit&#x60; (default to 1)

  • :order_by (String)

    Value to order the results by

  • :order_direction (String)

    Sort order.

  • :status (String)

    Status to filter incidents by

  • :severity (String)

    Severity to filter incidents by

Returns:



95
96
97
98
# File 'lib/mux_ruby/api/incidents_api.rb', line 95

def list_incidents(opts = {})
  data, _status_code, _headers = list_incidents_with_http_info(opts)
  data
end

#list_incidents_with_http_info(opts = {}) ⇒ Array<(ListIncidentsResponse, Integer, Hash)>

List Incidents Returns a list of incidents.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of items to include in the response

  • :page (Integer)

    Offset by this many pages, of the size of &#x60;limit&#x60;

  • :order_by (String)

    Value to order the results by

  • :order_direction (String)

    Sort order.

  • :status (String)

    Status to filter incidents by

  • :severity (String)

    Severity to filter incidents by

Returns:

  • (Array<(ListIncidentsResponse, Integer, Hash)>)

    ListIncidentsResponse data, response status code and response headers



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/mux_ruby/api/incidents_api.rb', line 110

def list_incidents_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IncidentsApi.list_incidents ...'
  end
  allowable_values = ["negative_impact", "value", "views", "field"]
  if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by'])
    fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'order_direction'] && !allowable_values.include?(opts[:'order_direction'])
    fail ArgumentError, "invalid value for \"order_direction\", must be one of #{allowable_values}"
  end
  allowable_values = ["open", "closed", "expired"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  allowable_values = ["warning", "alert"]
  if @api_client.config.client_side_validation && opts[:'severity'] && !allowable_values.include?(opts[:'severity'])
    fail ArgumentError, "invalid value for \"severity\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/data/v1/incidents'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order_direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'severity'] = opts[:'severity'] if !opts[:'severity'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListIncidentsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['accessToken']

  new_options = opts.merge(
    :operation => :"IncidentsApi.list_incidents",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IncidentsApi#list_incidents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

List Related Incidents Returns all the incidents that seem related to a specific incident.

Parameters:

  • incident_id (String)

    ID of the Incident

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of items to include in the response (default to 25)

  • :page (Integer)

    Offset by this many pages, of the size of &#x60;limit&#x60; (default to 1)

  • :order_by (String)

    Value to order the results by

  • :order_direction (String)

    Sort order.

Returns:



185
186
187
188
# File 'lib/mux_ruby/api/incidents_api.rb', line 185

def list_related_incidents(incident_id, opts = {})
  data, _status_code, _headers = list_related_incidents_with_http_info(incident_id, opts)
  data
end

List Related Incidents Returns all the incidents that seem related to a specific incident.

Parameters:

  • incident_id (String)

    ID of the Incident

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of items to include in the response

  • :page (Integer)

    Offset by this many pages, of the size of &#x60;limit&#x60;

  • :order_by (String)

    Value to order the results by

  • :order_direction (String)

    Sort order.

Returns:



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/mux_ruby/api/incidents_api.rb', line 199

def list_related_incidents_with_http_info(incident_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IncidentsApi.list_related_incidents ...'
  end
  # verify the required parameter 'incident_id' is set
  if @api_client.config.client_side_validation && incident_id.nil?
    fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsApi.list_related_incidents"
  end
  allowable_values = ["negative_impact", "value", "views", "field"]
  if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by'])
    fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'order_direction'] && !allowable_values.include?(opts[:'order_direction'])
    fail ArgumentError, "invalid value for \"order_direction\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/data/v1/incidents/{INCIDENT_ID}/related'.sub('{' + 'INCIDENT_ID' + '}', CGI.escape(incident_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'order_direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListRelatedIncidentsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['accessToken']

  new_options = opts.merge(
    :operation => :"IncidentsApi.list_related_incidents",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IncidentsApi#list_related_incidents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end