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,594 @@
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 SSLTest
36
+ # SSL check ID
37
+ attr_accessor :id
38
+
39
+ # URL of the server under test
40
+ attr_accessor :website_url
41
+
42
+ attr_accessor :check_rate
43
+
44
+ # List representing when alerts should be sent (days).
45
+ attr_accessor :alert_at
46
+
47
+ # Whether to enable alerts when SSL certificate issues are found
48
+ attr_accessor :alert_broken
49
+
50
+ # Whether to enable alerts when the SSL certificate is to expire
51
+ attr_accessor :alert_expiry
52
+
53
+ # Whether to enable alerts when mixed content is found
54
+ attr_accessor :alert_mixed
55
+
56
+ # Whether to enable alert reminders
57
+ attr_accessor :alert_reminder
58
+
59
+ # SSL certificate score (%)
60
+ attr_accessor :certificate_score
61
+
62
+ # SSL certificate status
63
+ attr_accessor :certificate_status
64
+
65
+ # SSL/TLS cipher suite belonging to the SSL certificate
66
+ attr_accessor :cipher
67
+
68
+ # SSL certificate cipher strength (%)
69
+ attr_accessor :cipher_score
70
+
71
+ # List of contact group IDs
72
+ attr_accessor :contact_groups
73
+
74
+ # Issuer of the SSL certificate
75
+ attr_accessor :issuer_common_name
76
+
77
+ attr_accessor :flags
78
+
79
+ # Whether to follow redirects when testing. Disabled by default
80
+ attr_accessor :follow_redirects
81
+
82
+ # Hostname of the server under test
83
+ attr_accessor :hostname
84
+
85
+ # The last reminder to have been sent (days)
86
+ attr_accessor :last_reminder
87
+
88
+ # List of mixed content resources
89
+ attr_accessor :mixed_content
90
+
91
+ # Whether the check should be run
92
+ attr_accessor :paused
93
+
94
+ # When the SSL certificate was last updated (RFC3339 format)
95
+ attr_accessor :updated_at
96
+
97
+ # Custom user agent string set when testing
98
+ attr_accessor :user_agent
99
+
100
+ # SSL certificate validity start (RFC3339 format)
101
+ attr_accessor :valid_from
102
+
103
+ # SSL certificate validity end (RFC3339 format)
104
+ attr_accessor :valid_until
105
+
106
+ # Attribute mapping from ruby-style variable name to JSON key.
107
+ def self.attribute_map
108
+ {
109
+ :'id' => :'id',
110
+ :'website_url' => :'website_url',
111
+ :'check_rate' => :'check_rate',
112
+ :'alert_at' => :'alert_at',
113
+ :'alert_broken' => :'alert_broken',
114
+ :'alert_expiry' => :'alert_expiry',
115
+ :'alert_mixed' => :'alert_mixed',
116
+ :'alert_reminder' => :'alert_reminder',
117
+ :'certificate_score' => :'certificate_score',
118
+ :'certificate_status' => :'certificate_status',
119
+ :'cipher' => :'cipher',
120
+ :'cipher_score' => :'cipher_score',
121
+ :'contact_groups' => :'contact_groups',
122
+ :'issuer_common_name' => :'issuer_common_name',
123
+ :'flags' => :'flags',
124
+ :'follow_redirects' => :'follow_redirects',
125
+ :'hostname' => :'hostname',
126
+ :'last_reminder' => :'last_reminder',
127
+ :'mixed_content' => :'mixed_content',
128
+ :'paused' => :'paused',
129
+ :'updated_at' => :'updated_at',
130
+ :'user_agent' => :'user_agent',
131
+ :'valid_from' => :'valid_from',
132
+ :'valid_until' => :'valid_until',
133
+ }
134
+ end
135
+
136
+ # Returns all the JSON keys this model knows about
137
+ def self.acceptable_attributes
138
+ attribute_map.values
139
+ end
140
+
141
+ # Attribute type mapping.
142
+ def self.openapi_types
143
+ {
144
+ :'id' => :'String',
145
+ :'website_url' => :'String',
146
+ :'check_rate' => :'SSLTestCheckRate',
147
+ :'alert_at' => :'Array<Integer>',
148
+ :'alert_broken' => :'Boolean',
149
+ :'alert_expiry' => :'Boolean',
150
+ :'alert_mixed' => :'Boolean',
151
+ :'alert_reminder' => :'Boolean',
152
+ :'certificate_score' => :'Integer',
153
+ :'certificate_status' => :'String',
154
+ :'cipher' => :'String',
155
+ :'cipher_score' => :'Integer',
156
+ :'contact_groups' => :'Array<String>',
157
+ :'issuer_common_name' => :'String',
158
+ :'flags' => :'SSLTestFlags',
159
+ :'follow_redirects' => :'Boolean',
160
+ :'hostname' => :'String',
161
+ :'last_reminder' => :'Integer',
162
+ :'mixed_content' => :'Array<SSLTestMixedContent>',
163
+ :'paused' => :'Boolean',
164
+ :'updated_at' => :'Time',
165
+ :'user_agent' => :'String',
166
+ :'valid_from' => :'Time',
167
+ :'valid_until' => :'Time',
168
+ }
169
+ end
170
+
171
+ # List of attributes with nullable: true
172
+ def self.openapi_nullable
173
+ Set.new([])
174
+ end
175
+
176
+ # Initializes the object
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ def initialize(attributes = {})
179
+ unless attributes.is_a?(Hash)
180
+ raise ArgumentError, "The input argument (attributes) must be a hash in `StatusCake::SSLTest` initialize method"
181
+ end
182
+
183
+ # check to see if the attribute exists and convert string to symbol for hash key
184
+ attributes = attributes.each_with_object({}) { |(k, v), h|
185
+ unless self.class.attribute_map.key?(k.to_sym)
186
+ raise ArgumentError, "`#{k}` is not a valid attribute in `StatusCake::SSLTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
187
+ end
188
+ h[k.to_sym] = v
189
+ }
190
+
191
+ if attributes.key?(:'id')
192
+ self.id = attributes[:'id']
193
+ end
194
+
195
+ if attributes.key?(:'website_url')
196
+ self.website_url = attributes[:'website_url']
197
+ end
198
+
199
+ if attributes.key?(:'check_rate')
200
+ self.check_rate = attributes[:'check_rate']
201
+ end
202
+
203
+ if attributes.key?(:'alert_at')
204
+ if (value = attributes[:'alert_at']).is_a?(Array)
205
+ self.alert_at = value
206
+ end
207
+ end
208
+
209
+ if attributes.key?(:'alert_broken')
210
+ self.alert_broken = attributes[:'alert_broken']
211
+ end
212
+
213
+ if attributes.key?(:'alert_expiry')
214
+ self.alert_expiry = attributes[:'alert_expiry']
215
+ end
216
+
217
+ if attributes.key?(:'alert_mixed')
218
+ self.alert_mixed = attributes[:'alert_mixed']
219
+ end
220
+
221
+ if attributes.key?(:'alert_reminder')
222
+ self.alert_reminder = attributes[:'alert_reminder']
223
+ end
224
+
225
+ if attributes.key?(:'certificate_score')
226
+ self.certificate_score = attributes[:'certificate_score']
227
+ end
228
+
229
+ if attributes.key?(:'certificate_status')
230
+ self.certificate_status = attributes[:'certificate_status']
231
+ end
232
+
233
+ if attributes.key?(:'cipher')
234
+ self.cipher = attributes[:'cipher']
235
+ end
236
+
237
+ if attributes.key?(:'cipher_score')
238
+ self.cipher_score = attributes[:'cipher_score']
239
+ end
240
+
241
+ if attributes.key?(:'contact_groups')
242
+ if (value = attributes[:'contact_groups']).is_a?(Array)
243
+ self.contact_groups = value
244
+ end
245
+ end
246
+
247
+ if attributes.key?(:'issuer_common_name')
248
+ self.issuer_common_name = attributes[:'issuer_common_name']
249
+ end
250
+
251
+ if attributes.key?(:'flags')
252
+ self.flags = attributes[:'flags']
253
+ end
254
+
255
+ if attributes.key?(:'follow_redirects')
256
+ self.follow_redirects = attributes[:'follow_redirects']
257
+ end
258
+
259
+ if attributes.key?(:'hostname')
260
+ self.hostname = attributes[:'hostname']
261
+ end
262
+
263
+ if attributes.key?(:'last_reminder')
264
+ self.last_reminder = attributes[:'last_reminder']
265
+ end
266
+
267
+ if attributes.key?(:'mixed_content')
268
+ if (value = attributes[:'mixed_content']).is_a?(Array)
269
+ self.mixed_content = value
270
+ end
271
+ end
272
+
273
+ if attributes.key?(:'paused')
274
+ self.paused = attributes[:'paused']
275
+ end
276
+
277
+ if attributes.key?(:'updated_at')
278
+ self.updated_at = attributes[:'updated_at']
279
+ end
280
+
281
+ if attributes.key?(:'user_agent')
282
+ self.user_agent = attributes[:'user_agent']
283
+ end
284
+
285
+ if attributes.key?(:'valid_from')
286
+ self.valid_from = attributes[:'valid_from']
287
+ end
288
+
289
+ if attributes.key?(:'valid_until')
290
+ self.valid_until = attributes[:'valid_until']
291
+ end
292
+ end
293
+
294
+ # Show invalid properties with the reasons. Usually used together with valid?
295
+ # @return Array for valid properties with the reasons
296
+ def list_invalid_properties
297
+ invalid_properties = []
298
+ if @id.nil?
299
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
300
+ end
301
+
302
+ if @website_url.nil?
303
+ invalid_properties.push('invalid value for "website_url", website_url cannot be nil.')
304
+ end
305
+
306
+ if @check_rate.nil?
307
+ invalid_properties.push('invalid value for "check_rate", check_rate cannot be nil.')
308
+ end
309
+
310
+ if @alert_at.nil?
311
+ invalid_properties.push('invalid value for "alert_at", alert_at cannot be nil.')
312
+ end
313
+
314
+ if @alert_broken.nil?
315
+ invalid_properties.push('invalid value for "alert_broken", alert_broken cannot be nil.')
316
+ end
317
+
318
+ if @alert_expiry.nil?
319
+ invalid_properties.push('invalid value for "alert_expiry", alert_expiry cannot be nil.')
320
+ end
321
+
322
+ if @alert_mixed.nil?
323
+ invalid_properties.push('invalid value for "alert_mixed", alert_mixed cannot be nil.')
324
+ end
325
+
326
+ if @alert_reminder.nil?
327
+ invalid_properties.push('invalid value for "alert_reminder", alert_reminder cannot be nil.')
328
+ end
329
+
330
+ if !@certificate_score.nil? && @certificate_score > 100
331
+ invalid_properties.push('invalid value for "certificate_score", must be smaller than or equal to 100.')
332
+ end
333
+
334
+ if !@certificate_score.nil? && @certificate_score < 0
335
+ invalid_properties.push('invalid value for "certificate_score", must be greater than or equal to 0.')
336
+ end
337
+
338
+ if !@cipher_score.nil? && @cipher_score > 100
339
+ invalid_properties.push('invalid value for "cipher_score", must be smaller than or equal to 100.')
340
+ end
341
+
342
+ if !@cipher_score.nil? && @cipher_score < 0
343
+ invalid_properties.push('invalid value for "cipher_score", must be greater than or equal to 0.')
344
+ end
345
+
346
+ if @contact_groups.nil?
347
+ invalid_properties.push('invalid value for "contact_groups", contact_groups cannot be nil.')
348
+ end
349
+
350
+ if @follow_redirects.nil?
351
+ invalid_properties.push('invalid value for "follow_redirects", follow_redirects cannot be nil.')
352
+ end
353
+
354
+ if !@last_reminder.nil? && @last_reminder < 0
355
+ invalid_properties.push('invalid value for "last_reminder", must be greater than or equal to 0.')
356
+ end
357
+
358
+ if @mixed_content.nil?
359
+ invalid_properties.push('invalid value for "mixed_content", mixed_content cannot be nil.')
360
+ end
361
+
362
+ if @paused.nil?
363
+ invalid_properties.push('invalid value for "paused", paused cannot be nil.')
364
+ end
365
+
366
+ invalid_properties
367
+ end
368
+
369
+ # Check to see if the all the properties in the model are valid
370
+ # @return true if the model is valid
371
+ def valid?
372
+ return false if @id.nil?
373
+ return false if @website_url.nil?
374
+ return false if @check_rate.nil?
375
+ return false if @alert_at.nil?
376
+ return false if @alert_broken.nil?
377
+ return false if @alert_expiry.nil?
378
+ return false if @alert_mixed.nil?
379
+ return false if @alert_reminder.nil?
380
+ return false if !@certificate_score.nil? && @certificate_score > 100
381
+ return false if !@certificate_score.nil? && @certificate_score < 0
382
+ return false if !@cipher_score.nil? && @cipher_score > 100
383
+ return false if !@cipher_score.nil? && @cipher_score < 0
384
+ return false if @contact_groups.nil?
385
+ return false if @follow_redirects.nil?
386
+ return false if !@last_reminder.nil? && @last_reminder < 0
387
+ return false if @mixed_content.nil?
388
+ return false if @paused.nil?
389
+ true
390
+ end
391
+
392
+ # Custom attribute writer method with validation
393
+ # @param [Object] certificate_score Value to be assigned
394
+ def certificate_score=(certificate_score)
395
+ if !certificate_score.nil? && certificate_score > 100
396
+ raise ArgumentError, 'invalid value for "certificate_score", must be smaller than or equal to 100.'
397
+ end
398
+
399
+ if !certificate_score.nil? && certificate_score < 0
400
+ raise ArgumentError, 'invalid value for "certificate_score", must be greater than or equal to 0.'
401
+ end
402
+
403
+ @certificate_score = certificate_score
404
+ end
405
+
406
+ # Custom attribute writer method with validation
407
+ # @param [Object] cipher_score Value to be assigned
408
+ def cipher_score=(cipher_score)
409
+ if !cipher_score.nil? && cipher_score > 100
410
+ raise ArgumentError, 'invalid value for "cipher_score", must be smaller than or equal to 100.'
411
+ end
412
+
413
+ if !cipher_score.nil? && cipher_score < 0
414
+ raise ArgumentError, 'invalid value for "cipher_score", must be greater than or equal to 0.'
415
+ end
416
+
417
+ @cipher_score = cipher_score
418
+ end
419
+
420
+ # Custom attribute writer method with validation
421
+ # @param [Object] last_reminder Value to be assigned
422
+ def last_reminder=(last_reminder)
423
+ if !last_reminder.nil? && last_reminder < 0
424
+ raise ArgumentError, 'invalid value for "last_reminder", must be greater than or equal to 0.'
425
+ end
426
+
427
+ @last_reminder = last_reminder
428
+ end
429
+
430
+ # Checks equality by comparing each attribute.
431
+ # @param [Object] Object to be compared
432
+ def ==(other)
433
+ return true if equal?(other)
434
+ self.class == other.class &&
435
+ id == other.id &&
436
+ website_url == other.website_url &&
437
+ check_rate == other.check_rate &&
438
+ alert_at == other.alert_at &&
439
+ alert_broken == other.alert_broken &&
440
+ alert_expiry == other.alert_expiry &&
441
+ alert_mixed == other.alert_mixed &&
442
+ alert_reminder == other.alert_reminder &&
443
+ certificate_score == other.certificate_score &&
444
+ certificate_status == other.certificate_status &&
445
+ cipher == other.cipher &&
446
+ cipher_score == other.cipher_score &&
447
+ contact_groups == other.contact_groups &&
448
+ issuer_common_name == other.issuer_common_name &&
449
+ flags == other.flags &&
450
+ follow_redirects == other.follow_redirects &&
451
+ hostname == other.hostname &&
452
+ last_reminder == other.last_reminder &&
453
+ mixed_content == other.mixed_content &&
454
+ paused == other.paused &&
455
+ updated_at == other.updated_at &&
456
+ user_agent == other.user_agent &&
457
+ valid_from == other.valid_from &&
458
+ valid_until == other.valid_until
459
+ end
460
+
461
+ # @see the `==` method
462
+ # @param [Object] Object to be compared
463
+ def eql?(other)
464
+ self == other
465
+ end
466
+
467
+ # Calculates hash code according to all attributes.
468
+ # @return [Integer] Hash code
469
+ def hash
470
+ [id, website_url, check_rate, alert_at, alert_broken, alert_expiry, alert_mixed, alert_reminder, certificate_score, certificate_status, cipher, cipher_score, contact_groups, issuer_common_name, flags, follow_redirects, hostname, last_reminder, mixed_content, paused, updated_at, user_agent, valid_from, valid_until].hash
471
+ end
472
+
473
+ # Builds the object from hash
474
+ # @param [Hash] attributes Model attributes in the form of hash
475
+ # @return [Object] Returns the model itself
476
+ def self.build_from_hash(attributes)
477
+ new.build_from_hash(attributes)
478
+ end
479
+
480
+ # Builds the object from hash
481
+ # @param [Hash] attributes Model attributes in the form of hash
482
+ # @return [Object] Returns the model itself
483
+ def build_from_hash(attributes)
484
+ return nil unless attributes.is_a?(Hash)
485
+ attributes = attributes.transform_keys(&:to_sym)
486
+ self.class.openapi_types.each_pair do |key, type|
487
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
488
+ send("#{key}=", nil)
489
+ elsif type =~ /\AArray<(.*)>/i
490
+ # check to ensure the input is an array given that the attribute
491
+ # is documented as an array but the input is not
492
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
493
+ send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(Regexp.last_match(1), v) })
494
+ end
495
+ elsif !attributes[self.class.attribute_map[key]].nil?
496
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
497
+ end
498
+ end
499
+
500
+ self
501
+ end
502
+
503
+ # Deserializes the data based on type
504
+ # @param string type Data type
505
+ # @param string value Value to be deserialized
506
+ # @return [Object] Deserialized data
507
+ def _deserialize(type, value)
508
+ case type.to_sym
509
+ when :Time
510
+ Time.parse(value)
511
+ when :Date
512
+ Date.parse(value)
513
+ when :String
514
+ value.to_s
515
+ when :Integer
516
+ value.to_i
517
+ when :Float
518
+ value.to_f
519
+ when :Boolean
520
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
521
+ true
522
+ else
523
+ false
524
+ end
525
+ when :Object
526
+ # generic object (usually a Hash), return directly
527
+ value
528
+ when /\AArray<(?<inner_type>.+)>\z/
529
+ inner_type = Regexp.last_match[:inner_type]
530
+ value.map { |v| _deserialize(inner_type, v) }
531
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
532
+ k_type = Regexp.last_match[:k_type]
533
+ v_type = Regexp.last_match[:v_type]
534
+ {}.tap do |hash|
535
+ value.each do |k, v|
536
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
537
+ end
538
+ end
539
+ else # model
540
+ # models (e.g. Pet) or oneOf
541
+ klass = StatusCake.const_get(type)
542
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
543
+ end
544
+ end
545
+
546
+ # Returns the string representation of the object
547
+ # @return [String] String presentation of the object
548
+ def to_s
549
+ to_hash.to_s
550
+ end
551
+
552
+ # to_body is an alias to to_hash (backward compatibility)
553
+ # @return [Hash] Returns the object in the form of hash
554
+ def to_body
555
+ to_hash
556
+ end
557
+
558
+ # Returns the object in the form of hash
559
+ # @return [Hash] Returns the object in the form of hash
560
+ def to_hash
561
+ hash = {}
562
+ self.class.attribute_map.each_pair do |attr, param|
563
+ value = send(attr)
564
+ if value.nil?
565
+ is_nullable = self.class.openapi_nullable.include?(attr)
566
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
567
+ end
568
+
569
+ hash[param] = _to_hash(value)
570
+ end
571
+ hash
572
+ end
573
+
574
+ # Outputs non-array value in the form of hash
575
+ # For object, use to_hash. Otherwise, just return the value
576
+ # @param [Object] value Any valid value
577
+ # @return [Hash] Returns the value in the form of hash
578
+ def _to_hash(value)
579
+ if value.is_a?(Array)
580
+ value.compact.map { |v| _to_hash(v) }
581
+ elsif value.is_a?(Hash)
582
+ {}.tap do |hash|
583
+ value.each { |k, v| hash[k] = _to_hash(v) }
584
+ end
585
+ elsif value.respond_to? :to_hash
586
+ value.to_hash
587
+ else
588
+ value
589
+ end
590
+ end
591
+
592
+ end
593
+
594
+ end
@@ -0,0 +1,60 @@
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 SSLTestCheckRate
36
+ FiveMinutes = 300
37
+ TenMinutes = 600
38
+ ThirtyMinutes = 1800
39
+ OneHour = 3600
40
+ OneDay = 86400
41
+ OneWeek = 2073600
42
+
43
+ # Builds the enum from string
44
+ # @param [String] The enum value in the form of the string
45
+ # @return [String] The enum value
46
+ def self.build_from_hash(value)
47
+ new.build_from_hash(value)
48
+ end
49
+
50
+ # Builds the enum from string
51
+ # @param [String] The enum value in the form of the string
52
+ # @return [String] The enum value
53
+ def build_from_hash(value)
54
+ values = SSLTestCheckRate.constants.select { |c| SSLTestCheckRate.const_get(c) == value }
55
+ raise "Invalid ENUM value #{value} for class #SSLTestCheckRate" if values.empty?
56
+ value
57
+ end
58
+ end
59
+
60
+ end