seatschart 0.2.0 → 0.4.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 (117) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +199 -19
  3. data/lib/seatschart/api/audit_api.rb +2 -2
  4. data/lib/seatschart/api/auth_api.rb +81 -4
  5. data/lib/seatschart/api/billing_api.rb +4 -0
  6. data/lib/seatschart/api/charts_api.rb +810 -77
  7. data/lib/seatschart/api/embed_api.rb +5 -5
  8. data/lib/seatschart/api/embed_origins_api.rb +63 -2
  9. data/lib/seatschart/api/event_log_api.rb +2 -2
  10. data/lib/seatschart/api/events_api.rb +1491 -175
  11. data/lib/seatschart/api/health_api.rb +244 -0
  12. data/lib/seatschart/api/map_designer_api.rb +11 -9
  13. data/lib/seatschart/api/public_api.rb +356 -6
  14. data/lib/seatschart/api/sandboxes_api.rb +672 -0
  15. data/lib/seatschart/api/seasons_api.rb +344 -36
  16. data/lib/seatschart/api/seats_api.rb +10 -10
  17. data/lib/seatschart/api/usage_api.rb +18 -15
  18. data/lib/seatschart/api/webhooks_api.rb +2 -2
  19. data/lib/seatschart/api/workspace_api.rb +1815 -363
  20. data/lib/seatschart/models/api_error.rb +4 -4
  21. data/lib/seatschart/models/delete_api_sandboxes_by_sandbox_id200_response.rb +255 -0
  22. data/lib/seatschart/models/delete_api_workspaces_by_workspace_id_keys_by_key_id200_response.rb +237 -0
  23. data/lib/seatschart/models/get_api_monitoring_requests200_response.rb +62 -4
  24. data/lib/seatschart/models/get_api_monitoring_requests200_response_points_inner.rb +21 -4
  25. data/lib/seatschart/models/get_api_sandboxes200_response.rb +239 -0
  26. data/lib/seatschart/models/get_api_sandboxes200_response_items_inner.rb +431 -0
  27. data/lib/seatschart/models/get_api_sandboxes200_response_items_inner_rate_limits.rb +270 -0
  28. data/lib/seatschart/models/get_api_sandboxes200_response_items_inner_usage.rb +287 -0
  29. data/lib/seatschart/models/get_api_status200_response.rb +387 -0
  30. data/lib/seatschart/models/get_api_status200_response_components_inner.rb +330 -0
  31. data/lib/seatschart/models/get_api_status200_response_components_inner_days_inner.rb +301 -0
  32. data/lib/seatschart/models/get_api_status200_response_incidents_inner.rb +374 -0
  33. data/lib/seatschart/models/get_api_status200_response_maintenance_inner.rb +350 -0
  34. data/lib/seatschart/models/get_api_status503_response.rb +271 -0
  35. data/lib/seatschart/models/get_api_workspace_buyer_extra_data200_response.rb +241 -0
  36. data/lib/seatschart/models/get_api_workspace_defaults200_response.rb +254 -0
  37. data/lib/seatschart/models/get_api_workspace_defaults200_response_renderer.rb +246 -0
  38. data/lib/seatschart/models/get_api_workspace_defaults200_response_renderer_built_in.rb +270 -0
  39. data/lib/seatschart/models/get_api_workspaces200_response_items_inner.rb +80 -5
  40. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_keys200_response.rb +239 -0
  41. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_keys200_response_api_keys_inner.rb +321 -0
  42. data/lib/seatschart/models/get_api_workspaces_created_by_api_parameter.rb +103 -0
  43. data/lib/seatschart/models/get_api_workspaces_overview_created_by_api_parameter.rb +103 -0
  44. data/lib/seatschart/models/patch_api_events_by_event_id_request.rb +12 -2
  45. data/lib/seatschart/models/patch_api_seasons_by_season_id_request.rb +15 -5
  46. data/lib/seatschart/models/patch_api_workspace_chart_validation_request_severities.rb +25 -4
  47. data/lib/seatschart/models/patch_api_workspace_defaults_request.rb +224 -0
  48. data/lib/seatschart/models/patch_api_workspace_defaults_request_renderer.rb +249 -0
  49. data/lib/seatschart/models/patch_api_workspace_settings_request.rb +6 -6
  50. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_keys_by_key_id200_response.rb +221 -0
  51. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_keys_by_key_id_request.rb +292 -0
  52. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_request.rb +288 -0
  53. data/lib/seatschart/models/post_api_auth_new_workspace_request.rb +294 -0
  54. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_copy_to_workspace_request.rb +39 -1
  55. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_validate_request.rb +1 -0
  56. data/lib/seatschart/models/post_api_charts_by_chart_id_map_publish422_response_issues_inner.rb +64 -6
  57. data/lib/seatschart/models/post_api_charts_by_chart_id_map_publish_request.rb +1 -1
  58. data/lib/seatschart/models/post_api_embed_tokens_request.rb +18 -15
  59. data/lib/seatschart/models/post_api_embed_tokens_request_safe_mode_options.rb +226 -0
  60. data/lib/seatschart/models/post_api_events_actions_edit_for_sale_config_request.rb +251 -0
  61. data/lib/seatschart/models/post_api_events_actions_edit_for_sale_config_request_events_inner.rb +322 -0
  62. data/lib/seatschart/models/post_api_events_bulk_request_events_inner.rb +42 -1
  63. data/lib/seatschart/models/post_api_events_by_event_id_actions_edit_for_sale_config_request.rb +277 -0
  64. data/lib/seatschart/models/post_api_events_by_event_id_actions_edit_for_sale_config_request_for_sale_inner.rb +319 -0
  65. data/lib/seatschart/models/post_api_events_by_event_id_map_publish_request.rb +215 -0
  66. data/lib/seatschart/models/post_api_events_request.rb +42 -1
  67. data/lib/seatschart/models/{patch_api_events_by_event_id_request_categories_inner.rb → post_api_events_request_categories_inner.rb} +3 -3
  68. data/lib/seatschart/models/post_api_extract_seats200_response.rb +459 -0
  69. data/lib/seatschart/models/post_api_extract_seats200_response_seats_inner.rb +323 -0
  70. data/lib/seatschart/models/post_api_extract_seats200_response_suggested_inner.rb +320 -0
  71. data/lib/seatschart/models/post_api_extract_seats_request.rb +124 -4
  72. data/lib/seatschart/models/post_api_extract_seats_request_examples.rb +105 -0
  73. data/lib/seatschart/models/post_api_extract_seats_request_examples_any_of_inner.rb +293 -0
  74. data/lib/seatschart/models/post_api_extract_seats_request_negatives.rb +105 -0
  75. data/lib/seatschart/models/post_api_extract_seats_request_region.rb +105 -0
  76. data/lib/seatschart/models/{put_api_charts_by_chart_id_map_draft_request.rb → post_api_extract_seats_request_region_any_of.rb} +111 -96
  77. data/lib/seatschart/models/post_api_sandboxes201_response.rb +245 -0
  78. data/lib/seatschart/models/post_api_sandboxes201_response_admin_key.rb +286 -0
  79. data/lib/seatschart/models/post_api_sandboxes201_response_copied.rb +313 -0
  80. data/lib/seatschart/models/post_api_sandboxes201_response_copied_charts_inner.rb +281 -0
  81. data/lib/seatschart/models/post_api_sandboxes201_response_copied_events_inner.rb +281 -0
  82. data/lib/seatschart/models/post_api_sandboxes201_response_copied_events_with_own_map_inner.rb +265 -0
  83. data/lib/seatschart/models/post_api_sandboxes201_response_copied_key_conflicts_inner.rb +287 -0
  84. data/lib/seatschart/models/post_api_sandboxes201_response_copied_seasons_inner.rb +312 -0
  85. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_copy_from_production200_response.rb +313 -0
  86. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_copy_from_production_request.rb +255 -0
  87. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_join200_response.rb +271 -0
  88. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_reset200_response.rb +268 -0
  89. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_reset_request.rb +225 -0
  90. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_admin_key201_response.rb +253 -0
  91. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_admin_key201_response_api_key.rb +286 -0
  92. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_admin_key_request.rb +252 -0
  93. data/lib/seatschart/models/post_api_sandboxes_request.rb +319 -0
  94. data/lib/seatschart/models/post_api_seasons_request.rb +14 -4
  95. data/lib/seatschart/models/post_api_seats_confirm_request.rb +5 -5
  96. data/lib/seatschart/models/post_api_seats_release_request.rb +5 -5
  97. data/lib/seatschart/models/post_api_seats_reserve_request.rb +5 -5
  98. data/lib/seatschart/models/post_api_workspaces200_response.rb +468 -0
  99. data/lib/seatschart/models/post_api_workspaces200_response_api_key.rb +332 -0
  100. data/lib/seatschart/models/post_api_workspaces200_response_template.rb +260 -0
  101. data/lib/seatschart/models/post_api_workspaces200_response_template_webhooks_inner.rb +284 -0
  102. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_actions_delete200_response.rb +319 -0
  103. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_actions_delete_request.rb +281 -0
  104. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations_request.rb +300 -0
  105. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys201_response.rb +237 -0
  106. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys201_response_api_key.rb +338 -0
  107. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys_request.rb +299 -0
  108. data/lib/seatschart/models/post_api_workspaces_request.rb +101 -5
  109. data/lib/seatschart/models/post_api_workspaces_request_issue_key.rb +294 -0
  110. data/lib/seatschart/models/put_api_workspace_buyer_extra_data_request.rb +260 -0
  111. data/lib/seatschart/models/put_internal_status_notices_request.rb +242 -0
  112. data/lib/seatschart/models/put_internal_status_notices_request_notices_inner.rb +445 -0
  113. data/lib/seatschart/retry.rb +106 -7
  114. data/lib/seatschart/version.rb +1 -1
  115. data/lib/seatschart.rb +73 -3
  116. metadata +75 -5
  117. data/lib/seatschart/api/default_api.rb +0 -763
