seatschart 0.2.0 → 0.3.0

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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +162 -15
  3. data/lib/seatschart/api/audit_api.rb +2 -2
  4. data/lib/seatschart/api/charts_api.rb +799 -66
  5. data/lib/seatschart/api/embed_api.rb +5 -5
  6. data/lib/seatschart/api/embed_origins_api.rb +63 -2
  7. data/lib/seatschart/api/event_log_api.rb +2 -2
  8. data/lib/seatschart/api/events_api.rb +1471 -155
  9. data/lib/seatschart/api/health_api.rb +244 -0
  10. data/lib/seatschart/api/map_designer_api.rb +11 -9
  11. data/lib/seatschart/api/public_api.rb +350 -0
  12. data/lib/seatschart/api/sandboxes_api.rb +672 -0
  13. data/lib/seatschart/api/seasons_api.rb +344 -36
  14. data/lib/seatschart/api/seats_api.rb +10 -10
  15. data/lib/seatschart/api/usage_api.rb +18 -15
  16. data/lib/seatschart/api/webhooks_api.rb +2 -2
  17. data/lib/seatschart/api/workspace_api.rb +306 -20
  18. data/lib/seatschart/models/api_error.rb +4 -4
  19. data/lib/seatschart/models/delete_api_sandboxes_by_sandbox_id200_response.rb +255 -0
  20. data/lib/seatschart/models/get_api_monitoring_requests200_response.rb +62 -4
  21. data/lib/seatschart/models/get_api_monitoring_requests200_response_points_inner.rb +21 -4
  22. data/lib/seatschart/models/get_api_sandboxes200_response.rb +239 -0
  23. data/lib/seatschart/models/get_api_sandboxes200_response_items_inner.rb +431 -0
  24. data/lib/seatschart/models/get_api_sandboxes200_response_items_inner_rate_limits.rb +270 -0
  25. data/lib/seatschart/models/get_api_sandboxes200_response_items_inner_usage.rb +287 -0
  26. data/lib/seatschart/models/get_api_status200_response.rb +387 -0
  27. data/lib/seatschart/models/get_api_status200_response_components_inner.rb +330 -0
  28. data/lib/seatschart/models/get_api_status200_response_components_inner_days_inner.rb +301 -0
  29. data/lib/seatschart/models/get_api_status200_response_incidents_inner.rb +374 -0
  30. data/lib/seatschart/models/get_api_status200_response_maintenance_inner.rb +350 -0
  31. data/lib/seatschart/models/get_api_status503_response.rb +271 -0
  32. data/lib/seatschart/models/get_api_workspace_buyer_extra_data200_response.rb +241 -0
  33. data/lib/seatschart/models/get_api_workspace_defaults200_response.rb +254 -0
  34. data/lib/seatschart/models/get_api_workspace_defaults200_response_renderer.rb +246 -0
  35. data/lib/seatschart/models/get_api_workspace_defaults200_response_renderer_built_in.rb +270 -0
  36. data/lib/seatschart/models/get_api_workspaces200_response_items_inner.rb +34 -5
  37. data/lib/seatschart/models/patch_api_events_by_event_id_request.rb +16 -6
  38. data/lib/seatschart/models/patch_api_seasons_by_season_id_request.rb +15 -5
  39. data/lib/seatschart/models/patch_api_workspace_chart_validation_request_severities.rb +25 -4
  40. data/lib/seatschart/models/patch_api_workspace_defaults_request.rb +224 -0
  41. data/lib/seatschart/models/patch_api_workspace_defaults_request_renderer.rb +249 -0
  42. data/lib/seatschart/models/patch_api_workspace_settings_request.rb +6 -6
  43. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_copy_to_workspace_request.rb +39 -1
  44. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_validate_request.rb +1 -0
  45. data/lib/seatschart/models/post_api_charts_by_chart_id_map_publish422_response_issues_inner.rb +64 -6
  46. data/lib/seatschart/models/post_api_charts_by_chart_id_map_publish_request.rb +1 -1
  47. data/lib/seatschart/models/post_api_embed_tokens_request.rb +18 -15
  48. data/lib/seatschart/models/post_api_embed_tokens_request_safe_mode_options.rb +226 -0
  49. data/lib/seatschart/models/post_api_events_actions_edit_for_sale_config_request.rb +251 -0
  50. data/lib/seatschart/models/post_api_events_actions_edit_for_sale_config_request_events_inner.rb +322 -0
  51. data/lib/seatschart/models/post_api_events_bulk_request_events_inner.rb +42 -1
  52. data/lib/seatschart/models/post_api_events_by_event_id_actions_edit_for_sale_config_request.rb +277 -0
  53. data/lib/seatschart/models/post_api_events_by_event_id_actions_edit_for_sale_config_request_for_sale_inner.rb +319 -0
  54. data/lib/seatschart/models/post_api_events_by_event_id_map_publish_request.rb +215 -0
  55. data/lib/seatschart/models/post_api_events_request.rb +42 -1
  56. data/lib/seatschart/models/{patch_api_events_by_event_id_request_categories_inner.rb → post_api_events_request_categories_inner.rb} +3 -3
  57. data/lib/seatschart/models/post_api_extract_seats200_response.rb +459 -0
  58. data/lib/seatschart/models/post_api_extract_seats200_response_seats_inner.rb +323 -0
  59. data/lib/seatschart/models/post_api_extract_seats200_response_suggested_inner.rb +320 -0
  60. data/lib/seatschart/models/post_api_extract_seats_request.rb +124 -4
  61. data/lib/seatschart/models/post_api_extract_seats_request_examples.rb +105 -0
  62. data/lib/seatschart/models/post_api_extract_seats_request_examples_any_of_inner.rb +293 -0
  63. data/lib/seatschart/models/post_api_extract_seats_request_negatives.rb +105 -0
  64. data/lib/seatschart/models/post_api_extract_seats_request_region.rb +105 -0
  65. data/lib/seatschart/models/post_api_extract_seats_request_region_any_of.rb +363 -0
  66. data/lib/seatschart/models/post_api_sandboxes201_response.rb +245 -0
  67. data/lib/seatschart/models/post_api_sandboxes201_response_admin_key.rb +286 -0
  68. data/lib/seatschart/models/post_api_sandboxes201_response_copied.rb +313 -0
  69. data/lib/seatschart/models/post_api_sandboxes201_response_copied_charts_inner.rb +281 -0
  70. data/lib/seatschart/models/post_api_sandboxes201_response_copied_events_inner.rb +281 -0
  71. data/lib/seatschart/models/post_api_sandboxes201_response_copied_events_with_own_map_inner.rb +265 -0
  72. data/lib/seatschart/models/post_api_sandboxes201_response_copied_key_conflicts_inner.rb +287 -0
  73. data/lib/seatschart/models/post_api_sandboxes201_response_copied_seasons_inner.rb +312 -0
  74. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_copy_from_production200_response.rb +313 -0
  75. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_copy_from_production_request.rb +255 -0
  76. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_join200_response.rb +271 -0
  77. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_reset200_response.rb +268 -0
  78. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_reset_request.rb +225 -0
  79. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_admin_key201_response.rb +253 -0
  80. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_admin_key201_response_api_key.rb +286 -0
  81. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_admin_key_request.rb +252 -0
  82. data/lib/seatschart/models/post_api_sandboxes_request.rb +319 -0
  83. data/lib/seatschart/models/post_api_seasons_request.rb +14 -4
  84. data/lib/seatschart/models/post_api_seats_confirm_request.rb +5 -5
  85. data/lib/seatschart/models/post_api_seats_release_request.rb +5 -5
  86. data/lib/seatschart/models/post_api_seats_reserve_request.rb +5 -5
  87. data/lib/seatschart/models/post_api_workspaces_request.rb +1 -1
  88. data/lib/seatschart/models/put_api_charts_by_chart_id_map_draft_request.rb +1 -0
  89. data/lib/seatschart/models/put_api_workspace_buyer_extra_data_request.rb +260 -0
  90. data/lib/seatschart/models/put_internal_status_notices_request.rb +242 -0
  91. data/lib/seatschart/models/put_internal_status_notices_request_notices_inner.rb +445 -0
  92. data/lib/seatschart/retry.rb +106 -7
  93. data/lib/seatschart/version.rb +1 -1
  94. data/lib/seatschart.rb +53 -2
  95. metadata +55 -4
  96. data/lib/seatschart/api/default_api.rb +0 -763
