seatschart 0.3.0 → 0.5.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +79 -11
  3. data/lib/seatschart/api/audit_api.rb +2 -2
  4. data/lib/seatschart/api/auth_api.rb +85 -8
  5. data/lib/seatschart/api/billing_api.rb +93 -8
  6. data/lib/seatschart/api/charts_api.rb +63 -63
  7. data/lib/seatschart/api/events_api.rb +130 -124
  8. data/lib/seatschart/api/public_api.rb +6 -6
  9. data/lib/seatschart/api/seasons_api.rb +88 -88
  10. data/lib/seatschart/api/seats_api.rb +6 -6
  11. data/lib/seatschart/api/usage_api.rb +4 -4
  12. data/lib/seatschart/api/workspace_api.rb +1229 -51
  13. data/lib/seatschart/models/{api_error.rb → api_error_body.rb} +7 -7
  14. data/lib/seatschart/models/delete_api_workspaces_by_workspace_id_keys_by_key_id200_response.rb +237 -0
  15. data/lib/seatschart/models/delete_api_workspaces_by_workspace_id_members_by_user_id200_response.rb +221 -0
  16. data/lib/seatschart/models/get_api_workspaces200_response_items_inner.rb +50 -4
  17. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response.rb +239 -0
  18. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response_invitations_inner.rb +286 -0
  19. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_keys200_response.rb +239 -0
  20. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_keys200_response_api_keys_inner.rb +321 -0
  21. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_members200_response.rb +239 -0
  22. data/lib/seatschart/models/get_api_workspaces_by_workspace_id_members200_response_members_inner.rb +288 -0
  23. data/lib/seatschart/models/get_api_workspaces_overview200_response.rb +288 -0
  24. data/lib/seatschart/models/get_api_workspaces_overview200_response_account.rb +270 -0
  25. data/lib/seatschart/models/get_api_workspaces_overview200_response_account_charts.rb +233 -0
  26. data/lib/seatschart/models/get_api_workspaces_overview200_response_account_plan.rb +237 -0
  27. data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner.rb +439 -0
  28. data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner_revenue.rb +234 -0
  29. data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner_usage.rb +271 -0
  30. data/lib/seatschart/models/get_api_workspaces_overview200_response_seats.rb +431 -0
  31. data/lib/seatschart/models/get_api_workspaces_overview200_response_seats_overage.rb +233 -0
  32. data/lib/seatschart/models/get_api_workspaces_overview200_response_seats_projected.rb +237 -0
  33. data/lib/seatschart/models/get_api_workspaces_overview200_response_totals.rb +318 -0
  34. data/lib/seatschart/models/get_api_workspaces_overview200_response_totals_revenue.rb +238 -0
  35. data/lib/seatschart/models/get_api_workspaces_overview200_response_totals_seats.rb +253 -0
  36. data/lib/seatschart/models/patch_api_events_by_event_id_request.rb +15 -15
  37. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_keys_by_key_id200_response.rb +221 -0
  38. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_keys_by_key_id_request.rb +292 -0
  39. data/lib/seatschart/models/patch_api_workspaces_by_workspace_id_request.rb +288 -0
  40. data/lib/seatschart/models/post_api_auth_new_workspace_request.rb +294 -0
  41. data/lib/seatschart/models/post_api_billing_actions_change_plan_request.rb +256 -0
  42. data/lib/seatschart/models/post_api_events_by_event_id_actions_update_extra_data_request_objects_inner.rb +0 -2
  43. data/lib/seatschart/models/post_api_sandboxes201_response.rb +0 -4
  44. data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_reset200_response.rb +0 -2
  45. data/lib/seatschart/models/post_api_workspaces200_response.rb +464 -0
  46. data/lib/seatschart/models/post_api_workspaces200_response_api_key.rb +332 -0
  47. data/lib/seatschart/models/post_api_workspaces200_response_template.rb +260 -0
  48. data/lib/seatschart/models/post_api_workspaces200_response_template_webhooks_inner.rb +284 -0
  49. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_actions_delete200_response.rb +319 -0
  50. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_actions_delete_request.rb +281 -0
  51. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response.rb +238 -0
  52. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response_invitation.rb +286 -0
  53. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations_request.rb +300 -0
  54. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys201_response.rb +237 -0
  55. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys201_response_api_key.rb +338 -0
  56. data/lib/seatschart/models/post_api_workspaces_by_workspace_id_keys_request.rb +299 -0
  57. data/lib/seatschart/models/post_api_workspaces_request.rb +100 -4
  58. data/lib/seatschart/models/post_api_workspaces_request_issue_key.rb +294 -0
  59. data/lib/seatschart/version.rb +1 -1
  60. data/lib/seatschart/workspaces.rb +172 -0
  61. data/lib/seatschart.rb +41 -2
  62. metadata +43 -4
  63. data/lib/seatschart/models/put_api_charts_by_chart_id_map_draft_request.rb +0 -349
