statuscake-rb 1.0.0.pre.beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/lib/statuscake/api/contact_groups_api.rb +411 -0
  3. data/lib/statuscake/api/locations_api.rb +166 -0
  4. data/lib/statuscake/api/maintenance_windows_api.rb +444 -0
  5. data/lib/statuscake/api/pagespeed_api.rb +550 -0
  6. data/lib/statuscake/api/ssl_api.rb +458 -0
  7. data/lib/statuscake/api/uptime_api.rb +881 -0
  8. data/lib/statuscake/api_client.rb +407 -0
  9. data/lib/statuscake/api_error.rb +75 -0
  10. data/lib/statuscake/configuration.rb +296 -0
  11. data/lib/statuscake/models/api_error.rb +249 -0
  12. data/lib/statuscake/models/api_response.rb +241 -0
  13. data/lib/statuscake/models/api_response_data.rb +243 -0
  14. data/lib/statuscake/models/contact_group.rb +318 -0
  15. data/lib/statuscake/models/contact_group_response.rb +241 -0
  16. data/lib/statuscake/models/contact_groups.rb +258 -0
  17. data/lib/statuscake/models/links.rb +242 -0
  18. data/lib/statuscake/models/maintenance_window.rb +364 -0
  19. data/lib/statuscake/models/maintenance_window_repeat_interval.rb +59 -0
  20. data/lib/statuscake/models/maintenance_window_response.rb +241 -0
  21. data/lib/statuscake/models/maintenance_window_state.rb +57 -0
  22. data/lib/statuscake/models/maintenance_windows.rb +258 -0
  23. data/lib/statuscake/models/monitoring_location.rb +306 -0
  24. data/lib/statuscake/models/monitoring_location_status.rb +56 -0
  25. data/lib/statuscake/models/monitoring_locations.rb +244 -0
  26. data/lib/statuscake/models/pagespeed_test.rb +444 -0
  27. data/lib/statuscake/models/pagespeed_test_check_rate.rb +61 -0
  28. data/lib/statuscake/models/pagespeed_test_history.rb +269 -0
  29. data/lib/statuscake/models/pagespeed_test_history_result.rb +373 -0
  30. data/lib/statuscake/models/pagespeed_test_region.rb +64 -0
  31. data/lib/statuscake/models/pagespeed_test_response.rb +241 -0
  32. data/lib/statuscake/models/pagespeed_test_stats.rb +354 -0
  33. data/lib/statuscake/models/pagespeed_test_throttling.rb +60 -0
  34. data/lib/statuscake/models/pagespeed_tests.rb +258 -0
  35. data/lib/statuscake/models/pagination.rb +363 -0
  36. data/lib/statuscake/models/ssl_test.rb +594 -0
  37. data/lib/statuscake/models/ssl_test_check_rate.rb +60 -0
  38. data/lib/statuscake/models/ssl_test_flags.rb +347 -0
  39. data/lib/statuscake/models/ssl_test_mixed_content.rb +257 -0
  40. data/lib/statuscake/models/ssl_test_response.rb +241 -0
  41. data/lib/statuscake/models/ssl_tests.rb +258 -0
  42. data/lib/statuscake/models/uptime_test.rb +811 -0
  43. data/lib/statuscake/models/uptime_test_alert.rb +300 -0
  44. data/lib/statuscake/models/uptime_test_alerts.rb +269 -0
  45. data/lib/statuscake/models/uptime_test_check_rate.rb +62 -0
  46. data/lib/statuscake/models/uptime_test_history.rb +269 -0
  47. data/lib/statuscake/models/uptime_test_history_result.rb +302 -0
  48. data/lib/statuscake/models/uptime_test_overview.rb +388 -0
  49. data/lib/statuscake/models/uptime_test_period.rb +291 -0
  50. data/lib/statuscake/models/uptime_test_periods.rb +269 -0
  51. data/lib/statuscake/models/uptime_test_processing_state.rb +58 -0
  52. data/lib/statuscake/models/uptime_test_response.rb +241 -0
  53. data/lib/statuscake/models/uptime_test_status.rb +56 -0
  54. data/lib/statuscake/models/uptime_test_type.rb +61 -0
  55. data/lib/statuscake/models/uptime_tests.rb +258 -0
  56. data/lib/statuscake/version.rb +32 -0
  57. data/lib/statuscake.rb +107 -0
  58. metadata +221 -0