@@ -17,13 +17,27 @@ module SeatsChart
17
17
  class GetApiMonitoringRequests200Response
18
18
  attr_accessor :range
19
19
 
20
- # 60 for 10m/1h, 900 for 24h, 3600 for 7d.
20
+ # 60 for 10m/1h, 900 for 24h, 3600 for 7d, 86400 for 30d.
21
21
  attr_accessor :bucket_seconds
22
22
 
23
+ # Window start (first bucket).
23
24
  attr_accessor :from
24
25
 
26
+ # Window end: now for the live window, else the (exclusive) `before`.
25
27
  attr_accessor :to
26
28
 
29
+ # Aligned cursor of this window; null for the live window.
30
+ attr_accessor :before
31
+
32
+ # `before` of the previous (older) window; null when nothing older is kept.
33
+ attr_accessor :previous_before
34
+
35
+ # `before` of the next (newer) window; null when the next window is the live one (omit `before`) or this is the live window.
36
+ attr_accessor :next_before
37
+
38
+ # Oldest instant kept at this window size (24 hours of minutes, 31 days of hours and days).
39
+ attr_accessor :retention_start
40
+
27
41
  # Plan whose limits apply (a test workspace uses its production workspace plan).
28
42
  attr_accessor :plan
29
43
 
@@ -67,6 +81,10 @@ module SeatsChart
67
81
  :'bucket_seconds' => :'bucketSeconds',
