Class: OpsgenieSdk::ContactApi

Inherits:
Object
  • Object
show all
Defined in:
lib/opsgenie_sdk/api/contact_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContactApi

Returns a new instance of ContactApi.



19
20
21
# File 'lib/opsgenie_sdk/api/contact_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/opsgenie_sdk/api/contact_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_contact(identifier, opts = {}) ⇒ SuccessResponse

Create Contact Creates a new contact

Parameters:

  • identifier

    Identifier of the user to be searched

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

    the optional parameters

Options Hash (opts):

Returns:



28
29
30
31
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 28

def create_contact(identifier, opts = {})
  data, _status_code, _headers = create_contact_with_http_info(identifier, opts)
  data
end

#create_contact_with_http_info(identifier, opts = {}) ⇒ Array<(SuccessResponse, Fixnum, Hash)>

Create Contact Creates a new contact

Parameters:

  • identifier

    Identifier of the user to be searched

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(SuccessResponse, Fixnum, Hash)>)

    SuccessResponse data, response status code and response headers



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
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 39

def create_contact_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactApi.create_contact ...'
  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 ContactApi.create_contact"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/contacts'.sub('{' + 'identifier' + '}', identifier.to_s)

  # 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(opts[:'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 => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#create_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_contact(identifier, contact_id, opts = {}) ⇒ SuccessResponse

Delete Contact Delete contact using contact id

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Returns:



82
83
84
85
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 82

def delete_contact(identifier, contact_id, opts = {})
  data, _status_code, _headers = delete_contact_with_http_info(identifier, contact_id, opts)
  data
end

#delete_contact_with_http_info(identifier, contact_id, opts = {}) ⇒ Array<(SuccessResponse, Fixnum, Hash)>

Delete Contact Delete contact using contact id

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Returns:

  • (Array<(SuccessResponse, Fixnum, Hash)>)

    SuccessResponse data, response status code and response headers



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 93

def delete_contact_with_http_info(identifier, contact_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactApi.delete_contact ...'
  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 ContactApi.delete_contact"
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.delete_contact"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/contacts/{contactId}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'contactId' + '}', contact_id.to_s)

  # 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 = 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: ContactApi#delete_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#disable_contact(identifier, contact_id, opts = {}) ⇒ SuccessResponse

Disable Contact Disable the contact of the user

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Returns:



140
141
142
143
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 140

def disable_contact(identifier, contact_id, opts = {})
  data, _status_code, _headers = disable_contact_with_http_info(identifier, contact_id, opts)
  data
end

#disable_contact_with_http_info(identifier, contact_id, opts = {}) ⇒ Array<(SuccessResponse, Fixnum, Hash)>

Disable Contact Disable the contact of the user

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Returns:

  • (Array<(SuccessResponse, Fixnum, Hash)>)

    SuccessResponse data, response status code and response headers



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 151

def disable_contact_with_http_info(identifier, contact_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactApi.disable_contact ...'
  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 ContactApi.disable_contact"
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.disable_contact"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/contacts/{contactId}/disable'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'contactId' + '}', contact_id.to_s)

  # 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 = nil
  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 => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#disable_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#enable_contact(identifier, contact_id, opts = {}) ⇒ SuccessResponse

Enable Contact Enable the contact of the user

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Returns:



198
199
200
201
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 198

def enable_contact(identifier, contact_id, opts = {})
  data, _status_code, _headers = enable_contact_with_http_info(identifier, contact_id, opts)
  data
end

#enable_contact_with_http_info(identifier, contact_id, opts = {}) ⇒ Array<(SuccessResponse, Fixnum, Hash)>

Enable Contact Enable the contact of the user

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Returns:

  • (Array<(SuccessResponse, Fixnum, Hash)>)

    SuccessResponse data, response status code and response headers



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
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 209

def enable_contact_with_http_info(identifier, contact_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactApi.enable_contact ...'
  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 ContactApi.enable_contact"
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.enable_contact"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/contacts/{contactId}/enable'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'contactId' + '}', contact_id.to_s)

  # 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 = nil
  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 => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#enable_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contact(identifier, contact_id, opts = {}) ⇒ GetContactResponse

Get Contact Returns contact with given id

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Returns:



256
257
258
259
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 256

def get_contact(identifier, contact_id, opts = {})
  data, _status_code, _headers = get_contact_with_http_info(identifier, contact_id, opts)
  data
end

#get_contact_with_http_info(identifier, contact_id, opts = {}) ⇒ Array<(GetContactResponse, Fixnum, Hash)>

Get Contact Returns contact with given id

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Returns:

  • (Array<(GetContactResponse, Fixnum, Hash)>)

    GetContactResponse data, response status code and response headers



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 267

def get_contact_with_http_info(identifier, contact_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactApi.get_contact ...'
  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 ContactApi.get_contact"
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.get_contact"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/contacts/{contactId}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'contactId' + '}', contact_id.to_s)

  # 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 = 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 => 'GetContactResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#get_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_contacts(identifier, opts = {}) ⇒ ListContactsResponse

List Contacts Returns list of contacts

Parameters:

  • identifier

    Identifier of the user to be searched

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

    the optional parameters

Returns:



313
314
315
316
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 313

def list_contacts(identifier, opts = {})
  data, _status_code, _headers = list_contacts_with_http_info(identifier, opts)
  data
end

#list_contacts_with_http_info(identifier, opts = {}) ⇒ Array<(ListContactsResponse, Fixnum, Hash)>

List Contacts Returns list of contacts

Parameters:

  • identifier

    Identifier of the user to be searched

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

    the optional parameters

Returns:

  • (Array<(ListContactsResponse, Fixnum, Hash)>)

    ListContactsResponse data, response status code and response headers



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 323

def list_contacts_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactApi.list_contacts ...'
  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 ContactApi.list_contacts"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/contacts'.sub('{' + 'identifier' + '}', identifier.to_s)

  # 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 = 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 => 'ListContactsResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#list_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_contact(identifier, contact_id, opts = {}) ⇒ SuccessResponse

Update Contact (Partial) Update contact of the user

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Options Hash (opts):

Returns:



367
368
369
370
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 367

def update_contact(identifier, contact_id, opts = {})
  data, _status_code, _headers = update_contact_with_http_info(identifier, contact_id, opts)
  data
end

#update_contact_with_http_info(identifier, contact_id, opts = {}) ⇒ Array<(SuccessResponse, Fixnum, Hash)>

Update Contact (Partial) Update contact of the user

Parameters:

  • identifier

    Identifier of the user to be searched

  • contact_id

    Id of the contact

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

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(SuccessResponse, Fixnum, Hash)>)

    SuccessResponse data, response status code and response headers



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/opsgenie_sdk/api/contact_api.rb', line 379

def update_contact_with_http_info(identifier, contact_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContactApi.update_contact ...'
  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 ContactApi.update_contact"
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling ContactApi.update_contact"
  end
  # resource path
  local_var_path = '/v2/users/{identifier}/contacts/{contactId}'.sub('{' + 'identifier' + '}', identifier.to_s).sub('{' + 'contactId' + '}', contact_id.to_s)

  # 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(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 => 'SuccessResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContactApi#update_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end