@@ -0,0 +1,550 @@
1
+ # frozen_string_literal: true
2
+
3
+ # StatusCake API
4
+ #
5
+ # Copyright (c) 2022
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to
9
+ # deal in the Software without restriction, including without limitation the
10
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11
+ # sell copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23
+ # IN THE SOFTWARE.
24
+ #
25
+ # API version: 1.0.0
26
+ # Contact: support@statuscake.com
27
+ #
28
+ # Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
29
+
30
+ require 'cgi'
31
+
32
+ module StatusCake
33
+ # :nodoc
34
+ class PagespeedApi
35
+ attr_accessor :api_client
36
+
37
+ def initialize(api_client = ApiClient.default)
38
+ @api_client = api_client
39
+ end
40
+
41
+ # Create a pagespeed check
42
+ # Creates a pagespeed check with the given parameters.
43
+ # @param name [String] Name of the check
44
+ # @param website_url [String] URL, FQDN, or IP address of the website under test
45
+ # @param check_rate [PagespeedTestCheckRate]
46
+ # @param region [PagespeedTestRegion]
47
+ # @param [Hash] opts the optional parameters
48
+ # @option opts [Integer] :alert_bigger An alert will be sent if the size of the page is larger than this value (kb). A value of 0 prevents alerts being sent. (default to 0)
49
+ # @option opts [Integer] :alert_slower An alert will be sent if the load time of the page exceeds this value (ms). A value of 0 prevents alerts being sent (default to 0)
50
+ # @option opts [Integer] :alert_smaller An alert will be sent if the size of the page is smaller than this value (kb). A value of 0 prevents alerts being sent (default to 0)
51
+ # @option opts [Array<String>] :contact_groups List of contact group IDs
52
+ # @option opts [Boolean] :paused Whether the check should be run (default to false)
53
+ # @return [APIResponse]
54
+ def create_pagespeed_test(name, website_url, check_rate, region, opts = {})
55
+ data, _status_code, _headers = create_pagespeed_test_with_http_info(name, website_url, check_rate, region, opts)
56
+ data
57
+ end
58
+
59
+ # Create a pagespeed check
60
+ # Creates a pagespeed check with the given parameters.
61
+ # @param name [String] Name of the check
62
+ # @param website_url [String] URL, FQDN, or IP address of the website under test
63
+ # @param check_rate [PagespeedTestCheckRate]
64
+ # @param region [PagespeedTestRegion]
65
+ # @param [Hash] opts the optional parameters
66
+ # @option opts [Integer] :alert_bigger An alert will be sent if the size of the page is larger than this value (kb). A value of 0 prevents alerts being sent. (default to 0)
67
+ # @option opts [Integer] :alert_slower An alert will be sent if the load time of the page exceeds this value (ms). A value of 0 prevents alerts being sent (default to 0)
68
+ # @option opts [Integer] :alert_smaller An alert will be sent if the size of the page is smaller than this value (kb). A value of 0 prevents alerts being sent (default to 0)
69
+ # @option opts [Array<String>] :contact_groups List of contact group IDs
70
+ # @option opts [Boolean] :paused Whether the check should be run (default to false)
71
+ # @return [Array<(APIResponse, Integer, Hash)>] APIResponse data, response status code and response headers
72
+ def create_pagespeed_test_with_http_info(name, website_url, check_rate, region, opts = {})
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug 'Calling API: PagespeedApi.create_pagespeed_test ...'
75
+ end
76
+ # verify the required parameter 'name' is set
77
+ if @api_client.config.client_side_validation && name.nil?
78
+ raise ArgumentError, "Missing the required parameter 'name' when calling PagespeedApi.create_pagespeed_test"
79
+ end
80
+ # verify the required parameter 'website_url' is set
81
+ if @api_client.config.client_side_validation && website_url.nil?
82
+ raise ArgumentError, "Missing the required parameter 'website_url' when calling PagespeedApi.create_pagespeed_test"
83
+ end
84
+ # verify the required parameter 'check_rate' is set
85
+ if @api_client.config.client_side_validation && check_rate.nil?
86
+ raise ArgumentError, "Missing the required parameter 'check_rate' when calling PagespeedApi.create_pagespeed_test"
87
+ end
88
+ # verify the required parameter 'region' is set
89
+ if @api_client.config.client_side_validation && region.nil?
90
+ raise ArgumentError, "Missing the required parameter 'region' when calling PagespeedApi.create_pagespeed_test"
91
+ end
92
+ if @api_client.config.client_side_validation && !opts[:'alert_bigger'].nil? && opts[:'alert_bigger'] < 0
93
+ raise ArgumentError, 'invalid value for "opts[:"alert_bigger"]" when calling PagespeedApi.create_pagespeed_test, must be greater than or equal to 0.'
94
+ end
95
+
96
+ if @api_client.config.client_side_validation && !opts[:'alert_slower'].nil? && opts[:'alert_slower'] < 0
97
+ raise ArgumentError, 'invalid value for "opts[:"alert_slower"]" when calling PagespeedApi.create_pagespeed_test, must be greater than or equal to 0.'
98
+ end
99
+
100
+ if @api_client.config.client_side_validation && !opts[:'alert_smaller'].nil? && opts[:'alert_smaller'] < 0
101
+ raise ArgumentError, 'invalid value for "opts[:"alert_smaller"]" when calling PagespeedApi.create_pagespeed_test, must be greater than or equal to 0.'
102
+ end
103
+
104
+ # resource path
105
+ local_var_path = '/pagespeed'
106
+
107
+ # query parameters
108
+ query_params = opts[:query_params] || {}
109
+
110
+ # header parameters
111
+ header_params = opts[:header_params] || {}
112
+ # HTTP header 'Accept' (if needed)
113
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
114
+ # HTTP header 'Content-Type'
115
+ content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
116
+ unless content_type.nil?
117
+ header_params['Content-Type'] = content_type
118
+ end
119
+
120
+ # form parameters
121
+ form_params = opts[:form_params] || {}
122
+ form_params['name'] = name
123
+ form_params['website_url'] = website_url
124
+ form_params['check_rate'] = check_rate
125
+ form_params['region'] = region
126
+ form_params['alert_bigger'] = opts[:'alert_bigger'] unless opts[:'alert_bigger'].nil?
127
+ form_params['alert_slower'] = opts[:'alert_slower'] unless opts[:'alert_slower'].nil?
128
+ form_params['alert_smaller'] = opts[:'alert_smaller'] unless opts[:'alert_smaller'].nil?
129
+ form_params['contact_groups'] = @api_client.build_collection_param(opts[:'contact_groups'], :csv) unless opts[:'contact_groups'].nil?
130
+ form_params['paused'] = opts[:'paused'] unless opts[:'paused'].nil?
131
+
132
+ # http body (model)
133
+ post_body = opts[:debug_body]
134
+
135
+ # return_type
136
+ return_type = opts[:debug_return_type] || 'APIResponse'
137
+
138
+ # auth_names
139
+ auth_names = opts[:debug_auth_names] || []
140
+
141
+ new_options = opts.merge(
142
+ :operation => :'PagespeedApi.create_pagespeed_test',
143
+ :header_params => header_params,
144
+ :query_params => query_params,
145
+ :form_params => form_params,
146
+ :body => post_body,
147
+ :auth_names => auth_names,
148
+ :return_type => return_type,
149
+ )
150
+
151
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
152
+ if @api_client.config.debugging
153
+ @api_client.config.logger.debug "API called: PagespeedApi#create_pagespeed_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
154
+ end
155
+
156
+ [data, status_code, headers]
157
+ end
158
+
159
+ # Delete a pagespeed check
160
+ # Deletes a pagespeed check with the given id.
161
+ # @param test_id [String] Pagespeed check ID
162
+ # @param [Hash] opts the optional parameters
163
+ # @return [nil]
164
+ def delete_pagespeed_test(test_id, opts = {})
165
+ delete_pagespeed_test_with_http_info(test_id, opts)
166
+ nil
167
+ end
168
+
169
+ # Delete a pagespeed check
170
+ # Deletes a pagespeed check with the given id.
171
+ # @param test_id [String] Pagespeed check ID
172
+ # @param [Hash] opts the optional parameters
173
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
174
+ def delete_pagespeed_test_with_http_info(test_id, opts = {})
175
+ if @api_client.config.debugging
176
+ @api_client.config.logger.debug 'Calling API: PagespeedApi.delete_pagespeed_test ...'
177
+ end
178
+ # verify the required parameter 'test_id' is set
179
+ if @api_client.config.client_side_validation && test_id.nil?
180
+ raise ArgumentError, "Missing the required parameter 'test_id' when calling PagespeedApi.delete_pagespeed_test"
181
+ end
182
+ # resource path
183
+ local_var_path = '/pagespeed/{test_id}'.sub('{' + 'test_id' + '}', CGI.escape(test_id.to_s))
184
+
185
+ # query parameters
186
+ query_params = opts[:query_params] || {}
187
+
188
+ # header parameters
189
+ header_params = opts[:header_params] || {}
190
+ # HTTP header 'Accept' (if needed)
191
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
192
+
193
+ # form parameters
194
+ form_params = opts[:form_params] || {}
195
+
196
+ # http body (model)
197
+ post_body = opts[:debug_body]
198
+
199
+ # return_type
200
+ return_type = opts[:debug_return_type]
201
+
202
+ # auth_names
203
+ auth_names = opts[:debug_auth_names] || []
204
+
205
+ new_options = opts.merge(
206
+ :operation => :'PagespeedApi.delete_pagespeed_test',
207
+ :header_params => header_params,
208
+ :query_params => query_params,
209
+ :form_params => form_params,
210
+ :body => post_body,
211
+ :auth_names => auth_names,
212
+ :return_type => return_type,
213
+ )
214
+
215
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called: PagespeedApi#delete_pagespeed_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
+ end
219
+
220
+ [data, status_code, headers]
221
+ end
222
+
223
+ # Retrieve a pagespeed check
224
+ # Returns a pagespeed check with the given id.
225
+ # @param test_id [String] Pagespeed check ID
226
+ # @param [Hash] opts the optional parameters
227
+ # @return [PagespeedTestResponse]
228
+ def get_pagespeed_test(test_id, opts = {})
229
+ data, _status_code, _headers = get_pagespeed_test_with_http_info(test_id, opts)
230
+ data
231
+ end
232
+
233
+ # Retrieve a pagespeed check
234
+ # Returns a pagespeed check with the given id.
235
+ # @param test_id [String] Pagespeed check ID
236
+ # @param [Hash] opts the optional parameters
237
+ # @return [Array<(PagespeedTestResponse, Integer, Hash)>] PagespeedTestResponse data, response status code and response headers
238
+ def get_pagespeed_test_with_http_info(test_id, opts = {})
239
+ if @api_client.config.debugging
240
+ @api_client.config.logger.debug 'Calling API: PagespeedApi.get_pagespeed_test ...'
241
+ end
242
+ # verify the required parameter 'test_id' is set
243
+ if @api_client.config.client_side_validation && test_id.nil?
244
+ raise ArgumentError, "Missing the required parameter 'test_id' when calling PagespeedApi.get_pagespeed_test"
245
+ end
246
+ # resource path
247
+ local_var_path = '/pagespeed/{test_id}'.sub('{' + 'test_id' + '}', CGI.escape(test_id.to_s))
248
+
249
+ # query parameters
250
+ query_params = opts[:query_params] || {}
251
+
252
+ # header parameters
253
+ header_params = opts[:header_params] || {}
254
+ # HTTP header 'Accept' (if needed)
255
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
256
+
257
+ # form parameters
258
+ form_params = opts[:form_params] || {}
259
+
260
+ # http body (model)
261
+ post_body = opts[:debug_body]
262
+
263
+ # return_type
264
+ return_type = opts[:debug_return_type] || 'PagespeedTestResponse'
265
+
266
+ # auth_names
267
+ auth_names = opts[:debug_auth_names] || []
268
+
269
+ new_options = opts.merge(
270
+ :operation => :'PagespeedApi.get_pagespeed_test',
271
+ :header_params => header_params,
272
+ :query_params => query_params,
273
+ :form_params => form_params,
274
+ :body => post_body,
275
+ :auth_names => auth_names,
276
+ :return_type => return_type,
277
+ )
278
+
279
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
280
+ if @api_client.config.debugging
281
+ @api_client.config.logger.debug "API called: PagespeedApi#get_pagespeed_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
282
+ end
283
+
284
+ [data, status_code, headers]
285
+ end
286
+
287
+ # Get all pagespeed check history
288
+ # Returns a list of pagespeed check history results for a given id, detailing the runs performed on the StatusCake testing infrastruture. The returned results are a paginated series. Alongside the response data is a `links` object referencing the current response document, `self`, and the next page in the series, `next`. Aggregated data over the specified duration is returned in the root level `metadata` field.
289
+ # @param test_id [String] Pagespeed check ID
290
+ # @param [Hash] opts the optional parameters
291
+ # @option opts [Integer] :limit The number of results to return from the series (default to 25)
292
+ # @option opts [Integer] :before Only results created before this UNIX timestamp will be returned
293
+ # @return [PagespeedTestHistory]
294
+ def list_pagespeed_test_history(test_id, opts = {})
295
+ data, _status_code, _headers = list_pagespeed_test_history_with_http_info(test_id, opts)
296
+ data
297
+ end
298
+
299
+ # Get all pagespeed check history
300
+ # Returns a list of pagespeed check history results for a given id, detailing the runs performed on the StatusCake testing infrastruture. The returned results are a paginated series. Alongside the response data is a `links` object referencing the current response document, `self`, and the next page in the series, `next`. Aggregated data over the specified duration is returned in the root level `metadata` field.
301
+ # @param test_id [String] Pagespeed check ID
302
+ # @param [Hash] opts the optional parameters
303
+ # @option opts [Integer] :limit The number of results to return from the series (default to 25)
304
+ # @option opts [Integer] :before Only results created before this UNIX timestamp will be returned
305
+ # @return [Array<(PagespeedTestHistory, Integer, Hash)>] PagespeedTestHistory data, response status code and response headers
306
+ def list_pagespeed_test_history_with_http_info(test_id, opts = {})
307
+ if @api_client.config.debugging
308
+ @api_client.config.logger.debug 'Calling API: PagespeedApi.list_pagespeed_test_history ...'
309
+ end
310
+ # verify the required parameter 'test_id' is set
311
+ if @api_client.config.client_side_validation && test_id.nil?
312
+ raise ArgumentError, "Missing the required parameter 'test_id' when calling PagespeedApi.list_pagespeed_test_history"
313
+ end
314
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
315
+ raise ArgumentError, 'invalid value for "opts[:"limit"]" when calling PagespeedApi.list_pagespeed_test_history, must be smaller than or equal to 100.'
316
+ end
317
+
318
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
319
+ raise ArgumentError, 'invalid value for "opts[:"limit"]" when calling PagespeedApi.list_pagespeed_test_history, must be greater than or equal to 1.'
320
+ end
321
+
322
+ if @api_client.config.client_side_validation && !opts[:'before'].nil? && opts[:'before'] < 0
323
+ raise ArgumentError, 'invalid value for "opts[:"before"]" when calling PagespeedApi.list_pagespeed_test_history, must be greater than or equal to 0.'
324
+ end
325
+
326
+ # resource path
327
+ local_var_path = '/pagespeed/{test_id}/history'.sub('{' + 'test_id' + '}', CGI.escape(test_id.to_s))
328
+
329
+ # query parameters
330
+ query_params = opts[:query_params] || {}
331
+ query_params[:'limit'] = opts[:'limit'] unless opts[:'limit'].nil?
332
+ query_params[:'before'] = opts[:'before'] unless opts[:'before'].nil?
333
+
334
+ # header parameters
335
+ header_params = opts[:header_params] || {}
336
+ # HTTP header 'Accept' (if needed)
337
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
338
+
339
+ # form parameters
340
+ form_params = opts[:form_params] || {}
341
+
342
+ # http body (model)
343
+ post_body = opts[:debug_body]
344
+
345
+ # return_type
346
+ return_type = opts[:debug_return_type] || 'PagespeedTestHistory'
347
+
348
+ # auth_names
349
+ auth_names = opts[:debug_auth_names] || []
350
+
351
+ new_options = opts.merge(
352
+ :operation => :'PagespeedApi.list_pagespeed_test_history',
353
+ :header_params => header_params,
354
+ :query_params => query_params,
355
+ :form_params => form_params,
356
+ :body => post_body,
357
+ :auth_names => auth_names,
358
+ :return_type => return_type,
359
+ )
360
+
361
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
362
+ if @api_client.config.debugging
363
+ @api_client.config.logger.debug "API called: PagespeedApi#list_pagespeed_test_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
364
+ end
365
+
366
+ [data, status_code, headers]
367
+ end
368
+
369
+ # Get all pagespeed checks
370
+ # Returns a list of pagespeed checks for an account.
371
+ # @param [Hash] opts the optional parameters
372
+ # @option opts [Integer] :page Page of results (default to 1)
373
+ # @option opts [Integer] :limit The number of pagespeed checks to return per page (default to 25)
374
+ # @return [PagespeedTests]
375
+ def list_pagespeed_tests(opts = {})
376
+ data, _status_code, _headers = list_pagespeed_tests_with_http_info(opts)
377
+ data
378
+ end
379
+
380
+ # Get all pagespeed checks
381
+ # Returns a list of pagespeed checks for an account.
382
+ # @param [Hash] opts the optional parameters
383
+ # @option opts [Integer] :page Page of results (default to 1)
384
+ # @option opts [Integer] :limit The number of pagespeed checks to return per page (default to 25)
385
+ # @return [Array<(PagespeedTests, Integer, Hash)>] PagespeedTests data, response status code and response headers
386
+ def list_pagespeed_tests_with_http_info(opts = {})
387
+ if @api_client.config.debugging
388
+ @api_client.config.logger.debug 'Calling API: PagespeedApi.list_pagespeed_tests ...'
389
+ end
390
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
391
+ raise ArgumentError, 'invalid value for "opts[:"page"]" when calling PagespeedApi.list_pagespeed_tests, must be greater than or equal to 1.'
392
+ end
393
+
394
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
395
+ raise ArgumentError, 'invalid value for "opts[:"limit"]" when calling PagespeedApi.list_pagespeed_tests, must be smaller than or equal to 100.'
396
+ end
397
+
398
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
399
+ raise ArgumentError, 'invalid value for "opts[:"limit"]" when calling PagespeedApi.list_pagespeed_tests, must be greater than or equal to 1.'
400
+ end
401
+
402
+ # resource path
403
+ local_var_path = '/pagespeed'
404
+
405
+ # query parameters
406
+ query_params = opts[:query_params] || {}
407
+ query_params[:'page'] = opts[:'page'] unless opts[:'page'].nil?
408
+ query_params[:'limit'] = opts[:'limit'] unless opts[:'limit'].nil?
409
+
410
+ # header parameters
411
+ header_params = opts[:header_params] || {}
412
+ # HTTP header 'Accept' (if needed)
413
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
414
+
415
+ # form parameters
416
+ form_params = opts[:form_params] || {}
417
+
418
+ # http body (model)
419
+ post_body = opts[:debug_body]
420
+
421
+ # return_type
422
+ return_type = opts[:debug_return_type] || 'PagespeedTests'
423
+
424
+ # auth_names
425
+ auth_names = opts[:debug_auth_names] || []
426
+
427
+ new_options = opts.merge(
428
+ :operation => :'PagespeedApi.list_pagespeed_tests',
429
+ :header_params => header_params,
430
+ :query_params => query_params,
431
+ :form_params => form_params,
432
+ :body => post_body,
433
+ :auth_names => auth_names,
434
+ :return_type => return_type,
435
+ )
436
+
437
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
438
+ if @api_client.config.debugging
439
+ @api_client.config.logger.debug "API called: PagespeedApi#list_pagespeed_tests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
440
+ end
441
+
442
+ [data, status_code, headers]
443
+ end
444
+
445
+ # Update a pagespeed check
446
+ # Updates a pagespeed check with the given parameters.
447
+ # @param test_id [String] Pagespeed check ID
448
+ # @param [Hash] opts the optional parameters
449
+ # @option opts [String] :name Name of the check
450
+ # @option opts [PagespeedTestCheckRate] :check_rate
451
+ # @option opts [Integer] :alert_bigger An alert will be sent if the size of the page is larger than this value (kb). A value of 0 prevents alerts being sent.
452
+ # @option opts [Integer] :alert_slower An alert will be sent if the load time of the page exceeds this value (ms). A value of 0 prevents alerts being sent
453
+ # @option opts [Integer] :alert_smaller An alert will be sent if the size of the page is smaller than this value (kb). A value of 0 prevents alerts being sent
454
+ # @option opts [Array<String>] :contact_groups List of contact group IDs
455
+ # @option opts [Boolean] :paused Whether the check should be run
456
+ # @option opts [PagespeedTestRegion] :region
457
+ # @return [nil]
458
+ def update_pagespeed_test(test_id, opts = {})
459
+ update_pagespeed_test_with_http_info(test_id, opts)
460
+ nil
461
+ end
462
+
463
+ # Update a pagespeed check
464
+ # Updates a pagespeed check with the given parameters.
465
+ # @param test_id [String] Pagespeed check ID
466
+ # @param [Hash] opts the optional parameters
467
+ # @option opts [String] :name Name of the check
468
+ # @option opts [PagespeedTestCheckRate] :check_rate
469
+ # @option opts [Integer] :alert_bigger An alert will be sent if the size of the page is larger than this value (kb). A value of 0 prevents alerts being sent.
470
+ # @option opts [Integer] :alert_slower An alert will be sent if the load time of the page exceeds this value (ms). A value of 0 prevents alerts being sent
471
+ # @option opts [Integer] :alert_smaller An alert will be sent if the size of the page is smaller than this value (kb). A value of 0 prevents alerts being sent
472
+ # @option opts [Array<String>] :contact_groups List of contact group IDs
473
+ # @option opts [Boolean] :paused Whether the check should be run
474
+ # @option opts [PagespeedTestRegion] :region
475
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
476
+ def update_pagespeed_test_with_http_info(test_id, opts = {})
477
+ if @api_client.config.debugging
478
+ @api_client.config.logger.debug 'Calling API: PagespeedApi.update_pagespeed_test ...'
479
+ end
480
+ # verify the required parameter 'test_id' is set
481
+ if @api_client.config.client_side_validation && test_id.nil?
482
+ raise ArgumentError, "Missing the required parameter 'test_id' when calling PagespeedApi.update_pagespeed_test"
483
+ end
484
+ if @api_client.config.client_side_validation && !opts[:'alert_bigger'].nil? && opts[:'alert_bigger'] < 0
485
+ raise ArgumentError, 'invalid value for "opts[:"alert_bigger"]" when calling PagespeedApi.update_pagespeed_test, must be greater than or equal to 0.'
486
+ end
487
+
488
+ if @api_client.config.client_side_validation && !opts[:'alert_slower'].nil? && opts[:'alert_slower'] < 0
489
+ raise ArgumentError, 'invalid value for "opts[:"alert_slower"]" when calling PagespeedApi.update_pagespeed_test, must be greater than or equal to 0.'
490
+ end
491
+
492
+ if @api_client.config.client_side_validation && !opts[:'alert_smaller'].nil? && opts[:'alert_smaller'] < 0
493
+ raise ArgumentError, 'invalid value for "opts[:"alert_smaller"]" when calling PagespeedApi.update_pagespeed_test, must be greater than or equal to 0.'
494
+ end
495
+
496
+ # resource path
497
+ local_var_path = '/pagespeed/{test_id}'.sub('{' + 'test_id' + '}', CGI.escape(test_id.to_s))
498
+
499
+ # query parameters
500
+ query_params = opts[:query_params] || {}
501
+
502
+ # header parameters
503
+ header_params = opts[:header_params] || {}
504
+ # HTTP header 'Accept' (if needed)
505
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
506
+ # HTTP header 'Content-Type'
507
+ content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
508
+ unless content_type.nil?
509
+ header_params['Content-Type'] = content_type
510
+ end
511
+
512
+ # form parameters
513
+ form_params = opts[:form_params] || {}
514
+ form_params['name'] = opts[:'name'] unless opts[:'name'].nil?
515
+ form_params['check_rate'] = opts[:'check_rate'] unless opts[:'check_rate'].nil?
516
+ form_params['alert_bigger'] = opts[:'alert_bigger'] unless opts[:'alert_bigger'].nil?
517
+ form_params['alert_slower'] = opts[:'alert_slower'] unless opts[:'alert_slower'].nil?
518
+ form_params['alert_smaller'] = opts[:'alert_smaller'] unless opts[:'alert_smaller'].nil?
519
+ form_params['contact_groups'] = @api_client.build_collection_param(opts[:'contact_groups'], :csv) unless opts[:'contact_groups'].nil?
520
+ form_params['paused'] = opts[:'paused'] unless opts[:'paused'].nil?
521
+ form_params['region'] = opts[:'region'] unless opts[:'region'].nil?
522
+
523
+ # http body (model)
524
+ post_body = opts[:debug_body]
525
+
526
+ # return_type
527
+ return_type = opts[:debug_return_type]
528
+
529
+ # auth_names
530
+ auth_names = opts[:debug_auth_names] || []
531
+
532
+ new_options = opts.merge(
533
+ :operation => :'PagespeedApi.update_pagespeed_test',
534
+ :header_params => header_params,
535
+ :query_params => query_params,
536
+ :form_params => form_params,
537
+ :body => post_body,
538
+ :auth_names => auth_names,
539
+ :return_type => return_type,
540
+ )
541
+
542
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
543
+ if @api_client.config.debugging
544
+ @api_client.config.logger.debug "API called: PagespeedApi#update_pagespeed_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
545
+ end
546
+
547
+ [data, status_code, headers]
548
+ end
549
+ end
550
+ end