68
82
  :'from' => :'from',
69
83
  :'to' => :'to',
84
+ :'before' => :'before',
85
+ :'previous_before' => :'previousBefore',
86
+ :'next_before' => :'nextBefore',
87
+ :'retention_start' => :'retentionStart',
70
88
  :'plan' => :'plan',
71
89
  :'is_test' => :'isTest',
72
90
  :'window_seconds' => :'windowSeconds',
@@ -88,6 +106,10 @@ module SeatsChart
88
106
  :'bucket_seconds' => :'Integer',
89
107
  :'from' => :'Time',
90
108
  :'to' => :'Time',
109
+ :'before' => :'Time',
110
+ :'previous_before' => :'Time',
111
+ :'next_before' => :'Time',
112
+ :'retention_start' => :'Time',
91
113
  :'plan' => :'String',
92
114
  :'is_test' => :'Boolean',
93
115
  :'window_seconds' => :'Integer',
@@ -100,6 +122,9 @@ module SeatsChart
100
122
  # List of attributes with nullable: true
101
123
  def self.openapi_nullable
102
124
  Set.new([
125
+ :'before',
126
+ :'previous_before',
127
+ :'next_before',
103
128
  ])
104
129
  end
105
130
 
@@ -142,6 +167,30 @@ module SeatsChart
142
167
  self.to = nil
