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,258 @@
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 ContactGroups
36
+ # List of contact groups
37
+ attr_accessor :data
38
+
39
+ attr_accessor :metadata
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'data' => :'data',
45
+ :'metadata' => :'metadata',
46
+ }
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'data' => :'Array<ContactGroup>',
58
+ :'metadata' => :'Pagination',
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ unless attributes.is_a?(Hash)
71
+ raise ArgumentError, "The input argument (attributes) must be a hash in `StatusCake::ContactGroups` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ unless self.class.attribute_map.key?(k.to_sym)
77
+ raise ArgumentError, "`#{k}` is not a valid attribute in `StatusCake::ContactGroups`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'data')
83
+ if (value = attributes[:'data']).is_a?(Array)
84
+ self.data = value
85
+ end
86
+ end
87
+
88
+ if attributes.key?(:'metadata')
89
+ self.metadata = attributes[:'metadata']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = []
97
+ if @data.nil?
98
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
99
+ end
100
+
101
+ if @metadata.nil?
102
+ invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
103
+ end
104
+
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ return false if @data.nil?
112
+ return false if @metadata.nil?
113
+ true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(other)
119
+ return true if equal?(other)
120
+ self.class == other.class &&
121
+ data == other.data &&
122
+ metadata == other.metadata
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(other)
128
+ self == other
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Integer] Hash code
133
+ def hash
134
+ [data, metadata].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ new.build_from_hash(attributes)
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ attributes = attributes.transform_keys(&:to_sym)
150
+ self.class.openapi_types.each_pair do |key, type|
151
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
152
+ send("#{key}=", nil)
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
157
+ send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(Regexp.last_match(1), v) })
158
+ end
159
+ elsif !attributes[self.class.attribute_map[key]].nil?
160
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
+ end
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :Time
174
+ Time.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :Boolean
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ # models (e.g. Pet) or oneOf
205
+ klass = StatusCake.const_get(type)
206
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
207
+ end
208
+ end
209
+
210
+ # Returns the string representation of the object
211
+ # @return [String] String presentation of the object
212
+ def to_s
213
+ to_hash.to_s
214
+ end
215
+
216
+ # to_body is an alias to to_hash (backward compatibility)
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_body
219
+ to_hash
220
+ end
221
+
222
+ # Returns the object in the form of hash
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_hash
225
+ hash = {}
226
+ self.class.attribute_map.each_pair do |attr, param|
227
+ value = send(attr)
228
+ if value.nil?
229
+ is_nullable = self.class.openapi_nullable.include?(attr)
230
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
231
+ end
232
+
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Outputs non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ # @param [Object] value Any valid value
241
+ # @return [Hash] Returns the value in the form of hash
242
+ def _to_hash(value)
243
+ if value.is_a?(Array)
244
+ value.compact.map { |v| _to_hash(v) }
245
+ elsif value.is_a?(Hash)
246
+ {}.tap do |hash|
247
+ value.each { |k, v| hash[k] = _to_hash(v) }
248
+ end
249
+ elsif value.respond_to? :to_hash
250
+ value.to_hash
251
+ else
252
+ value
253
+ end
254
+ end
255
+
256
+ end
257
+
258
+ end
@@ -0,0 +1,242 @@
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 Links
36
+ # The URL that created the current response document
37
+ attr_accessor :_self
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'_self' => :'self',
43
+ }
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'_self' => :'String',
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ unless attributes.is_a?(Hash)
67
+ raise ArgumentError, "The input argument (attributes) must be a hash in `StatusCake::Links` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ unless self.class.attribute_map.key?(k.to_sym)
73
+ raise ArgumentError, "`#{k}` is not a valid attribute in `StatusCake::Links`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'_self')
79
+ self._self = attributes[:'_self']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = []
87
+ if @_self.nil?
88
+ invalid_properties.push('invalid value for "_self", _self cannot be nil.')
89
+ end
90
+
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if @_self.nil?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(other)
104
+ return true if equal?(other)
105
+ self.class == other.class &&
106
+ _self == other._self
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(other)
112
+ self == other
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Integer] Hash code
117
+ def hash
118
+ [_self].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def self.build_from_hash(attributes)
125
+ new.build_from_hash(attributes)
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ attributes = attributes.transform_keys(&:to_sym)
134
+ self.class.openapi_types.each_pair do |key, type|
135
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
136
+ send("#{key}=", nil)
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(Regexp.last_match(1), v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :Time
158
+ Time.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ # models (e.g. Pet) or oneOf
189
+ klass = StatusCake.const_get(type)
190
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = send(attr)
212
+ if value.nil?
213
+ is_nullable = self.class.openapi_nullable.include?(attr)
214
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
+ end
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+
242
+ end