seatschart 0.1.1 → 0.2.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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -3
  3. data/lib/seatschart/api/charts_api.rb +9 -9
  4. data/lib/seatschart/api/embed_api.rb +13 -2
  5. data/lib/seatschart/api/event_log_api.rb +2 -2
  6. data/lib/seatschart/api/events_api.rb +186 -20
  7. data/lib/seatschart/api/listings_api.rb +884 -0
  8. data/lib/seatschart/api/object_status_api.rb +2 -2
  9. data/lib/seatschart/api/seasons_api.rb +113 -8
  10. data/lib/seatschart/api/seats_api.rb +3 -22
  11. data/lib/seatschart/api/usage_api.rb +4 -4
  12. data/lib/seatschart/api/webhooks_api.rb +2 -2
  13. data/lib/seatschart/api/workspace_api.rb +4 -4
  14. data/lib/seatschart/models/api_error.rb +307 -0
  15. data/lib/seatschart/models/api_error_params_value.rb +105 -0
  16. data/lib/seatschart/models/get_api_monitoring_requests200_response.rb +17 -1
  17. data/lib/seatschart/models/get_api_monitoring_requests200_response_concurrency.rb +318 -0
  18. data/lib/seatschart/models/get_api_monitoring_requests200_response_concurrency_api_keys_inner.rb +297 -0
  19. data/lib/seatschart/models/get_api_monitoring_requests200_response_points_inner.rb +21 -4
  20. data/lib/seatschart/models/get_api_workspace_settings200_response_effective.rb +20 -4
  21. data/lib/seatschart/models/get_api_workspace_settings200_response_overrides.rb +13 -4
  22. data/lib/seatschart/models/get_api_workspace_settings200_response_sources.rb +32 -4
  23. data/lib/seatschart/models/patch_api_events_by_event_id_listings_by_listing_id_request.rb +379 -0
  24. data/lib/seatschart/models/patch_api_listing_types_by_key_request.rb +376 -0
  25. data/lib/seatschart/models/patch_api_seasons_by_season_id_partial_seasons_by_partial_season_id_request.rb +268 -0
  26. data/lib/seatschart/models/patch_api_seasons_by_season_id_request.rb +27 -1
  27. data/lib/seatschart/models/patch_api_webhooks_by_id_request.rb +1 -1
  28. data/lib/seatschart/models/patch_api_workspace_settings_request.rb +12 -1
  29. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_validate_request_seats_inner_accessibility.rb +6 -6
  30. data/lib/seatschart/models/post_api_events_actions_change_object_status_request_status_changes_inner.rb +0 -11
  31. data/lib/seatschart/models/post_api_events_by_event_id_actions_change_object_status_request.rb +13 -26
  32. data/lib/seatschart/models/post_api_events_by_event_id_actions_change_object_status_request_listing.rb +392 -0
  33. data/lib/seatschart/models/post_api_events_by_event_id_actions_mark_everything_as_not_for_sale_request.rb +215 -0
  34. data/lib/seatschart/models/post_api_events_by_event_id_listings_by_listing_id_actions_mark_sold_request.rb +243 -0
  35. data/lib/seatschart/models/post_api_events_by_event_id_listings_request.rb +435 -0
  36. data/lib/seatschart/models/post_api_events_by_event_id_listings_request_objects_inner.rb +104 -0
  37. data/lib/seatschart/models/post_api_events_by_event_id_listings_request_objects_inner_any_of.rb +325 -0
  38. data/lib/seatschart/models/post_api_ga_confirm_request.rb +0 -44
  39. data/lib/seatschart/models/post_api_ga_release_request.rb +0 -11
  40. data/lib/seatschart/models/post_api_ga_reserve_request.rb +0 -33
  41. data/lib/seatschart/models/post_api_hold_tokens_request.rb +0 -22
  42. data/lib/seatschart/models/post_api_listing_types_request.rb +439 -0
  43. data/lib/seatschart/models/post_api_quotes_request.rb +0 -22
  44. data/lib/seatschart/models/post_api_seasons_by_season_id_partial_seasons_request.rb +27 -1
  45. data/lib/seatschart/models/post_api_seasons_request.rb +27 -1
  46. data/lib/seatschart/models/post_api_seats_best_available_request.rb +0 -11
  47. data/lib/seatschart/models/post_api_seats_confirm_request.rb +0 -44
  48. data/lib/seatschart/models/post_api_seats_release_request.rb +0 -11
  49. data/lib/seatschart/models/post_api_seats_reserve_request.rb +0 -22
  50. data/lib/seatschart/models/post_api_viewer_tokens_request.rb +0 -11
  51. data/lib/seatschart/models/post_api_webhooks_request.rb +1 -1
  52. data/lib/seatschart/models/put_api_charts_by_chart_id_map_draft_request.rb +348 -0
  53. data/lib/seatschart/version.rb +1 -1
  54. data/lib/seatschart.rb +16 -0
  55. metadata +17 -1