143
168
  end
144
169
 
170
+ if attributes.key?(:'before')
171
+ self.before = attributes[:'before']
172
+ else
173
+ self.before = nil
174
+ end
175
+
176
+ if attributes.key?(:'previous_before')
177
+ self.previous_before = attributes[:'previous_before']
178
+ else
179
+ self.previous_before = nil
180
+ end
181
+
182
+ if attributes.key?(:'next_before')
183
+ self.next_before = attributes[:'next_before']
184
+ else
185
+ self.next_before = nil
186
+ end
187
+
188
+ if attributes.key?(:'retention_start')
189
+ self.retention_start = attributes[:'retention_start']
190
+ else
191
+ self.retention_start = nil
192
+ end
193
+
145
194
  if attributes.key?(:'plan')
146
195
  self.plan = attributes[:'plan']
147
196
  else
@@ -202,6 +251,10 @@ module SeatsChart
202
251
  invalid_properties.push('invalid value for "to", to cannot be nil.')
203
252
  end
204
253
 
254
+ if @retention_start.nil?
255
+ invalid_properties.push('invalid value for "retention_start", retention_start cannot be nil.')
256
+ end
257
+
205
258
  if @plan.nil?
206
259
  invalid_properties.push('invalid value for "plan", plan cannot be nil.')
207
260
  end
@@ -234,11 +287,12 @@ module SeatsChart
234
287
  def valid?
235
288
  warn '[DEPRECATED] the `valid?` method is obsolete'
236
289
  return false if @range.nil?
237
- range_validator = EnumAttributeValidator.new('String', ["10m", "1h", "24h", "7d"])
290
+ range_validator = EnumAttributeValidator.new('String', ["10m", "1h", "24h", "7d", "30d"])
238
291
  return false unless range_validator.valid?(@range)
239
292
  return false if @bucket_seconds.nil?
240
293
  return false if @from.nil?
241
294
  return false if @to.nil?
295
+ return false if @retention_start.nil?
242
296
  return false if @plan.nil?
243
297
  return false if @is_test.nil?
244
298
  return false if @window_seconds.nil?
@@ -251,7 +305,7 @@ module SeatsChart
251
305
  # Custom attribute writer method checking allowed values (enum).
252
306
  # @param [Object] range Object to be assigned
253
307
  def range=(range)
254
- validator = EnumAttributeValidator.new('String', ["10m", "1h", "24h", "7d"])
308
+ validator = EnumAttributeValidator.new('String', ["10m", "1h", "24h", "7d", "30d"])
255
309
  unless validator.valid?(range)
256
310
  fail ArgumentError, "invalid value for \"range\", must be one of #{validator.allowable_values}."
257
311
  end
@@ -267,6 +321,10 @@ module SeatsChart
267
321
  bucket_seconds == o.bucket_seconds &&
268
322
  from == o.from &&
269
323
  to == o.to &&
324
+ before == o.before &&
325
+ previous_before == o.previous_before &&
326
+ next_before == o.next_before &&
327
+ retention_start == o.retention_start &&
270
328
  plan == o.plan &&
271
329
  is_test == o.is_test &&
272
330
  window_seconds == o.window_seconds &&
@@ -284,7 +342,7 @@ module SeatsChart
284
342
  # Calculates hash code according to all attributes.
285
343
  # @return [Integer] Hash code
286
344
  def hash
287
- [range, bucket_seconds, from, to, plan, is_test, window_seconds, lanes, concurrency, points].hash
345
+ [range, bucket_seconds, from, to, before, previous_before, next_before, retention_start, plan, is_test, window_seconds, lanes, concurrency, points].hash
288
346
  end
