class OpsgenieSdk::ScheduleApi
Attributes
Public Class Methods
# File lib/opsgenie_sdk/api/schedule_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create Schedule
Creates a new schedule @param body Request payload of created schedule @param [Hash] opts the optional parameters @return [CreateScheduleResponse]
# File lib/opsgenie_sdk/api/schedule_api.rb, line 27 def create_schedule(body, opts = {}) data, _status_code, _headers = create_schedule_with_http_info(body, opts) data end
Create Schedule
Creates a new schedule @param body Request payload of created schedule @param [Hash] opts the optional parameters @return [Array<(CreateScheduleResponse
, Fixnum, Hash)>] CreateScheduleResponse
data, response status code and response headers
# File lib/opsgenie_sdk/api/schedule_api.rb, line 37 def create_schedule_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduleApi.create_schedule ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling ScheduleApi.create_schedule" end # resource path local_var_path = '/v2/schedules' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['GenieKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreateScheduleResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScheduleApi#create_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete Schedule
Delete schedule with given identifier @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' (default to id) @return [SuccessResponse]
# File lib/opsgenie_sdk/api/schedule_api.rb, line 80 def delete_schedule(identifier, opts = {}) data, _status_code, _headers = delete_schedule_with_http_info(identifier, opts) data end
Delete Schedule
Delete schedule with given identifier @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' @return [Array<(SuccessResponse
, Fixnum, Hash)>] SuccessResponse
data, response status code and response headers
# File lib/opsgenie_sdk/api/schedule_api.rb, line 91 def delete_schedule_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduleApi.delete_schedule ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleApi.delete_schedule" end if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'name'].include?(opts[:'identifier_type']) fail ArgumentError, 'invalid value for "identifier_type", must be one of id, name' end # resource path local_var_path = '/v2/schedules/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['GenieKey'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'SuccessResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScheduleApi#delete_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Export Schedule
Returns an .ics file as byte array @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' (default to id) @return [String]
# File lib/opsgenie_sdk/api/schedule_api.rb, line 138 def export_schedule(identifier, opts = {}) data, _status_code, _headers = export_schedule_with_http_info(identifier, opts) data end
Export Schedule
Returns an .ics file as byte array @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
# File lib/opsgenie_sdk/api/schedule_api.rb, line 149 def export_schedule_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduleApi.export_schedule ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleApi.export_schedule" end if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'name'].include?(opts[:'identifier_type']) fail ArgumentError, 'invalid value for "identifier_type", must be one of id, name' end # resource path local_var_path = '/v2/schedules/{identifier}.ics'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/calendar']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['GenieKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScheduleApi#export_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Schedule
Returns schedule with given id or name @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' (default to id) @return [GetScheduleResponse]
# File lib/opsgenie_sdk/api/schedule_api.rb, line 196 def get_schedule(identifier, opts = {}) data, _status_code, _headers = get_schedule_with_http_info(identifier, opts) data end
Get Schedule
Timeline
Returns schedule timeline with given id or name @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' (default to id) @option opts [Array<String>] :expand Returns more detailed response with expanding it. Possible values are 'base', 'forwarding', and 'override' which is also returned with expandable field of response @option opts [Integer] :interval Length of time as integer in intervalUnits to retrieve the timeline. Default value is 1 (default to 1) @option opts [String] :interval_unit Unit of the time to retrieve the timeline. Available values are 'days', 'weeks' and 'months'. Default value is 'weeks' @option opts [DateTime] :date Time to return future date on-call participants. Default date is the moment of the time that request is received @return [GetScheduleTimelineResponse]
# File lib/opsgenie_sdk/api/schedule_api.rb, line 258 def get_schedule_timeline(identifier, opts = {}) data, _status_code, _headers = get_schedule_timeline_with_http_info(identifier, opts) data end
Get Schedule
Timeline
Returns schedule timeline with given id or name @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' @option opts [Array<String>] :expand Returns more detailed response with expanding it. Possible values are 'base', 'forwarding', and 'override' which is also returned with expandable field of response @option opts [Integer] :interval Length of time as integer in intervalUnits to retrieve the timeline. Default value is 1 @option opts [String] :interval_unit Unit of the time to retrieve the timeline. Available values are 'days', 'weeks' and 'months'. Default value is 'weeks' @option opts [DateTime] :date Time to return future date on-call participants. Default date is the moment of the time that request is received @return [Array<(GetScheduleTimelineResponse
, Fixnum, Hash)>] GetScheduleTimelineResponse
data, response status code and response headers
# File lib/opsgenie_sdk/api/schedule_api.rb, line 273 def get_schedule_timeline_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduleApi.get_schedule_timeline ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleApi.get_schedule_timeline" end if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'name'].include?(opts[:'identifier_type']) fail ArgumentError, 'invalid value for "identifier_type", must be one of id, name' end if @api_client.config.client_side_validation && opts[:'interval_unit'] && !['days', 'weeks', 'months'].include?(opts[:'interval_unit']) fail ArgumentError, 'invalid value for "interval_unit", must be one of days, weeks, months' end # resource path local_var_path = '/v2/schedules/{identifier}/timeline'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil? query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :csv) if !opts[:'expand'].nil? query_params[:'interval'] = opts[:'interval'] if !opts[:'interval'].nil? query_params[:'intervalUnit'] = opts[:'interval_unit'] if !opts[:'interval_unit'].nil? query_params[:'date'] = opts[:'date'] if !opts[:'date'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['GenieKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetScheduleTimelineResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScheduleApi#get_schedule_timeline\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Schedule
Returns schedule with given id or name @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' @return [Array<(GetScheduleResponse
, Fixnum, Hash)>] GetScheduleResponse
data, response status code and response headers
# File lib/opsgenie_sdk/api/schedule_api.rb, line 207 def get_schedule_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduleApi.get_schedule ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleApi.get_schedule" end if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'name'].include?(opts[:'identifier_type']) fail ArgumentError, 'invalid value for "identifier_type", must be one of id, name' end # resource path local_var_path = '/v2/schedules/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['GenieKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetScheduleResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScheduleApi#get_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Schedules Returns list of schedule @param [Hash] opts the optional parameters @option opts [Array<String>] :expand Returns more detailed response with expanding it. Possible value is 'rotation' which is also returned with expandable field of response @return [ListSchedulesResponse]
# File lib/opsgenie_sdk/api/schedule_api.rb, line 326 def list_schedules(opts = {}) data, _status_code, _headers = list_schedules_with_http_info(opts) data end
List Schedules Returns list of schedule @param [Hash] opts the optional parameters @option opts [Array<String>] :expand Returns more detailed response with expanding it. Possible value is 'rotation' which is also returned with expandable field of response @return [Array<(ListSchedulesResponse
, Fixnum, Hash)>] ListSchedulesResponse
data, response status code and response headers
# File lib/opsgenie_sdk/api/schedule_api.rb, line 336 def list_schedules_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduleApi.list_schedules ...' end # resource path local_var_path = '/v2/schedules' # query parameters query_params = {} query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :csv) if !opts[:'expand'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['GenieKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ListSchedulesResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScheduleApi#list_schedules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update Schedule
(Partial) Update schedule with given id or name @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' (default to id) @option opts [UpdateSchedulePayload] :body Request payload of update schedule action @return [UpdateScheduleResponse]
# File lib/opsgenie_sdk/api/schedule_api.rb, line 377 def update_schedule(identifier, opts = {}) data, _status_code, _headers = update_schedule_with_http_info(identifier, opts) data end
Update Schedule
(Partial) Update schedule with given id or name @param identifier Identifier of schedule which could be id or name @param [Hash] opts the optional parameters @option opts [String] :identifier_type Type of the identifier that is provided as an in-line parameter. Possible values are 'id' or 'name' @option opts [UpdateSchedulePayload] :body Request payload of update schedule action @return [Array<(UpdateScheduleResponse
, Fixnum, Hash)>] UpdateScheduleResponse
data, response status code and response headers
# File lib/opsgenie_sdk/api/schedule_api.rb, line 389 def update_schedule_with_http_info(identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduleApi.update_schedule ...' end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling ScheduleApi.update_schedule" end if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'name'].include?(opts[:'identifier_type']) fail ArgumentError, 'invalid value for "identifier_type", must be one of id, name' end # resource path local_var_path = '/v2/schedules/{identifier}'.sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['GenieKey'] data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UpdateScheduleResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ScheduleApi#update_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end