class MuxRuby::IncidentsApi
Attributes
Public Class Methods
# File lib/mux_ruby/api/incidents_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Get an Incident
Returns the details of an incident. @param incident_id [String] ID of the Incident
@param [Hash] opts the optional parameters @return [IncidentResponse]
# 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 an Incident
Returns the details of an incident. @param incident_id [String] ID of the Incident
@param [Hash] opts the optional parameters @return [Array<(IncidentResponse
, Integer, Hash)>] IncidentResponse
data, response status code and response headers
# 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 Returns a list of incidents. @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of items to include in the response (default to 25) @option opts [Integer] :page Offset by this many pages, of the size of `limit` (default to 1) @option opts [String] :order_by Value to order the results by @option opts [String] :order_direction Sort order. @option opts [String] :status Status to filter incidents by @option opts [String] :severity Severity to filter incidents by @return [ListIncidentsResponse]
# 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 Returns a list of incidents. @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of items to include in the response @option opts [Integer] :page Offset by this many pages, of the size of `limit` @option opts [String] :order_by Value to order the results by @option opts [String] :order_direction Sort order. @option opts [String] :status Status to filter incidents by @option opts [String] :severity Severity to filter incidents by @return [Array<(ListIncidentsResponse
, Integer, Hash)>] ListIncidentsResponse
data, response status code and response headers
# 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