289
347
 
290
348
  # Builds the object from hash
@@ -29,6 +29,9 @@ module SeatsChart
29
29
  # Peak in-flight (concurrent) requests in the bucket.
30
30
  attr_accessor :concurrent
31
31
 
32
+ # True when requests were refused with 429 in the bucket (either lane).
33
+ attr_accessor :limited
34
+
32
35
  # Attribute mapping from ruby-style variable name to JSON key.
33
36
  def self.attribute_map
34
37
  {
@@ -37,7 +40,8 @@ module SeatsChart
37
40
  :'api' => :'api',
38
41
  :'sales_rejected' => :'salesRejected',
39
42
  :'api_rejected' => :'apiRejected',
40
- :'concurrent' => :'concurrent'
43
+ :'concurrent' => :'concurrent',
44
+ :'limited' => :'limited'
41
45
  }
42
46
  end
43
47
 
@@ -54,7 +58,8 @@ module SeatsChart
54
58
  :'api' => :'Integer',
55
59
  :'sales_rejected' => :'Integer',
56
60
  :'api_rejected' => :'Integer',
57
- :'concurrent' => :'Integer'
61
+ :'concurrent' => :'Integer',
62
+ :'limited' => :'Boolean'
58
63
  }
59
64
  end
60
65
 
@@ -114,6 +119,12 @@ module SeatsChart
114
119
  else
115
120
  self.concurrent = nil
116
121
  end
122
+
123
+ if attributes.key?(:'limited')
124
+ self.limited = attributes[:'limited']
125
+ else
126
+ self.limited = nil
127
+ end
117
128
  end
118
129
 
119
130
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -145,6 +156,10 @@ module SeatsChart
145
156
  invalid_properties.push('invalid value for "concurrent", concurrent cannot be nil.')
146
157
  end
147
158
 
159
+ if @limited.nil?
160
+ invalid_properties.push('invalid value for "limited", limited cannot be nil.')
161
+ end
162
+
148
163
  invalid_properties
149
164
  end
150
165
 
@@ -158,6 +173,7 @@ module SeatsChart
158
173
  return false if @sales_rejected.nil?
159
174
  return false if @api_rejected.nil?
160
175
  return false if @concurrent.nil?
176
+ return false if @limited.nil?
161
177
  true
162
178
  end
163
179
 
@@ -171,7 +187,8 @@ module SeatsChart
171
187
  api == o.api &&
172
188
  sales_rejected == o.sales_rejected &&
173
189
  api_rejected == o.api_rejected &&
174
- concurrent == o.concurrent
190
+ concurrent == o.concurrent &&
191
+ limited == o.limited
175
192
  end
176
193
 
177
194
  # @see the `==` method
@@ -183,7 +200,7 @@ module SeatsChart
183
200
  # Calculates hash code according to all attributes.
184
201
  # @return [Integer] Hash code
185
202
  def hash
186
- [t, sales, api, sales_rejected, api_rejected, concurrent].hash
203
+ [t, sales, api, sales_rejected, api_rejected, concurrent, limited].hash
187
204
  end
188
205
 
189
206
  # Builds the object from hash
@@ -0,0 +1,239 @@
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 GetApiSandboxes200Response
18
+ attr_accessor :items
19
+
20
+ attr_accessor :limit
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'items' => :'items',
26
+ :'limit' => :'limit'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'items' => :'Array<GetApiSandboxes200ResponseItemsInner>',
39
+ :'limit' => :'Integer'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::GetApiSandboxes200Response` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::GetApiSandboxes200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'items')
65
+ if (value = attributes[:'items']).is_a?(Array)
66
+ self.items = value
67
+ end
68
+ else
69
+ self.items = nil
70
+ end
71
+
72
+ if attributes.key?(:'limit')
73
+ self.limit = attributes[:'limit']
74
+ else
75
+ self.limit = nil
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ if @items.nil?
85
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
86
+ end
87
+
88
+ if @limit.nil?
89
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if @items.nil?
100
+ return false if @limit.nil?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ items == o.items &&
110
+ limit == o.limit
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [items, limit].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def self._deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = SeatsChart.const_get(type)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end