@@ -0,0 +1,292 @@
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 PatchApiWorkspacesByWorkspaceIdKeysByKeyIdRequest
18
+ attr_accessor :name
19
+
20
+ # Every scope. Default when `scopes` is absent.
21
+ attr_accessor :full_access
22
+
23
+ # Granted scopes: `read`, `holds`, `bookings`, `inventory_admin`, `charts_write`, `events_write`, `reports`, `webhooks`.
24
+ attr_accessor :scopes
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'name' => :'name',
30
+ :'full_access' => :'fullAccess',
31
+ :'scopes' => :'scopes'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'name' => :'String',
44
+ :'full_access' => :'Boolean',
45
+ :'scopes' => :'Array<String>'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PatchApiWorkspacesByWorkspaceIdKeysByKeyIdRequest` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PatchApiWorkspacesByWorkspaceIdKeysByKeyIdRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'name')
71
+ self.name = attributes[:'name']
72
+ end
73
+
74
+ if attributes.key?(:'full_access')
75
+ self.full_access = attributes[:'full_access']
76
+ end
77
+
78
+ if attributes.key?(:'scopes')
79
+ if (value = attributes[:'scopes']).is_a?(Array)
80
+ self.scopes = value
81
+ end
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
89
+ invalid_properties = Array.new
90
+ if !@name.nil? && @name.to_s.length > 256
91
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 256.')
92
+ end
93
+
94
+ if !@name.nil? && @name.to_s.length < 1
95
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 1.')
96
+ end
97
+
98
+ if !@scopes.nil? && @scopes.length > 16
99
+ invalid_properties.push('invalid value for "scopes", number of items must be less than or equal to 16.')
100
+ end
101
+
102
+ if !@scopes.nil? && @scopes.length < 1
103
+ invalid_properties.push('invalid value for "scopes", number of items must be greater than or equal to 1.')
104
+ end
105
+
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ warn '[DEPRECATED] the `valid?` method is obsolete'
113
+ return false if !@name.nil? && @name.to_s.length > 256
114
+ return false if !@name.nil? && @name.to_s.length < 1
115
+ return false if !@scopes.nil? && @scopes.length > 16
116
+ return false if !@scopes.nil? && @scopes.length < 1
117
+ true
118
+ end
119
+
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] name Value to be assigned
122
+ def name=(name)
123
+ if name.nil?
124
+ fail ArgumentError, 'name cannot be nil'
125
+ end
126
+
127
+ if name.to_s.length > 256
128
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 256.'
129
+ end
130
+
131
+ if name.to_s.length < 1
132
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.'
133
+ end
134
+
135
+ @name = name
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] scopes Value to be assigned
140
+ def scopes=(scopes)
141
+ if scopes.nil?
142
+ fail ArgumentError, 'scopes cannot be nil'
143
+ end
144
+
145
+ if scopes.length > 16
146
+ fail ArgumentError, 'invalid value for "scopes", number of items must be less than or equal to 16.'
147
+ end
148
+
149
+ if scopes.length < 1
150
+ fail ArgumentError, 'invalid value for "scopes", number of items must be greater than or equal to 1.'
151
+ end
152
+
153
+ @scopes = scopes
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ name == o.name &&
162
+ full_access == o.full_access &&
163
+ scopes == o.scopes
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Integer] Hash code
174
+ def hash
175
+ [name, full_access, scopes].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def self.build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ attributes = attributes.transform_keys(&:to_sym)
184
+ transformed_hash = {}
185
+ openapi_types.each_pair do |key, type|
186
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = nil
188
+ elsif type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[attribute_map[key]].is_a?(Array)
192
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
193
+ end
194
+ elsif !attributes[attribute_map[key]].nil?
195
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
196
+ end
197
+ end
198
+ new(transformed_hash)
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def self._deserialize(type, value)
206
+ case type.to_sym
207
+ when :Time
208
+ Time.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ # models (e.g. Pet) or oneOf
239
+ klass = SeatsChart.const_get(type)
240
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ if value.nil?
263
+ is_nullable = self.class.openapi_nullable.include?(attr)
264
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
+ end
266
+
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map { |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+
290
+ end
291
+
292
+ end
@@ -0,0 +1,288 @@
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 PatchApiWorkspacesByWorkspaceIdRequest
18
+ attr_accessor :display_name
19
+
20
+ # Your organizer id (letters, digits and `_ . ~ -`); `null` removes it. Unique among the workspaces you administer: 409 `external_id_taken` names the workspace that has it.
21
+ attr_accessor :external_id
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'display_name' => :'displayName',
27
+ :'external_id' => :'externalId'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'display_name' => :'String',
40
+ :'external_id' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ :'external_id'
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PatchApiWorkspacesByWorkspaceIdRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PatchApiWorkspacesByWorkspaceIdRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'display_name')
67
+ self.display_name = attributes[:'display_name']
68
+ end
69
+
70
+ if attributes.key?(:'external_id')
71
+ self.external_id = attributes[:'external_id']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
+ invalid_properties = Array.new
80
+ if !@display_name.nil? && @display_name.to_s.length > 512
81
+ invalid_properties.push('invalid value for "display_name", the character length must be smaller than or equal to 512.')
82
+ end
83
+
84
+ if !@display_name.nil? && @display_name.to_s.length < 1
85
+ invalid_properties.push('invalid value for "display_name", the character length must be great than or equal to 1.')
86
+ end
87
+
88
+ if !@external_id.nil? && @external_id.to_s.length > 128
89
+ invalid_properties.push('invalid value for "external_id", the character length must be smaller than or equal to 128.')
90
+ end
91
+
92
+ if !@external_id.nil? && @external_id.to_s.length < 1
93
+ invalid_properties.push('invalid value for "external_id", the character length must be great than or equal to 1.')
94
+ end
95
+
96
+ pattern = Regexp.new(/^[A-Za-z0-9_.~-]{1,128}$/)
97
+ if !@external_id.nil? && @external_id !~ pattern
98
+ invalid_properties.push("invalid value for \"external_id\", must conform to the pattern #{pattern}.")
99
+ end
100
+
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ warn '[DEPRECATED] the `valid?` method is obsolete'
108
+ return false if !@display_name.nil? && @display_name.to_s.length > 512
109
+ return false if !@display_name.nil? && @display_name.to_s.length < 1
110
+ return false if !@external_id.nil? && @external_id.to_s.length > 128
111
+ return false if !@external_id.nil? && @external_id.to_s.length < 1
112
+ return false if !@external_id.nil? && @external_id !~ Regexp.new(/^[A-Za-z0-9_.~-]{1,128}$/)
113
+ true
114
+ end
115
+
116
+ # Custom attribute writer method with validation
117
+ # @param [Object] display_name Value to be assigned
118
+ def display_name=(display_name)
119
+ if display_name.nil?
120
+ fail ArgumentError, 'display_name cannot be nil'
121
+ end
122
+
123
+ if display_name.to_s.length > 512
124
+ fail ArgumentError, 'invalid value for "display_name", the character length must be smaller than or equal to 512.'
125
+ end
126
+
127
+ if display_name.to_s.length < 1
128
+ fail ArgumentError, 'invalid value for "display_name", the character length must be great than or equal to 1.'
129
+ end
130
+
131
+ @display_name = display_name
132
+ end
133
+
134
+ # Custom attribute writer method with validation
135
+ # @param [Object] external_id Value to be assigned
136
+ def external_id=(external_id)
137
+ if !external_id.nil? && external_id.to_s.length > 128
138
+ fail ArgumentError, 'invalid value for "external_id", the character length must be smaller than or equal to 128.'
139
+ end
140
+
141
+ if !external_id.nil? && external_id.to_s.length < 1
142
+ fail ArgumentError, 'invalid value for "external_id", the character length must be great than or equal to 1.'
143
+ end
144
+
145
+ pattern = Regexp.new(/^[A-Za-z0-9_.~-]{1,128}$/)
146
+ if !external_id.nil? && external_id !~ pattern
147
+ fail ArgumentError, "invalid value for \"external_id\", must conform to the pattern #{pattern}."
148
+ end
149
+
150
+ @external_id = external_id
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ display_name == o.display_name &&
159
+ external_id == o.external_id
160
+ end
161
+
162
+ # @see the `==` method
163
+ # @param [Object] Object to be compared
164
+ def eql?(o)
165
+ self == o
166
+ end
167
+
168
+ # Calculates hash code according to all attributes.
169
+ # @return [Integer] Hash code
170
+ def hash
171
+ [display_name, external_id].hash
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def self.build_from_hash(attributes)
178
+ return nil unless attributes.is_a?(Hash)
179
+ attributes = attributes.transform_keys(&:to_sym)
180
+ transformed_hash = {}
181
+ openapi_types.each_pair do |key, type|
182
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
183
+ transformed_hash["#{key}"] = nil
184
+ elsif type =~ /\AArray<(.*)>/i
185
+ # check to ensure the input is an array given that the attribute
186
+ # is documented as an array but the input is not
187
+ if attributes[attribute_map[key]].is_a?(Array)
188
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
189
+ end
190
+ elsif !attributes[attribute_map[key]].nil?
191
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
192
+ end
193
+ end
194
+ new(transformed_hash)
195
+ end
196
+
197
+ # Deserializes the data based on type
198
+ # @param string type Data type
199
+ # @param string value Value to be deserialized
200
+ # @return [Object] Deserialized data
201
+ def self._deserialize(type, value)
202
+ case type.to_sym
203
+ when :Time
204
+ Time.parse(value)
205
+ when :Date
206
+ Date.parse(value)
207
+ when :String
208
+ value.to_s
209
+ when :Integer
210
+ value.to_i
211
+ when :Float
212
+ value.to_f
213
+ when :Boolean
214
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
215
+ true
216
+ else
217
+ false
218
+ end
219
+ when :Object
220
+ # generic object (usually a Hash), return directly
221
+ value
222
+ when /\AArray<(?<inner_type>.+)>\z/
223
+ inner_type = Regexp.last_match[:inner_type]
224
+ value.map { |v| _deserialize(inner_type, v) }
225
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
226
+ k_type = Regexp.last_match[:k_type]
227
+ v_type = Regexp.last_match[:v_type]
228
+ {}.tap do |hash|
229
+ value.each do |k, v|
230
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
231
+ end
232
+ end
233
+ else # model
234
+ # models (e.g. Pet) or oneOf
235
+ klass = SeatsChart.const_get(type)
236
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
237
+ end
238
+ end
239
+
240
+ # Returns the string representation of the object
241
+ # @return [String] String presentation of the object
242
+ def to_s
243
+ to_hash.to_s
244
+ end
245
+
246
+ # to_body is an alias to to_hash (backward compatibility)
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_body
249
+ to_hash
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = self.send(attr)
258
+ if value.nil?
259
+ is_nullable = self.class.openapi_nullable.include?(attr)
260
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
+ end
262
+
263
+ hash[param] = _to_hash(value)
264
+ end
265
+ hash
266
+ end
267
+
268
+ # Outputs non-array value in the form of hash
269
+ # For object, use to_hash. Otherwise, just return the value
270
+ # @param [Object] value Any valid value
271
+ # @return [Hash] Returns the value in the form of hash
272
+ def _to_hash(value)
273
+ if value.is_a?(Array)
274
+ value.compact.map { |v| _to_hash(v) }
275
+ elsif value.is_a?(Hash)
276
+ {}.tap do |hash|
277
+ value.each { |k, v| hash[k] = _to_hash(v) }
278
+ end
279
+ elsif value.respond_to? :to_hash
280
+ value.to_hash
281
+ else
282
+ value
283
+ end
284
+ end
285
+
286
+ end
287
+
288
+ end