@@ -0,0 +1,323 @@
1
+ =begin
2
+ #SeatsChart API
3
+
4
+ #Seat inventory and locking API for B2B2C integrations. Authenticate using `x-api-key` (partners) or `Authorization: Bearer` with an HS256 JWT.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SeatsChart
17
+ class PostApiExtractSeats200ResponseSeatsInner
18
+ attr_accessor :x
19
+
20
+ attr_accessor :y
21
+
22
+ # How sure the scanner is that this is a seat (auto and examples modes).
23
+ attr_accessor :confidence
24
+
25
+ # Present (true) on seats to review before keeping them.
26
+ attr_accessor :doubtful
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'x' => :'x',
32
+ :'y' => :'y',
33
+ :'confidence' => :'confidence',
34
+ :'doubtful' => :'doubtful'
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'x' => :'Float',
47
+ :'y' => :'Float',
48
+ :'confidence' => :'Float',
49
+ :'doubtful' => :'Boolean'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PostApiExtractSeats200ResponseSeatsInner` initialize method"
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PostApiExtractSeats200ResponseSeatsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'x')
75
+ self.x = attributes[:'x']
76
+ else
77
+ self.x = nil
78
+ end
79
+
80
+ if attributes.key?(:'y')
81
+ self.y = attributes[:'y']
82
+ else
83
+ self.y = nil
84
+ end
85
+
86
+ if attributes.key?(:'confidence')
87
+ self.confidence = attributes[:'confidence']
88
+ end
89
+
90
+ if attributes.key?(:'doubtful')
91
+ self.doubtful = attributes[:'doubtful']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
99
+ invalid_properties = Array.new
100
+ if @x.nil?
101
+ invalid_properties.push('invalid value for "x", x cannot be nil.')
102
+ end
103
+
104
+ if @x < 0
105
+ invalid_properties.push('invalid value for "x", must be greater than or equal to 0.')
106
+ end
107
+
108
+ if @y.nil?
109
+ invalid_properties.push('invalid value for "y", y cannot be nil.')
110
+ end
111
+
112
+ if @y < 0
113
+ invalid_properties.push('invalid value for "y", must be greater than or equal to 0.')
114
+ end
115
+
116
+ if !@confidence.nil? && @confidence > 1
117
+ invalid_properties.push('invalid value for "confidence", must be smaller than or equal to 1.')
118
+ end
119
+
120
+ if !@confidence.nil? && @confidence < 0
121
+ invalid_properties.push('invalid value for "confidence", must be greater than or equal to 0.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ return false if @x.nil?
132
+ return false if @x < 0
133
+ return false if @y.nil?
134
+ return false if @y < 0
135
+ return false if !@confidence.nil? && @confidence > 1
136
+ return false if !@confidence.nil? && @confidence < 0
137
+ true
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] x Value to be assigned
142
+ def x=(x)
143
+ if x.nil?
144
+ fail ArgumentError, 'x cannot be nil'
145
+ end
146
+
147
+ if x < 0
148
+ fail ArgumentError, 'invalid value for "x", must be greater than or equal to 0.'
149
+ end
150
+
151
+ @x = x
152
+ end
153
+
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] y Value to be assigned
156
+ def y=(y)
157
+ if y.nil?
158
+ fail ArgumentError, 'y cannot be nil'
159
+ end
160
+
161
+ if y < 0
162
+ fail ArgumentError, 'invalid value for "y", must be greater than or equal to 0.'
163
+ end
164
+
165
+ @y = y
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] confidence Value to be assigned
170
+ def confidence=(confidence)
171
+ if confidence.nil?
172
+ fail ArgumentError, 'confidence cannot be nil'
173
+ end
174
+
175
+ if confidence > 1
176
+ fail ArgumentError, 'invalid value for "confidence", must be smaller than or equal to 1.'
177
+ end
178
+
179
+ if confidence < 0
180
+ fail ArgumentError, 'invalid value for "confidence", must be greater than or equal to 0.'
181
+ end
182
+
183
+ @confidence = confidence
184
+ end
185
+
186
+ # Checks equality by comparing each attribute.
187
+ # @param [Object] Object to be compared
188
+ def ==(o)
189
+ return true if self.equal?(o)
190
+ self.class == o.class &&
191
+ x == o.x &&
192
+ y == o.y &&
193
+ confidence == o.confidence &&
194
+ doubtful == o.doubtful
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [x, y, confidence, doubtful].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ return nil unless attributes.is_a?(Hash)
214
+ attributes = attributes.transform_keys(&:to_sym)
215
+ transformed_hash = {}
216
+ openapi_types.each_pair do |key, type|
217
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
218
+ transformed_hash["#{key}"] = nil
219
+ elsif type =~ /\AArray<(.*)>/i
220
+ # check to ensure the input is an array given that the attribute
221
+ # is documented as an array but the input is not
222
+ if attributes[attribute_map[key]].is_a?(Array)
223
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
224
+ end
225
+ elsif !attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
227
+ end
228
+ end
229
+ new(transformed_hash)
230
+ end
231
+
232
+ # Deserializes the data based on type
233
+ # @param string type Data type
234
+ # @param string value Value to be deserialized
235
+ # @return [Object] Deserialized data
236
+ def self._deserialize(type, value)
237
+ case type.to_sym
238
+ when :Time
239
+ Time.parse(value)
240
+ when :Date
241
+ Date.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :Boolean
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ # models (e.g. Pet) or oneOf
270
+ klass = SeatsChart.const_get(type)
271
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
272
+ end
273
+ end
274
+
275
+ # Returns the string representation of the object
276
+ # @return [String] String presentation of the object
277
+ def to_s
278
+ to_hash.to_s
279
+ end
280
+
281
+ # to_body is an alias to to_hash (backward compatibility)
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_body
284
+ to_hash
285
+ end
286
+
287
+ # Returns the object in the form of hash
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_hash
290
+ hash = {}
291
+ self.class.attribute_map.each_pair do |attr, param|
292
+ value = self.send(attr)
293
+ if value.nil?
294
+ is_nullable = self.class.openapi_nullable.include?(attr)
295
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
296
+ end
297
+
298
+ hash[param] = _to_hash(value)
299
+ end
300
+ hash
301
+ end
302
+
303
+ # Outputs non-array value in the form of hash
304
+ # For object, use to_hash. Otherwise, just return the value
305
+ # @param [Object] value Any valid value
306
+ # @return [Hash] Returns the value in the form of hash
307
+ def _to_hash(value)
308
+ if value.is_a?(Array)
309
+ value.compact.map { |v| _to_hash(v) }
310
+ elsif value.is_a?(Hash)
311
+ {}.tap do |hash|
312
+ value.each { |k, v| hash[k] = _to_hash(v) }
313
+ end
314
+ elsif value.respond_to? :to_hash
315
+ value.to_hash
316
+ else
317
+ value
318
+ end
319
+ end
320
+
321
+ end
322
+
323
+ end
@@ -0,0 +1,320 @@
1
+ =begin
2
+ #SeatsChart API
3
+
4
+ #Seat inventory and locking API for B2B2C integrations. Authenticate using `x-api-key` (partners) or `Authorization: Bearer` with an HS256 JWT.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module SeatsChart
17
+ class PostApiExtractSeats200ResponseSuggestedInner
18
+ attr_accessor :x
19
+
20
+ attr_accessor :y
21
+
22
+ # How likely a seat is there.
23
+ attr_accessor :confidence
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'x' => :'x',
29
+ :'y' => :'y',
30
+ :'confidence' => :'confidence'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'x' => :'Float',
43
+ :'y' => :'Float',
44
+ :'confidence' => :'Float'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PostApiExtractSeats200ResponseSuggestedInner` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PostApiExtractSeats200ResponseSuggestedInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'x')
70
+ self.x = attributes[:'x']
71
+ else
72
+ self.x = nil
73
+ end
74
+
75
+ if attributes.key?(:'y')
76
+ self.y = attributes[:'y']
77
+ else
78
+ self.y = nil
79
+ end
80
+
81
+ if attributes.key?(:'confidence')
82
+ self.confidence = attributes[:'confidence']
83
+ else
84
+ self.confidence = nil
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
+ invalid_properties = Array.new
93
+ if @x.nil?
94
+ invalid_properties.push('invalid value for "x", x cannot be nil.')
95
+ end
96
+
97
+ if @x < 0
98
+ invalid_properties.push('invalid value for "x", must be greater than or equal to 0.')
99
+ end
100
+
101
+ if @y.nil?
102
+ invalid_properties.push('invalid value for "y", y cannot be nil.')
103
+ end
104
+
105
+ if @y < 0
106
+ invalid_properties.push('invalid value for "y", must be greater than or equal to 0.')
107
+ end
108
+
109
+ if @confidence.nil?
110
+ invalid_properties.push('invalid value for "confidence", confidence cannot be nil.')
111
+ end
112
+
113
+ if @confidence > 1
114
+ invalid_properties.push('invalid value for "confidence", must be smaller than or equal to 1.')
115
+ end
116
+
117
+ if @confidence < 0
118
+ invalid_properties.push('invalid value for "confidence", must be greater than or equal to 0.')
119
+ end
120
+
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ warn '[DEPRECATED] the `valid?` method is obsolete'
128
+ return false if @x.nil?
129
+ return false if @x < 0
130
+ return false if @y.nil?
131
+ return false if @y < 0
132
+ return false if @confidence.nil?
133
+ return false if @confidence > 1
134
+ return false if @confidence < 0
135
+ true
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] x Value to be assigned
140
+ def x=(x)
141
+ if x.nil?
142
+ fail ArgumentError, 'x cannot be nil'
143
+ end
144
+
145
+ if x < 0
146
+ fail ArgumentError, 'invalid value for "x", must be greater than or equal to 0.'
147
+ end
148
+
149
+ @x = x
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] y Value to be assigned
154
+ def y=(y)
155
+ if y.nil?
156
+ fail ArgumentError, 'y cannot be nil'
157
+ end
158
+
159
+ if y < 0
160
+ fail ArgumentError, 'invalid value for "y", must be greater than or equal to 0.'
161
+ end
162
+
163
+ @y = y
164
+ end
165
+
166
+ # Custom attribute writer method with validation
167
+ # @param [Object] confidence Value to be assigned
168
+ def confidence=(confidence)
169
+ if confidence.nil?
170
+ fail ArgumentError, 'confidence cannot be nil'
171
+ end
172
+
173
+ if confidence > 1
174
+ fail ArgumentError, 'invalid value for "confidence", must be smaller than or equal to 1.'
175
+ end
176
+
177
+ if confidence < 0
178
+ fail ArgumentError, 'invalid value for "confidence", must be greater than or equal to 0.'
179
+ end
180
+
181
+ @confidence = confidence
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ x == o.x &&
190
+ y == o.y &&
191
+ confidence == o.confidence
192
+ end
193
+
194
+ # @see the `==` method
195
+ # @param [Object] Object to be compared
196
+ def eql?(o)
197
+ self == o
198
+ end
199
+
200
+ # Calculates hash code according to all attributes.
201
+ # @return [Integer] Hash code
202
+ def hash
203
+ [x, y, confidence].hash
204
+ end
205
+
206
+ # Builds the object from hash
207
+ # @param [Hash] attributes Model attributes in the form of hash
208
+ # @return [Object] Returns the model itself
209
+ def self.build_from_hash(attributes)
210
+ return nil unless attributes.is_a?(Hash)
211
+ attributes = attributes.transform_keys(&:to_sym)
212
+ transformed_hash = {}
213
+ openapi_types.each_pair do |key, type|
214
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
215
+ transformed_hash["#{key}"] = nil
216
+ elsif type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[attribute_map[key]].is_a?(Array)
220
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
221
+ end
222
+ elsif !attributes[attribute_map[key]].nil?
223
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
224
+ end
225
+ end
226
+ new(transformed_hash)
227
+ end
228
+
229
+ # Deserializes the data based on type
230
+ # @param string type Data type
231
+ # @param string value Value to be deserialized
232
+ # @return [Object] Deserialized data
233
+ def self._deserialize(type, value)
234
+ case type.to_sym
235
+ when :Time
236
+ Time.parse(value)
237
+ when :Date
238
+ Date.parse(value)
239
+ when :String
240
+ value.to_s
241
+ when :Integer
242
+ value.to_i
243
+ when :Float
244
+ value.to_f
245
+ when :Boolean
246
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
247
+ true
248
+ else
249
+ false
250
+ end
251
+ when :Object
252
+ # generic object (usually a Hash), return directly
253
+ value
254
+ when /\AArray<(?<inner_type>.+)>\z/
255
+ inner_type = Regexp.last_match[:inner_type]
256
+ value.map { |v| _deserialize(inner_type, v) }
257
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
258
+ k_type = Regexp.last_match[:k_type]
259
+ v_type = Regexp.last_match[:v_type]
260
+ {}.tap do |hash|
261
+ value.each do |k, v|
262
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
263
+ end
264
+ end
265
+ else # model
266
+ # models (e.g. Pet) or oneOf
267
+ klass = SeatsChart.const_get(type)
268
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
269
+ end
270
+ end
271
+
272
+ # Returns the string representation of the object
273
+ # @return [String] String presentation of the object
274
+ def to_s
275
+ to_hash.to_s
276
+ end
277
+
278
+ # to_body is an alias to to_hash (backward compatibility)
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_body
281
+ to_hash
282
+ end
283
+
284
+ # Returns the object in the form of hash
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_hash
287
+ hash = {}
288
+ self.class.attribute_map.each_pair do |attr, param|
289
+ value = self.send(attr)
290
+ if value.nil?
291
+ is_nullable = self.class.openapi_nullable.include?(attr)
292
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
293
+ end
294
+
295
+ hash[param] = _to_hash(value)
296
+ end
297
+ hash
298
+ end
299
+
300
+ # Outputs non-array value in the form of hash
301
+ # For object, use to_hash. Otherwise, just return the value
302
+ # @param [Object] value Any valid value
303
+ # @return [Hash] Returns the value in the form of hash
304
+ def _to_hash(value)
305
+ if value.is_a?(Array)
306
+ value.compact.map { |v| _to_hash(v) }
307
+ elsif value.is_a?(Hash)
308
+ {}.tap do |hash|
309
+ value.each { |k, v| hash[k] = _to_hash(v) }
310
+ end
311
+ elsif value.respond_to? :to_hash
312
+ value.to_hash
313
+ else
314
+ value
315
+ end
316
+ end
317
+
318
+ end
319
+
320
+ end