Class: SparteraApiSdk::AlertsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/spartera_api_sdk/api/alerts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AlertsApi

Returns a new instance of AlertsApi.



19
20
21
# File 'lib/spartera_api_sdk/api/alerts_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/spartera_api_sdk/api/alerts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_alerts(company_id, user_id, alerts_input, opts = {}) ⇒ CreateAlerts200Response

POST /companies/company_id/users/user_id/alerts

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 28

def create_alerts(company_id, user_id, alerts_input, opts = {})
  data, _status_code, _headers = create_alerts_with_http_info(company_id, user_id, alerts_input, opts)
  data
end

#create_alerts_with_http_info(company_id, user_id, alerts_input, opts = {}) ⇒ Array<(CreateAlerts200Response, Integer, Hash)>

POST /companies/company_id/users/user_id/alerts

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

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

    the optional parameters

Returns:

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

    CreateAlerts200Response 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 39

def create_alerts_with_http_info(company_id, user_id, alerts_input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.create_alerts ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling AlertsApi.create_alerts"
  end
  if @api_client.config.client_side_validation && company_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.create_alerts, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && company_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.create_alerts, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && company_id !~ pattern
    fail ArgumentError, "invalid value for 'company_id' when calling AlertsApi.create_alerts, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AlertsApi.create_alerts"
  end
  if @api_client.config.client_side_validation && user_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.create_alerts, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && user_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.create_alerts, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling AlertsApi.create_alerts, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'alerts_input' is set
  if @api_client.config.client_side_validation && alerts_input.nil?
    fail ArgumentError, "Missing the required parameter 'alerts_input' when calling AlertsApi.create_alerts"
  end
  # resource path
  local_var_path = '/companies/{company_id}/users/{user_id}/alerts'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(alerts_input)

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

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

  new_options = opts.merge(
    :operation => :"AlertsApi.create_alerts",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#create_alerts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_alerts(company_id, user_id, alert_id, opts = {}) ⇒ DeleteAlerts200Response

Delete single alert by ID

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • alert_id (String)

    Unique identifier for the Alert

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

    the optional parameters

Returns:



132
133
134
135
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 132

def delete_alerts(company_id, user_id, alert_id, opts = {})
  data, _status_code, _headers = delete_alerts_with_http_info(company_id, user_id, alert_id, opts)
  data
end

#delete_alerts_with_http_info(company_id, user_id, alert_id, opts = {}) ⇒ Array<(DeleteAlerts200Response, Integer, Hash)>

Delete single alert by ID

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • alert_id (String)

    Unique identifier for the Alert

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

    the optional parameters

Returns:

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

    DeleteAlerts200Response data, response status code and response headers



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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
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
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 143

def delete_alerts_with_http_info(company_id, user_id, alert_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.delete_alerts ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling AlertsApi.delete_alerts"
  end
  if @api_client.config.client_side_validation && company_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.delete_alerts, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && company_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.delete_alerts, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && company_id !~ pattern
    fail ArgumentError, "invalid value for 'company_id' when calling AlertsApi.delete_alerts, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AlertsApi.delete_alerts"
  end
  if @api_client.config.client_side_validation && user_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.delete_alerts, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && user_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.delete_alerts, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling AlertsApi.delete_alerts, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'alert_id' is set
  if @api_client.config.client_side_validation && alert_id.nil?
    fail ArgumentError, "Missing the required parameter 'alert_id' when calling AlertsApi.delete_alerts"
  end
  if @api_client.config.client_side_validation && alert_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "alert_id" when calling AlertsApi.delete_alerts, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && alert_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "alert_id" when calling AlertsApi.delete_alerts, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && alert_id !~ pattern
    fail ArgumentError, "invalid value for 'alert_id' when calling AlertsApi.delete_alerts, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/companies/{company_id}/users/{user_id}/alerts/{alert_id}'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'alert_id' + '}', CGI.escape(alert_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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"AlertsApi.delete_alerts",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#delete_alerts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_alerts_by_id(company_id, user_id, opts = {}) ⇒ GetAlertsById200Response

Get a list of all alerts for a specific user

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

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

    the optional parameters

Returns:



243
244
245
246
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 243

def get_alerts_by_id(company_id, user_id, opts = {})
  data, _status_code, _headers = get_alerts_by_id_with_http_info(company_id, user_id, opts)
  data
end

#get_alerts_by_id_asset_all(company_id, user_id, asset_id, opts = {}) ⇒ GetAlertsById200Response

Get all alerts for a specific asset

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • asset_id (String)

    Unique identifier for the Asset

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

    the optional parameters

Returns:



337
338
339
340
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 337

def get_alerts_by_id_asset_all(company_id, user_id, asset_id, opts = {})
  data, _status_code, _headers = get_alerts_by_id_asset_all_with_http_info(company_id, user_id, asset_id, opts)
  data
end

#get_alerts_by_id_asset_all_with_http_info(company_id, user_id, asset_id, opts = {}) ⇒ Array<(GetAlertsById200Response, Integer, Hash)>

Get all alerts for a specific asset

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • asset_id (String)

    Unique identifier for the Asset

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

    the optional parameters

Returns:

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

    GetAlertsById200Response data, response status code and response headers



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 348

def get_alerts_by_id_asset_all_with_http_info(company_id, user_id, asset_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.get_alerts_by_id_asset_all ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling AlertsApi.get_alerts_by_id_asset_all"
  end
  if @api_client.config.client_side_validation && company_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.get_alerts_by_id_asset_all, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && company_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.get_alerts_by_id_asset_all, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && company_id !~ pattern
    fail ArgumentError, "invalid value for 'company_id' when calling AlertsApi.get_alerts_by_id_asset_all, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AlertsApi.get_alerts_by_id_asset_all"
  end
  if @api_client.config.client_side_validation && user_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.get_alerts_by_id_asset_all, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && user_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.get_alerts_by_id_asset_all, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling AlertsApi.get_alerts_by_id_asset_all, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'asset_id' is set
  if @api_client.config.client_side_validation && asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'asset_id' when calling AlertsApi.get_alerts_by_id_asset_all"
  end
  if @api_client.config.client_side_validation && asset_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "asset_id" when calling AlertsApi.get_alerts_by_id_asset_all, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && asset_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "asset_id" when calling AlertsApi.get_alerts_by_id_asset_all, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && asset_id !~ pattern
    fail ArgumentError, "invalid value for 'asset_id' when calling AlertsApi.get_alerts_by_id_asset_all, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/companies/{company_id}/users/{user_id}/alerts/asset/{asset_id}/all'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"AlertsApi.get_alerts_by_id_asset_all",
    :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: AlertsApi#get_alerts_by_id_asset_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_alerts_by_id_users(company_id, user_id, alert_id, opts = {}) ⇒ GetAlertsById200Response

Get single alert by ID

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • alert_id (String)

    Unique identifier for the Alert

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

    the optional parameters

Returns:



449
450
451
452
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 449

def get_alerts_by_id_users(company_id, user_id, alert_id, opts = {})
  data, _status_code, _headers = get_alerts_by_id_users_with_http_info(company_id, user_id, alert_id, opts)
  data
end

#get_alerts_by_id_users_asset(company_id, user_id, asset_id, opts = {}) ⇒ GetAlertsById200Response

Get all alerts for a specific asset (by user)

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • asset_id (String)

    Unique identifier for the Asset

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

    the optional parameters

Returns:



561
562
563
564
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 561

def get_alerts_by_id_users_asset(company_id, user_id, asset_id, opts = {})
  data, _status_code, _headers = get_alerts_by_id_users_asset_with_http_info(company_id, user_id, asset_id, opts)
  data
end

#get_alerts_by_id_users_asset_with_http_info(company_id, user_id, asset_id, opts = {}) ⇒ Array<(GetAlertsById200Response, Integer, Hash)>

Get all alerts for a specific asset (by user)

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • asset_id (String)

    Unique identifier for the Asset

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

    the optional parameters

Returns:

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

    GetAlertsById200Response data, response status code and response headers



572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 572

def get_alerts_by_id_users_asset_with_http_info(company_id, user_id, asset_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.get_alerts_by_id_users_asset ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling AlertsApi.get_alerts_by_id_users_asset"
  end
  if @api_client.config.client_side_validation && company_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.get_alerts_by_id_users_asset, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && company_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.get_alerts_by_id_users_asset, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && company_id !~ pattern
    fail ArgumentError, "invalid value for 'company_id' when calling AlertsApi.get_alerts_by_id_users_asset, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AlertsApi.get_alerts_by_id_users_asset"
  end
  if @api_client.config.client_side_validation && user_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.get_alerts_by_id_users_asset, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && user_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.get_alerts_by_id_users_asset, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling AlertsApi.get_alerts_by_id_users_asset, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'asset_id' is set
  if @api_client.config.client_side_validation && asset_id.nil?
    fail ArgumentError, "Missing the required parameter 'asset_id' when calling AlertsApi.get_alerts_by_id_users_asset"
  end
  if @api_client.config.client_side_validation && asset_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "asset_id" when calling AlertsApi.get_alerts_by_id_users_asset, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && asset_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "asset_id" when calling AlertsApi.get_alerts_by_id_users_asset, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && asset_id !~ pattern
    fail ArgumentError, "invalid value for 'asset_id' when calling AlertsApi.get_alerts_by_id_users_asset, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/companies/{company_id}/users/{user_id}/alerts/asset/{asset_id}'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"AlertsApi.get_alerts_by_id_users_asset",
    :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: AlertsApi#get_alerts_by_id_users_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_alerts_by_id_users_with_http_info(company_id, user_id, alert_id, opts = {}) ⇒ Array<(GetAlertsById200Response, Integer, Hash)>

Get single alert by ID

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • alert_id (String)

    Unique identifier for the Alert

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

    the optional parameters

Returns:

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

    GetAlertsById200Response data, response status code and response headers



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 460

def get_alerts_by_id_users_with_http_info(company_id, user_id, alert_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.get_alerts_by_id_users ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling AlertsApi.get_alerts_by_id_users"
  end
  if @api_client.config.client_side_validation && company_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.get_alerts_by_id_users, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && company_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.get_alerts_by_id_users, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && company_id !~ pattern
    fail ArgumentError, "invalid value for 'company_id' when calling AlertsApi.get_alerts_by_id_users, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AlertsApi.get_alerts_by_id_users"
  end
  if @api_client.config.client_side_validation && user_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.get_alerts_by_id_users, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && user_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.get_alerts_by_id_users, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling AlertsApi.get_alerts_by_id_users, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'alert_id' is set
  if @api_client.config.client_side_validation && alert_id.nil?
    fail ArgumentError, "Missing the required parameter 'alert_id' when calling AlertsApi.get_alerts_by_id_users"
  end
  if @api_client.config.client_side_validation && alert_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "alert_id" when calling AlertsApi.get_alerts_by_id_users, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && alert_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "alert_id" when calling AlertsApi.get_alerts_by_id_users, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && alert_id !~ pattern
    fail ArgumentError, "invalid value for 'alert_id' when calling AlertsApi.get_alerts_by_id_users, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/companies/{company_id}/users/{user_id}/alerts/{alert_id}'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'alert_id' + '}', CGI.escape(alert_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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"AlertsApi.get_alerts_by_id_users",
    :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: AlertsApi#get_alerts_by_id_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_alerts_by_id_with_http_info(company_id, user_id, opts = {}) ⇒ Array<(GetAlertsById200Response, Integer, Hash)>

Get a list of all alerts for a specific user

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

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

    the optional parameters

Returns:

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

    GetAlertsById200Response data, response status code and response headers



253
254
255
256
257
258
259
260
261
262
263
264
265
266
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 253

def get_alerts_by_id_with_http_info(company_id, user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.get_alerts_by_id ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling AlertsApi.get_alerts_by_id"
  end
  if @api_client.config.client_side_validation && company_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.get_alerts_by_id, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && company_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.get_alerts_by_id, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && company_id !~ pattern
    fail ArgumentError, "invalid value for 'company_id' when calling AlertsApi.get_alerts_by_id, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AlertsApi.get_alerts_by_id"
  end
  if @api_client.config.client_side_validation && user_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.get_alerts_by_id, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && user_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.get_alerts_by_id, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling AlertsApi.get_alerts_by_id, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/companies/{company_id}/users/{user_id}/alerts'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"AlertsApi.get_alerts_by_id",
    :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: AlertsApi#get_alerts_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_alerts(company_id, user_id, alert_id, alerts_update, opts = {}) ⇒ UpdateAlerts200Response

Update an existing alert by ID

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • alert_id (String)

    Unique identifier for the Alert

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

    the optional parameters

Returns:



674
675
676
677
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 674

def update_alerts(company_id, user_id, alert_id, alerts_update, opts = {})
  data, _status_code, _headers = update_alerts_with_http_info(company_id, user_id, alert_id, alerts_update, opts)
  data
end

#update_alerts_with_http_info(company_id, user_id, alert_id, alerts_update, opts = {}) ⇒ Array<(UpdateAlerts200Response, Integer, Hash)>

Update an existing alert by ID

Parameters:

  • company_id (String)

    Unique identifier for the Company

  • user_id (String)

    Unique identifier for the User

  • alert_id (String)

    Unique identifier for the Alert

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

    the optional parameters

Returns:

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

    UpdateAlerts200Response data, response status code and response headers



686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
# File 'lib/spartera_api_sdk/api/alerts_api.rb', line 686

def update_alerts_with_http_info(company_id, user_id, alert_id, alerts_update, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AlertsApi.update_alerts ...'
  end
  # verify the required parameter 'company_id' is set
  if @api_client.config.client_side_validation && company_id.nil?
    fail ArgumentError, "Missing the required parameter 'company_id' when calling AlertsApi.update_alerts"
  end
  if @api_client.config.client_side_validation && company_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.update_alerts, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && company_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "company_id" when calling AlertsApi.update_alerts, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && company_id !~ pattern
    fail ArgumentError, "invalid value for 'company_id' when calling AlertsApi.update_alerts, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    fail ArgumentError, "Missing the required parameter 'user_id' when calling AlertsApi.update_alerts"
  end
  if @api_client.config.client_side_validation && user_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.update_alerts, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && user_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "user_id" when calling AlertsApi.update_alerts, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && user_id !~ pattern
    fail ArgumentError, "invalid value for 'user_id' when calling AlertsApi.update_alerts, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'alert_id' is set
  if @api_client.config.client_side_validation && alert_id.nil?
    fail ArgumentError, "Missing the required parameter 'alert_id' when calling AlertsApi.update_alerts"
  end
  if @api_client.config.client_side_validation && alert_id.to_s.length > 255
    fail ArgumentError, 'invalid value for "alert_id" when calling AlertsApi.update_alerts, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && alert_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "alert_id" when calling AlertsApi.update_alerts, the character length must be greater than or equal to 1.'
  end

  pattern = Regexp.new(/^[a-zA-Z0-9_-]+$/)
  if @api_client.config.client_side_validation && alert_id !~ pattern
    fail ArgumentError, "invalid value for 'alert_id' when calling AlertsApi.update_alerts, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'alerts_update' is set
  if @api_client.config.client_side_validation && alerts_update.nil?
    fail ArgumentError, "Missing the required parameter 'alerts_update' when calling AlertsApi.update_alerts"
  end
  # resource path
  local_var_path = '/companies/{company_id}/users/{user_id}/alerts/{alert_id}'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'alert_id' + '}', CGI.escape(alert_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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(alerts_update)

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

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

  new_options = opts.merge(
    :operation => :"AlertsApi.update_alerts",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AlertsApi#update_alerts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end