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,811 @@
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 'date'
31
+ require 'time'
32
+
33
+ module StatusCake
34
+ # :nodoc
35
+ class UptimeTest
36
+ # Uptime check ID
37
+ attr_accessor :id
38
+
39
+ # Name of the check
40
+ attr_accessor :name
41
+
42
+ attr_accessor :test_type
43
+
44
+ # URL, FQDN, or IP address of the server under test
45
+ attr_accessor :website_url
46
+
47
+ attr_accessor :check_rate
48
+
49
+ # Number of confirmation servers to confirm downtime before an alert is triggered
50
+ attr_accessor :confirmation
51
+
52
+ # List of contact group IDs
53
+ attr_accessor :contact_groups
54
+
55
+ # JSON object. Represents headers to be sent when making requests
56
+ attr_accessor :custom_header
57
+
58
+ # List of IP addresses to compare against returned DNS records
59
+ attr_accessor :dns_ips
60
+
61
+ # FQDN or IP address of the nameserver to query
62
+ attr_accessor :dns_server
63
+
64
+ # Whether to consider the check as down if the content is present within the response
65
+ attr_accessor :do_not_find
66
+
67
+ # Whether to send an alert if the SSL certificate is soon to expire
68
+ attr_accessor :enable_ssl_alert
69
+
70
+ # Specify where the redirect chain should end
71
+ attr_accessor :final_endpoint
72
+
73
+ # String to look for within the response. Considered down if not found
74
+ attr_accessor :find_string
75
+
76
+ # Whether to follow redirects when testing. Disabled by default
77
+ attr_accessor :follow_redirects
78
+
79
+ # Include header content in string match search
80
+ attr_accessor :include_header
81
+
82
+ # Name of the hosting provider
83
+ attr_accessor :host
84
+
85
+ # When the check was last run (RFC3339 format)
86
+ attr_accessor :last_tested_at
87
+
88
+ # The server location the check will run next
89
+ attr_accessor :next_location
90
+
91
+ # Whether the check should be run
92
+ attr_accessor :paused
93
+
94
+ # Destination port for TCP checks
95
+ attr_accessor :port
96
+
97
+ # JSON object. Payload submitted with the request. Setting this updates the check to use the HTTP POST verb
98
+ attr_accessor :_post_body
99
+
100
+ # Raw HTTP POST string to send to the server
101
+ attr_accessor :post_raw
102
+
103
+ # Whether the check is currently being processed
104
+ attr_accessor :processing
105
+
106
+ # The server location the check is currently being run
107
+ attr_accessor :processing_on
108
+
109
+ attr_accessor :processing_state
110
+
111
+ # List of assigned monitoring locations on which to run checks
112
+ attr_accessor :servers
113
+
114
+ attr_accessor :status
115
+
116
+ # List of status codes that trigger an alert
117
+ attr_accessor :status_codes
118
+
119
+ # List of tags
120
+ attr_accessor :tags
121
+
122
+ # The number of seconds to wait to receive the first byte
123
+ attr_accessor :timeout
124
+
125
+ # The number of minutes to wait before sending an alert
126
+ attr_accessor :trigger_rate
127
+
128
+ # Uptime percentage for a check
129
+ attr_accessor :uptime
130
+
131
+ # Whether to enable cookie storage
132
+ attr_accessor :use_jar
133
+
134
+ # Custom user agent string set when testing
135
+ attr_accessor :user_agent
136
+
137
+ # Attribute mapping from ruby-style variable name to JSON key.
138
+ def self.attribute_map
139
+ {
140
+ :'id' => :'id',
141
+ :'name' => :'name',
142
+ :'test_type' => :'test_type',
143
+ :'website_url' => :'website_url',
144
+ :'check_rate' => :'check_rate',
145
+ :'confirmation' => :'confirmation',
146
+ :'contact_groups' => :'contact_groups',
147
+ :'custom_header' => :'custom_header',
148
+ :'dns_ips' => :'dns_ips',
149
+ :'dns_server' => :'dns_server',
150
+ :'do_not_find' => :'do_not_find',
151
+ :'enable_ssl_alert' => :'enable_ssl_alert',
152
+ :'final_endpoint' => :'final_endpoint',
153
+ :'find_string' => :'find_string',
154
+ :'follow_redirects' => :'follow_redirects',
155
+ :'include_header' => :'include_header',
156
+ :'host' => :'host',
157
+ :'last_tested_at' => :'last_tested_at',
158
+ :'next_location' => :'next_location',
159
+ :'paused' => :'paused',
160
+ :'port' => :'port',
161
+ :'_post_body' => :'post_body',
162
+ :'post_raw' => :'post_raw',
163
+ :'processing' => :'processing',
164
+ :'processing_on' => :'processing_on',
165
+ :'processing_state' => :'processing_state',
166
+ :'servers' => :'servers',
167
+ :'status' => :'status',
168
+ :'status_codes' => :'status_codes',
169
+ :'tags' => :'tags',
170
+ :'timeout' => :'timeout',
171
+ :'trigger_rate' => :'trigger_rate',
172
+ :'uptime' => :'uptime',
173
+ :'use_jar' => :'use_jar',
174
+ :'user_agent' => :'user_agent',
175
+ }
176
+ end
177
+
178
+ # Returns all the JSON keys this model knows about
179
+ def self.acceptable_attributes
180
+ attribute_map.values
181
+ end
182
+
183
+ # Attribute type mapping.
184
+ def self.openapi_types
185
+ {
186
+ :'id' => :'String',
187
+ :'name' => :'String',
188
+ :'test_type' => :'UptimeTestType',
189
+ :'website_url' => :'String',
190
+ :'check_rate' => :'UptimeTestCheckRate',
191
+ :'confirmation' => :'Integer',
192
+ :'contact_groups' => :'Array<String>',
193
+ :'custom_header' => :'String',
194
+ :'dns_ips' => :'Array<String>',
195
+ :'dns_server' => :'String',
196
+ :'do_not_find' => :'Boolean',
197
+ :'enable_ssl_alert' => :'Boolean',
198
+ :'final_endpoint' => :'String',
199
+ :'find_string' => :'String',
200
+ :'follow_redirects' => :'Boolean',
201
+ :'include_header' => :'Boolean',
202
+ :'host' => :'String',
203
+ :'last_tested_at' => :'Time',
204
+ :'next_location' => :'String',
205
+ :'paused' => :'Boolean',
206
+ :'port' => :'Integer',
207
+ :'_post_body' => :'String',
208
+ :'post_raw' => :'String',
209
+ :'processing' => :'Boolean',
210
+ :'processing_on' => :'String',
211
+ :'processing_state' => :'UptimeTestProcessingState',
212
+ :'servers' => :'Array<MonitoringLocation>',
213
+ :'status' => :'UptimeTestStatus',
214
+ :'status_codes' => :'Array<String>',
215
+ :'tags' => :'Array<String>',
216
+ :'timeout' => :'Integer',
217
+ :'trigger_rate' => :'Integer',
218
+ :'uptime' => :'Float',
219
+ :'use_jar' => :'Boolean',
220
+ :'user_agent' => :'String',
221
+ }
222
+ end
223
+
224
+ # List of attributes with nullable: true
225
+ def self.openapi_nullable
226
+ Set.new([])
227
+ end
228
+
229
+ # Initializes the object
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ def initialize(attributes = {})
232
+ unless attributes.is_a?(Hash)
233
+ raise ArgumentError, "The input argument (attributes) must be a hash in `StatusCake::UptimeTest` initialize method"
234
+ end
235
+
236
+ # check to see if the attribute exists and convert string to symbol for hash key
237
+ attributes = attributes.each_with_object({}) { |(k, v), h|
238
+ unless self.class.attribute_map.key?(k.to_sym)
239
+ raise ArgumentError, "`#{k}` is not a valid attribute in `StatusCake::UptimeTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
240
+ end
241
+ h[k.to_sym] = v
242
+ }
243
+
244
+ if attributes.key?(:'id')
245
+ self.id = attributes[:'id']
246
+ end
247
+
248
+ if attributes.key?(:'name')
249
+ self.name = attributes[:'name']
250
+ end
251
+
252
+ if attributes.key?(:'test_type')
253
+ self.test_type = attributes[:'test_type']
254
+ end
255
+
256
+ if attributes.key?(:'website_url')
257
+ self.website_url = attributes[:'website_url']
258
+ end
259
+
260
+ if attributes.key?(:'check_rate')
261
+ self.check_rate = attributes[:'check_rate']
262
+ end
263
+
264
+ if attributes.key?(:'confirmation')
265
+ self.confirmation = attributes[:'confirmation']
266
+ end
267
+
268
+ if attributes.key?(:'contact_groups')
269
+ if (value = attributes[:'contact_groups']).is_a?(Array)
270
+ self.contact_groups = value
271
+ end
272
+ end
273
+
274
+ if attributes.key?(:'custom_header')
275
+ self.custom_header = attributes[:'custom_header']
276
+ end
277
+
278
+ if attributes.key?(:'dns_ips')
279
+ if (value = attributes[:'dns_ips']).is_a?(Array)
280
+ self.dns_ips = value
281
+ end
282
+ end
283
+
284
+ if attributes.key?(:'dns_server')
285
+ self.dns_server = attributes[:'dns_server']
286
+ end
287
+
288
+ if attributes.key?(:'do_not_find')
289
+ self.do_not_find = attributes[:'do_not_find']
290
+ end
291
+
292
+ if attributes.key?(:'enable_ssl_alert')
293
+ self.enable_ssl_alert = attributes[:'enable_ssl_alert']
294
+ end
295
+
296
+ if attributes.key?(:'final_endpoint')
297
+ self.final_endpoint = attributes[:'final_endpoint']
298
+ end
299
+
300
+ if attributes.key?(:'find_string')
301
+ self.find_string = attributes[:'find_string']
302
+ end
303
+
304
+ if attributes.key?(:'follow_redirects')
305
+ self.follow_redirects = attributes[:'follow_redirects']
306
+ end
307
+
308
+ if attributes.key?(:'include_header')
309
+ self.include_header = attributes[:'include_header']
310
+ end
311
+
312
+ if attributes.key?(:'host')
313
+ self.host = attributes[:'host']
314
+ end
315
+
316
+ if attributes.key?(:'last_tested_at')
317
+ self.last_tested_at = attributes[:'last_tested_at']
318
+ end
319
+
320
+ if attributes.key?(:'next_location')
321
+ self.next_location = attributes[:'next_location']
322
+ end
323
+
324
+ if attributes.key?(:'paused')
325
+ self.paused = attributes[:'paused']
326
+ end
327
+
328
+ if attributes.key?(:'port')
329
+ self.port = attributes[:'port']
330
+ end
331
+
332
+ if attributes.key?(:'_post_body')
333
+ self._post_body = attributes[:'_post_body']
334
+ end
335
+
336
+ if attributes.key?(:'post_raw')
337
+ self.post_raw = attributes[:'post_raw']
338
+ end
339
+
340
+ if attributes.key?(:'processing')
341
+ self.processing = attributes[:'processing']
342
+ end
343
+
344
+ if attributes.key?(:'processing_on')
345
+ self.processing_on = attributes[:'processing_on']
346
+ end
347
+
348
+ if attributes.key?(:'processing_state')
349
+ self.processing_state = attributes[:'processing_state']
350
+ end
351
+
352
+ if attributes.key?(:'servers')
353
+ if (value = attributes[:'servers']).is_a?(Array)
354
+ self.servers = value
355
+ end
356
+ end
357
+
358
+ if attributes.key?(:'status')
359
+ self.status = attributes[:'status']
360
+ end
361
+
362
+ if attributes.key?(:'status_codes')
363
+ if (value = attributes[:'status_codes']).is_a?(Array)
364
+ self.status_codes = value
365
+ end
366
+ end
367
+
368
+ if attributes.key?(:'tags')
369
+ if (value = attributes[:'tags']).is_a?(Array)
370
+ self.tags = value
371
+ end
372
+ end
373
+
374
+ if attributes.key?(:'timeout')
375
+ self.timeout = attributes[:'timeout']
376
+ end
377
+
378
+ if attributes.key?(:'trigger_rate')
379
+ self.trigger_rate = attributes[:'trigger_rate']
380
+ end
381
+
382
+ if attributes.key?(:'uptime')
383
+ self.uptime = attributes[:'uptime']
384
+ end
385
+
386
+ if attributes.key?(:'use_jar')
387
+ self.use_jar = attributes[:'use_jar']
388
+ end
389
+
390
+ if attributes.key?(:'user_agent')
391
+ self.user_agent = attributes[:'user_agent']
392
+ end
393
+ end
394
+
395
+ # Show invalid properties with the reasons. Usually used together with valid?
396
+ # @return Array for valid properties with the reasons
397
+ def list_invalid_properties
398
+ invalid_properties = []
399
+ if @id.nil?
400
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
401
+ end
402
+
403
+ if @name.nil?
404
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
405
+ end
406
+
407
+ if @test_type.nil?
408
+ invalid_properties.push('invalid value for "test_type", test_type cannot be nil.')
409
+ end
410
+
411
+ if @website_url.nil?
412
+ invalid_properties.push('invalid value for "website_url", website_url cannot be nil.')
413
+ end
414
+
415
+ if @check_rate.nil?
416
+ invalid_properties.push('invalid value for "check_rate", check_rate cannot be nil.')
417
+ end
418
+
419
+ if @confirmation.nil?
420
+ invalid_properties.push('invalid value for "confirmation", confirmation cannot be nil.')
421
+ end
422
+
423
+ if @confirmation > 3
424
+ invalid_properties.push('invalid value for "confirmation", must be smaller than or equal to 3.')
425
+ end
426
+
427
+ if @confirmation < 0
428
+ invalid_properties.push('invalid value for "confirmation", must be greater than or equal to 0.')
429
+ end
430
+
431
+ if @contact_groups.nil?
432
+ invalid_properties.push('invalid value for "contact_groups", contact_groups cannot be nil.')
433
+ end
434
+
435
+ if @dns_ips.nil?
436
+ invalid_properties.push('invalid value for "dns_ips", dns_ips cannot be nil.')
437
+ end
438
+
439
+ if @do_not_find.nil?
440
+ invalid_properties.push('invalid value for "do_not_find", do_not_find cannot be nil.')
441
+ end
442
+
443
+ if @enable_ssl_alert.nil?
444
+ invalid_properties.push('invalid value for "enable_ssl_alert", enable_ssl_alert cannot be nil.')
445
+ end
446
+
447
+ if @follow_redirects.nil?
448
+ invalid_properties.push('invalid value for "follow_redirects", follow_redirects cannot be nil.')
449
+ end
450
+
451
+ if @include_header.nil?
452
+ invalid_properties.push('invalid value for "include_header", include_header cannot be nil.')
453
+ end
454
+
455
+ if @paused.nil?
456
+ invalid_properties.push('invalid value for "paused", paused cannot be nil.')
457
+ end
458
+
459
+ if !@port.nil? && @port < 0
460
+ invalid_properties.push('invalid value for "port", must be greater than or equal to 0.')
461
+ end
462
+
463
+ if @processing.nil?
464
+ invalid_properties.push('invalid value for "processing", processing cannot be nil.')
465
+ end
466
+
467
+ if @servers.nil?
468
+ invalid_properties.push('invalid value for "servers", servers cannot be nil.')
469
+ end
470
+
471
+ if @status.nil?
472
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
473
+ end
474
+
475
+ if @status_codes.nil?
476
+ invalid_properties.push('invalid value for "status_codes", status_codes cannot be nil.')
477
+ end
478
+
479
+ if @tags.nil?
480
+ invalid_properties.push('invalid value for "tags", tags cannot be nil.')
481
+ end
482
+
483
+ if @timeout.nil?
484
+ invalid_properties.push('invalid value for "timeout", timeout cannot be nil.')
485
+ end
486
+
487
+ if @timeout > 75
488
+ invalid_properties.push('invalid value for "timeout", must be smaller than or equal to 75.')
489
+ end
490
+
491
+ if @timeout < 5
492
+ invalid_properties.push('invalid value for "timeout", must be greater than or equal to 5.')
493
+ end
494
+
495
+ if @trigger_rate.nil?
496
+ invalid_properties.push('invalid value for "trigger_rate", trigger_rate cannot be nil.')
497
+ end
498
+
499
+ if @trigger_rate > 60
500
+ invalid_properties.push('invalid value for "trigger_rate", must be smaller than or equal to 60.')
501
+ end
502
+
503
+ if @trigger_rate < 0
504
+ invalid_properties.push('invalid value for "trigger_rate", must be greater than or equal to 0.')
505
+ end
506
+
507
+ if @uptime.nil?
508
+ invalid_properties.push('invalid value for "uptime", uptime cannot be nil.')
509
+ end
510
+
511
+ if @uptime < 0
512
+ invalid_properties.push('invalid value for "uptime", must be greater than or equal to 0.')
513
+ end
514
+
515
+ if @use_jar.nil?
516
+ invalid_properties.push('invalid value for "use_jar", use_jar cannot be nil.')
517
+ end
518
+
519
+ invalid_properties
520
+ end
521
+
522
+ # Check to see if the all the properties in the model are valid
523
+ # @return true if the model is valid
524
+ def valid?
525
+ return false if @id.nil?
526
+ return false if @name.nil?
527
+ return false if @test_type.nil?
528
+ return false if @website_url.nil?
529
+ return false if @check_rate.nil?
530
+ return false if @confirmation.nil?
531
+ return false if @confirmation > 3
532
+ return false if @confirmation < 0
533
+ return false if @contact_groups.nil?
534
+ return false if @dns_ips.nil?
535
+ return false if @do_not_find.nil?
536
+ return false if @enable_ssl_alert.nil?
537
+ return false if @follow_redirects.nil?
538
+ return false if @include_header.nil?
539
+ return false if @paused.nil?
540
+ return false if !@port.nil? && @port < 0
541
+ return false if @processing.nil?
542
+ return false if @servers.nil?
543
+ return false if @status.nil?
544
+ return false if @status_codes.nil?
545
+ return false if @tags.nil?
546
+ return false if @timeout.nil?
547
+ return false if @timeout > 75
548
+ return false if @timeout < 5
549
+ return false if @trigger_rate.nil?
550
+ return false if @trigger_rate > 60
551
+ return false if @trigger_rate < 0
552
+ return false if @uptime.nil?
553
+ return false if @uptime < 0
554
+ return false if @use_jar.nil?
555
+ true
556
+ end
557
+
558
+ # Custom attribute writer method with validation
559
+ # @param [Object] confirmation Value to be assigned
560
+ def confirmation=(confirmation)
561
+ if confirmation.nil?
562
+ raise ArgumentError, 'confirmation cannot be nil'
563
+ end
564
+
565
+ if confirmation > 3
566
+ raise ArgumentError, 'invalid value for "confirmation", must be smaller than or equal to 3.'
567
+ end
568
+
569
+ if confirmation < 0
570
+ raise ArgumentError, 'invalid value for "confirmation", must be greater than or equal to 0.'
571
+ end
572
+
573
+ @confirmation = confirmation
574
+ end
575
+
576
+ # Custom attribute writer method with validation
577
+ # @param [Object] port Value to be assigned
578
+ def port=(port)
579
+ if !port.nil? && port < 0
580
+ raise ArgumentError, 'invalid value for "port", must be greater than or equal to 0.'
581
+ end
582
+
583
+ @port = port
584
+ end
585
+
586
+ # Custom attribute writer method with validation
587
+ # @param [Object] timeout Value to be assigned
588
+ def timeout=(timeout)
589
+ if timeout.nil?
590
+ raise ArgumentError, 'timeout cannot be nil'
591
+ end
592
+
593
+ if timeout > 75
594
+ raise ArgumentError, 'invalid value for "timeout", must be smaller than or equal to 75.'
595
+ end
596
+
597
+ if timeout < 5
598
+ raise ArgumentError, 'invalid value for "timeout", must be greater than or equal to 5.'
599
+ end
600
+
601
+ @timeout = timeout
602
+ end
603
+
604
+ # Custom attribute writer method with validation
605
+ # @param [Object] trigger_rate Value to be assigned
606
+ def trigger_rate=(trigger_rate)
607
+ if trigger_rate.nil?
608
+ raise ArgumentError, 'trigger_rate cannot be nil'
609
+ end
610
+
611
+ if trigger_rate > 60
612
+ raise ArgumentError, 'invalid value for "trigger_rate", must be smaller than or equal to 60.'
613
+ end
614
+
615
+ if trigger_rate < 0
616
+ raise ArgumentError, 'invalid value for "trigger_rate", must be greater than or equal to 0.'
617
+ end
618
+
619
+ @trigger_rate = trigger_rate
620
+ end
621
+
622
+ # Custom attribute writer method with validation
623
+ # @param [Object] uptime Value to be assigned
624
+ def uptime=(uptime)
625
+ if uptime.nil?
626
+ raise ArgumentError, 'uptime cannot be nil'
627
+ end
628
+
629
+ if uptime < 0
630
+ raise ArgumentError, 'invalid value for "uptime", must be greater than or equal to 0.'
631
+ end
632
+
633
+ @uptime = uptime
634
+ end
635
+
636
+ # Checks equality by comparing each attribute.
637
+ # @param [Object] Object to be compared
638
+ def ==(other)
639
+ return true if equal?(other)
640
+ self.class == other.class &&
641
+ id == other.id &&
642
+ name == other.name &&
643
+ test_type == other.test_type &&
644
+ website_url == other.website_url &&
645
+ check_rate == other.check_rate &&
646
+ confirmation == other.confirmation &&
647
+ contact_groups == other.contact_groups &&
648
+ custom_header == other.custom_header &&
649
+ dns_ips == other.dns_ips &&
650
+ dns_server == other.dns_server &&
651
+ do_not_find == other.do_not_find &&
652
+ enable_ssl_alert == other.enable_ssl_alert &&
653
+ final_endpoint == other.final_endpoint &&
654
+ find_string == other.find_string &&
655
+ follow_redirects == other.follow_redirects &&
656
+ include_header == other.include_header &&
657
+ host == other.host &&
658
+ last_tested_at == other.last_tested_at &&
659
+ next_location == other.next_location &&
660
+ paused == other.paused &&
661
+ port == other.port &&
662
+ _post_body == other._post_body &&
663
+ post_raw == other.post_raw &&
664
+ processing == other.processing &&
665
+ processing_on == other.processing_on &&
666
+ processing_state == other.processing_state &&
667
+ servers == other.servers &&
668
+ status == other.status &&
669
+ status_codes == other.status_codes &&
670
+ tags == other.tags &&
671
+ timeout == other.timeout &&
672
+ trigger_rate == other.trigger_rate &&
673
+ uptime == other.uptime &&
674
+ use_jar == other.use_jar &&
675
+ user_agent == other.user_agent
676
+ end
677
+
678
+ # @see the `==` method
679
+ # @param [Object] Object to be compared
680
+ def eql?(other)
681
+ self == other
682
+ end
683
+
684
+ # Calculates hash code according to all attributes.
685
+ # @return [Integer] Hash code
686
+ def hash
687
+ [id, name, test_type, website_url, check_rate, confirmation, contact_groups, custom_header, dns_ips, dns_server, do_not_find, enable_ssl_alert, final_endpoint, find_string, follow_redirects, include_header, host, last_tested_at, next_location, paused, port, _post_body, post_raw, processing, processing_on, processing_state, servers, status, status_codes, tags, timeout, trigger_rate, uptime, use_jar, user_agent].hash
688
+ end
689
+
690
+ # Builds the object from hash
691
+ # @param [Hash] attributes Model attributes in the form of hash
692
+ # @return [Object] Returns the model itself
693
+ def self.build_from_hash(attributes)
694
+ new.build_from_hash(attributes)
695
+ end
696
+
697
+ # Builds the object from hash
698
+ # @param [Hash] attributes Model attributes in the form of hash
699
+ # @return [Object] Returns the model itself
700
+ def build_from_hash(attributes)
701
+ return nil unless attributes.is_a?(Hash)
702
+ attributes = attributes.transform_keys(&:to_sym)
703
+ self.class.openapi_types.each_pair do |key, type|
704
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
705
+ send("#{key}=", nil)
706
+ elsif type =~ /\AArray<(.*)>/i
707
+ # check to ensure the input is an array given that the attribute
708
+ # is documented as an array but the input is not
709
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
710
+ send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(Regexp.last_match(1), v) })
711
+ end
712
+ elsif !attributes[self.class.attribute_map[key]].nil?
713
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
714
+ end
715
+ end
716
+
717
+ self
718
+ end
719
+
720
+ # Deserializes the data based on type
721
+ # @param string type Data type
722
+ # @param string value Value to be deserialized
723
+ # @return [Object] Deserialized data
724
+ def _deserialize(type, value)
725
+ case type.to_sym
726
+ when :Time
727
+ Time.parse(value)
728
+ when :Date
729
+ Date.parse(value)
730
+ when :String
731
+ value.to_s
732
+ when :Integer
733
+ value.to_i
734
+ when :Float
735
+ value.to_f
736
+ when :Boolean
737
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
738
+ true
739
+ else
740
+ false
741
+ end
742
+ when :Object
743
+ # generic object (usually a Hash), return directly
744
+ value
745
+ when /\AArray<(?<inner_type>.+)>\z/
746
+ inner_type = Regexp.last_match[:inner_type]
747
+ value.map { |v| _deserialize(inner_type, v) }
748
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
749
+ k_type = Regexp.last_match[:k_type]
750
+ v_type = Regexp.last_match[:v_type]
751
+ {}.tap do |hash|
752
+ value.each do |k, v|
753
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
754
+ end
755
+ end
756
+ else # model
757
+ # models (e.g. Pet) or oneOf
758
+ klass = StatusCake.const_get(type)
759
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
760
+ end
761
+ end
762
+
763
+ # Returns the string representation of the object
764
+ # @return [String] String presentation of the object
765
+ def to_s
766
+ to_hash.to_s
767
+ end
768
+
769
+ # to_body is an alias to to_hash (backward compatibility)
770
+ # @return [Hash] Returns the object in the form of hash
771
+ def to_body
772
+ to_hash
773
+ end
774
+
775
+ # Returns the object in the form of hash
776
+ # @return [Hash] Returns the object in the form of hash
777
+ def to_hash
778
+ hash = {}
779
+ self.class.attribute_map.each_pair do |attr, param|
780
+ value = send(attr)
781
+ if value.nil?
782
+ is_nullable = self.class.openapi_nullable.include?(attr)
783
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
784
+ end
785
+
786
+ hash[param] = _to_hash(value)
787
+ end
788
+ hash
789
+ end
790
+
791
+ # Outputs non-array value in the form of hash
792
+ # For object, use to_hash. Otherwise, just return the value
793
+ # @param [Object] value Any valid value
794
+ # @return [Hash] Returns the value in the form of hash
795
+ def _to_hash(value)
796
+ if value.is_a?(Array)
797
+ value.compact.map { |v| _to_hash(v) }
798
+ elsif value.is_a?(Hash)
799
+ {}.tap do |hash|
800
+ value.each { |k, v| hash[k] = _to_hash(v) }
801
+ end
802
+ elsif value.respond_to? :to_hash
803
+ value.to_hash
804
+ else
805
+ value
806
+ end
807
+ end
808
+
809
+ end
810
+
811
+ end