@@ -0,0 +1,392 @@
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
+ # put-up-for-resale only: also creates a server-side listing of these objects (GET /events/{eventId}/listings). Checked before the status change (409 `listing_object_conflict`, `listing_key_taken`); the response carries `listing`.
18
+ class PostApiEventsByEventIdActionsChangeObjectStatusRequestListing
19
+ # Listing key (default: `resaleListingId`, else a generated UUID).
20
+ attr_accessor :key
21
+
22
+ # Listing type key; omitted = untyped (resale).
23
+ attr_accessor :type
24
+
25
+ # Default true: the objects are held and sold together.
26
+ attr_accessor :sell_as_whole
27
+
28
+ # Price per object (default: `resalePriceCents`).
29
+ attr_accessor :price_cents
30
+
31
+ attr_accessor :total_price_cents
32
+
33
+ attr_accessor :partner_metadata
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'key' => :'key',
39
+ :'type' => :'type',
40
+ :'sell_as_whole' => :'sellAsWhole',
41
+ :'price_cents' => :'priceCents',
42
+ :'total_price_cents' => :'totalPriceCents',
43
+ :'partner_metadata' => :'partnerMetadata'
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'key' => :'String',
56
+ :'type' => :'String',
57
+ :'sell_as_whole' => :'Boolean',
58
+ :'price_cents' => :'Integer',
59
+ :'total_price_cents' => :'Integer',
60
+ :'partner_metadata' => :'Hash<String, Object>'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ :'type',
68
+ :'price_cents',
69
+ :'total_price_cents',
70
+ :'partner_metadata'
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PostApiEventsByEventIdActionsChangeObjectStatusRequestListing` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!self.class.attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PostApiEventsByEventIdActionsChangeObjectStatusRequestListing`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'key')
90
+ self.key = attributes[:'key']
91
+ end
92
+
93
+ if attributes.key?(:'type')
94
+ self.type = attributes[:'type']
95
+ end
96
+
97
+ if attributes.key?(:'sell_as_whole')
98
+ self.sell_as_whole = attributes[:'sell_as_whole']
99
+ end
100
+
101
+ if attributes.key?(:'price_cents')
102
+ self.price_cents = attributes[:'price_cents']
103
+ end
104
+
105
+ if attributes.key?(:'total_price_cents')
106
+ self.total_price_cents = attributes[:'total_price_cents']
107
+ end
108
+
109
+ if attributes.key?(:'partner_metadata')
110
+ if (value = attributes[:'partner_metadata']).is_a?(Hash)
111
+ self.partner_metadata = value
112
+ end
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ if !@key.nil? && @key.to_s.length > 64
122
+ invalid_properties.push('invalid value for "key", the character length must be smaller than or equal to 64.')
123
+ end
124
+
125
+ if !@key.nil? && @key.to_s.length < 1
126
+ invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.')
127
+ end
128
+
129
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
130
+ if !@key.nil? && @key !~ pattern
131
+ invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
132
+ end
133
+
134
+ if !@type.nil? && @type.to_s.length > 64
135
+ invalid_properties.push('invalid value for "type", the character length must be smaller than or equal to 64.')
136
+ end
137
+
138
+ if !@type.nil? && @type.to_s.length < 1
139
+ invalid_properties.push('invalid value for "type", the character length must be great than or equal to 1.')
140
+ end
141
+
142
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
143
+ if !@type.nil? && @type !~ pattern
144
+ invalid_properties.push("invalid value for \"type\", must conform to the pattern #{pattern}.")
145
+ end
146
+
147
+ if !@price_cents.nil? && @price_cents > 99999999
148
+ invalid_properties.push('invalid value for "price_cents", must be smaller than or equal to 99999999.')
149
+ end
150
+
151
+ if !@price_cents.nil? && @price_cents < 0
152
+ invalid_properties.push('invalid value for "price_cents", must be greater than or equal to 0.')
153
+ end
154
+
155
+ if !@total_price_cents.nil? && @total_price_cents > 99999999
156
+ invalid_properties.push('invalid value for "total_price_cents", must be smaller than or equal to 99999999.')
157
+ end
158
+
159
+ if !@total_price_cents.nil? && @total_price_cents < 0
160
+ invalid_properties.push('invalid value for "total_price_cents", must be greater than or equal to 0.')
161
+ end
162
+
163
+ invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ warn '[DEPRECATED] the `valid?` method is obsolete'
170
+ return false if !@key.nil? && @key.to_s.length > 64
171
+ return false if !@key.nil? && @key.to_s.length < 1
172
+ return false if !@key.nil? && @key !~ Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
173
+ return false if !@type.nil? && @type.to_s.length > 64
174
+ return false if !@type.nil? && @type.to_s.length < 1
175
+ return false if !@type.nil? && @type !~ Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
176
+ return false if !@price_cents.nil? && @price_cents > 99999999
177
+ return false if !@price_cents.nil? && @price_cents < 0
178
+ return false if !@total_price_cents.nil? && @total_price_cents > 99999999
179
+ return false if !@total_price_cents.nil? && @total_price_cents < 0
180
+ true
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] key Value to be assigned
185
+ def key=(key)
186
+ if key.nil?
187
+ fail ArgumentError, 'key cannot be nil'
188
+ end
189
+
190
+ if key.to_s.length > 64
191
+ fail ArgumentError, 'invalid value for "key", the character length must be smaller than or equal to 64.'
192
+ end
193
+
194
+ if key.to_s.length < 1
195
+ fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.'
196
+ end
197
+
198
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
199
+ if key !~ pattern
200
+ fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
201
+ end
202
+
203
+ @key = key
204
+ end
205
+
206
+ # Custom attribute writer method with validation
207
+ # @param [Object] type Value to be assigned
208
+ def type=(type)
209
+ if !type.nil? && type.to_s.length > 64
210
+ fail ArgumentError, 'invalid value for "type", the character length must be smaller than or equal to 64.'
211
+ end
212
+
213
+ if !type.nil? && type.to_s.length < 1
214
+ fail ArgumentError, 'invalid value for "type", the character length must be great than or equal to 1.'
215
+ end
216
+
217
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
218
+ if !type.nil? && type !~ pattern
219
+ fail ArgumentError, "invalid value for \"type\", must conform to the pattern #{pattern}."
220
+ end
221
+
222
+ @type = type
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] price_cents Value to be assigned
227
+ def price_cents=(price_cents)
228
+ if !price_cents.nil? && price_cents > 99999999
229
+ fail ArgumentError, 'invalid value for "price_cents", must be smaller than or equal to 99999999.'
230
+ end
231
+
232
+ if !price_cents.nil? && price_cents < 0
233
+ fail ArgumentError, 'invalid value for "price_cents", must be greater than or equal to 0.'
234
+ end
235
+
236
+ @price_cents = price_cents
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] total_price_cents Value to be assigned
241
+ def total_price_cents=(total_price_cents)
242
+ if !total_price_cents.nil? && total_price_cents > 99999999
243
+ fail ArgumentError, 'invalid value for "total_price_cents", must be smaller than or equal to 99999999.'
244
+ end
245
+
246
+ if !total_price_cents.nil? && total_price_cents < 0
247
+ fail ArgumentError, 'invalid value for "total_price_cents", must be greater than or equal to 0.'
248
+ end
249
+
250
+ @total_price_cents = total_price_cents
251
+ end
252
+
253
+ # Checks equality by comparing each attribute.
254
+ # @param [Object] Object to be compared
255
+ def ==(o)
256
+ return true if self.equal?(o)
257
+ self.class == o.class &&
258
+ key == o.key &&
259
+ type == o.type &&
260
+ sell_as_whole == o.sell_as_whole &&
261
+ price_cents == o.price_cents &&
262
+ total_price_cents == o.total_price_cents &&
263
+ partner_metadata == o.partner_metadata
264
+ end
265
+
266
+ # @see the `==` method
267
+ # @param [Object] Object to be compared
268
+ def eql?(o)
269
+ self == o
270
+ end
271
+
272
+ # Calculates hash code according to all attributes.
273
+ # @return [Integer] Hash code
274
+ def hash
275
+ [key, type, sell_as_whole, price_cents, total_price_cents, partner_metadata].hash
276
+ end
277
+
278
+ # Builds the object from hash
279
+ # @param [Hash] attributes Model attributes in the form of hash
280
+ # @return [Object] Returns the model itself
281
+ def self.build_from_hash(attributes)
282
+ return nil unless attributes.is_a?(Hash)
283
+ attributes = attributes.transform_keys(&:to_sym)
284
+ transformed_hash = {}
285
+ openapi_types.each_pair do |key, type|
286
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
287
+ transformed_hash["#{key}"] = nil
288
+ elsif type =~ /\AArray<(.*)>/i
289
+ # check to ensure the input is an array given that the attribute
290
+ # is documented as an array but the input is not
291
+ if attributes[attribute_map[key]].is_a?(Array)
292
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
293
+ end
294
+ elsif !attributes[attribute_map[key]].nil?
295
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
296
+ end
297
+ end
298
+ new(transformed_hash)
299
+ end
300
+
301
+ # Deserializes the data based on type
302
+ # @param string type Data type
303
+ # @param string value Value to be deserialized
304
+ # @return [Object] Deserialized data
305
+ def self._deserialize(type, value)
306
+ case type.to_sym
307
+ when :Time
308
+ Time.parse(value)
309
+ when :Date
310
+ Date.parse(value)
311
+ when :String
312
+ value.to_s
313
+ when :Integer
314
+ value.to_i
315
+ when :Float
316
+ value.to_f
317
+ when :Boolean
318
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
319
+ true
320
+ else
321
+ false
322
+ end
323
+ when :Object
324
+ # generic object (usually a Hash), return directly
325
+ value
326
+ when /\AArray<(?<inner_type>.+)>\z/
327
+ inner_type = Regexp.last_match[:inner_type]
328
+ value.map { |v| _deserialize(inner_type, v) }
329
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
330
+ k_type = Regexp.last_match[:k_type]
331
+ v_type = Regexp.last_match[:v_type]
332
+ {}.tap do |hash|
333
+ value.each do |k, v|
334
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
335
+ end
336
+ end
337
+ else # model
338
+ # models (e.g. Pet) or oneOf
339
+ klass = SeatsChart.const_get(type)
340
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
341
+ end
342
+ end
343
+
344
+ # Returns the string representation of the object
345
+ # @return [String] String presentation of the object
346
+ def to_s
347
+ to_hash.to_s
348
+ end
349
+
350
+ # to_body is an alias to to_hash (backward compatibility)
351
+ # @return [Hash] Returns the object in the form of hash
352
+ def to_body
353
+ to_hash
354
+ end
355
+
356
+ # Returns the object in the form of hash
357
+ # @return [Hash] Returns the object in the form of hash
358
+ def to_hash
359
+ hash = {}
360
+ self.class.attribute_map.each_pair do |attr, param|
361
+ value = self.send(attr)
362
+ if value.nil?
363
+ is_nullable = self.class.openapi_nullable.include?(attr)
364
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
365
+ end
366
+
367
+ hash[param] = _to_hash(value)
368
+ end
369
+ hash
370
+ end
371
+
372
+ # Outputs non-array value in the form of hash
373
+ # For object, use to_hash. Otherwise, just return the value
374
+ # @param [Object] value Any valid value
375
+ # @return [Hash] Returns the value in the form of hash
376
+ def _to_hash(value)
377
+ if value.is_a?(Array)
378
+ value.compact.map { |v| _to_hash(v) }
379
+ elsif value.is_a?(Hash)
380
+ {}.tap do |hash|
381
+ value.each { |k, v| hash[k] = _to_hash(v) }
382
+ end
383
+ elsif value.respond_to? :to_hash
384
+ value.to_hash
385
+ else
386
+ value
387
+ end
388
+ end
389
+
390
+ end
391
+
392
+ end
@@ -0,0 +1,215 @@
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 PostApiEventsByEventIdActionsMarkEverythingAsNotForSaleRequest
18
+ # Sync live season siblings when this event is the season source (default false).
19
+ attr_accessor :cascade_season
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'cascade_season' => :'cascadeSeason'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'cascade_season' => :'Boolean'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PostApiEventsByEventIdActionsMarkEverythingAsNotForSaleRequest` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PostApiEventsByEventIdActionsMarkEverythingAsNotForSaleRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'cascade_season')
62
+ self.cascade_season = attributes[:'cascade_season']
63
+ end
64
+ end
65
+
66
+ # Show invalid properties with the reasons. Usually used together with valid?
67
+ # @return Array for valid properties with the reasons
68
+ def list_invalid_properties
69
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ warn '[DEPRECATED] the `valid?` method is obsolete'
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ cascade_season == o.cascade_season
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [cascade_season].hash
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def self.build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ attributes = attributes.transform_keys(&:to_sym)
107
+ transformed_hash = {}
108
+ openapi_types.each_pair do |key, type|
109
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
110
+ transformed_hash["#{key}"] = nil
111
+ elsif type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[attribute_map[key]].is_a?(Array)
115
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
116
+ end
117
+ elsif !attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
119
+ end
120
+ end
121
+ new(transformed_hash)
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def self._deserialize(type, value)
129
+ case type.to_sym
130
+ when :Time
131
+ Time.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ # models (e.g. Pet) or oneOf
162
+ klass = SeatsChart.const_get(type)
163
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ if value.nil?
186
+ is_nullable = self.class.openapi_nullable.include?(attr)
187
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
+ end
189
+
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+
213
+ end
214
+
215
+ end