seatschart 0.1.0 → 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,243 @@
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 PostApiEventsByEventIdListingsByListingIdActionsMarkSoldRequest
18
+ # Partner order reference.
19
+ attr_accessor :order_id
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'order_id' => :'orderId'
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
+ :'order_id' => :'String'
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::PostApiEventsByEventIdListingsByListingIdActionsMarkSoldRequest` 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::PostApiEventsByEventIdListingsByListingIdActionsMarkSoldRequest`. 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?(:'order_id')
62
+ self.order_id = attributes[:'order_id']
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
+ if !@order_id.nil? && @order_id.to_s.length > 255
72
+ invalid_properties.push('invalid value for "order_id", the character length must be smaller than or equal to 255.')
73
+ end
74
+
75
+ if !@order_id.nil? && @order_id.to_s.length < 1
76
+ invalid_properties.push('invalid value for "order_id", the character length must be great than or equal to 1.')
77
+ end
78
+
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ warn '[DEPRECATED] the `valid?` method is obsolete'
86
+ return false if !@order_id.nil? && @order_id.to_s.length > 255
87
+ return false if !@order_id.nil? && @order_id.to_s.length < 1
88
+ true
89
+ end
90
+
91
+ # Custom attribute writer method with validation
92
+ # @param [Object] order_id Value to be assigned
93
+ def order_id=(order_id)
94
+ if order_id.nil?
95
+ fail ArgumentError, 'order_id cannot be nil'
96
+ end
97
+
98
+ if order_id.to_s.length > 255
99
+ fail ArgumentError, 'invalid value for "order_id", the character length must be smaller than or equal to 255.'
100
+ end
101
+
102
+ if order_id.to_s.length < 1
103
+ fail ArgumentError, 'invalid value for "order_id", the character length must be great than or equal to 1.'
104
+ end
105
+
106
+ @order_id = order_id
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ order_id == o.order_id
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [order_id].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ attributes = attributes.transform_keys(&:to_sym)
135
+ transformed_hash = {}
136
+ openapi_types.each_pair do |key, type|
137
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
138
+ transformed_hash["#{key}"] = nil
139
+ elsif type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[attribute_map[key]].is_a?(Array)
143
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
144
+ end
145
+ elsif !attributes[attribute_map[key]].nil?
146
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
147
+ end
148
+ end
149
+ new(transformed_hash)
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def self._deserialize(type, value)
157
+ case type.to_sym
158
+ when :Time
159
+ Time.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ # models (e.g. Pet) or oneOf
190
+ klass = SeatsChart.const_get(type)
191
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+
241
+ end
242
+
243
+ end
@@ -0,0 +1,435 @@
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 PostApiEventsByEventIdListingsRequest
18
+ attr_accessor :key
19
+
20
+ # Listing type key; omitted = untyped (resale).
21
+ attr_accessor :type
22
+
23
+ attr_accessor :objects
24
+
25
+ attr_accessor :sell_as_whole
26
+
27
+ attr_accessor :price_cents
28
+
29
+ attr_accessor :total_price_cents
30
+
31
+ # Partner data (≤ 4 KiB JSON), returned as is.
32
+ attr_accessor :partner_metadata
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'key' => :'key',
38
+ :'type' => :'type',
39
+ :'objects' => :'objects',
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
+ :'objects' => :'Array<PostApiEventsByEventIdListingsRequestObjectsInner>',
58
+ :'sell_as_whole' => :'Boolean',
59
+ :'price_cents' => :'Integer',
60
+ :'total_price_cents' => :'Integer',
61
+ :'partner_metadata' => :'Hash<String, Object>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ :'type',
69
+ :'price_cents',
70
+ :'total_price_cents',
71
+ :'partner_metadata'
72
+ ])
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PostApiEventsByEventIdListingsRequest` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PostApiEventsByEventIdListingsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'key')
91
+ self.key = attributes[:'key']
92
+ end
93
+
94
+ if attributes.key?(:'type')
95
+ self.type = attributes[:'type']
96
+ end
97
+
98
+ if attributes.key?(:'objects')
99
+ if (value = attributes[:'objects']).is_a?(Array)
100
+ self.objects = value
101
+ end
102
+ else
103
+ self.objects = nil
104
+ end
105
+
106
+ if attributes.key?(:'sell_as_whole')
107
+ self.sell_as_whole = attributes[:'sell_as_whole']
108
+ end
109
+
110
+ if attributes.key?(:'price_cents')
111
+ self.price_cents = attributes[:'price_cents']
112
+ end
113
+
114
+ if attributes.key?(:'total_price_cents')
115
+ self.total_price_cents = attributes[:'total_price_cents']
116
+ end
117
+
118
+ if attributes.key?(:'partner_metadata')
119
+ if (value = attributes[:'partner_metadata']).is_a?(Hash)
120
+ self.partner_metadata = value
121
+ end
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
129
+ invalid_properties = Array.new
130
+ if !@key.nil? && @key.to_s.length > 64
131
+ invalid_properties.push('invalid value for "key", the character length must be smaller than or equal to 64.')
132
+ end
133
+
134
+ if !@key.nil? && @key.to_s.length < 1
135
+ invalid_properties.push('invalid value for "key", the character length must be great than or equal to 1.')
136
+ end
137
+
138
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
139
+ if !@key.nil? && @key !~ pattern
140
+ invalid_properties.push("invalid value for \"key\", must conform to the pattern #{pattern}.")
141
+ end
142
+
143
+ if !@type.nil? && @type.to_s.length > 64
144
+ invalid_properties.push('invalid value for "type", the character length must be smaller than or equal to 64.')
145
+ end
146
+
147
+ if !@type.nil? && @type.to_s.length < 1
148
+ invalid_properties.push('invalid value for "type", the character length must be great than or equal to 1.')
149
+ end
150
+
151
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
152
+ if !@type.nil? && @type !~ pattern
153
+ invalid_properties.push("invalid value for \"type\", must conform to the pattern #{pattern}.")
154
+ end
155
+
156
+ if @objects.nil?
157
+ invalid_properties.push('invalid value for "objects", objects cannot be nil.')
158
+ end
159
+
160
+ if @objects.length > 50
161
+ invalid_properties.push('invalid value for "objects", number of items must be less than or equal to 50.')
162
+ end
163
+
164
+ if @objects.length < 1
165
+ invalid_properties.push('invalid value for "objects", number of items must be greater than or equal to 1.')
166
+ end
167
+
168
+ if !@price_cents.nil? && @price_cents > 99999999
169
+ invalid_properties.push('invalid value for "price_cents", must be smaller than or equal to 99999999.')
170
+ end
171
+
172
+ if !@price_cents.nil? && @price_cents < 0
173
+ invalid_properties.push('invalid value for "price_cents", must be greater than or equal to 0.')
174
+ end
175
+
176
+ if !@total_price_cents.nil? && @total_price_cents > 99999999
177
+ invalid_properties.push('invalid value for "total_price_cents", must be smaller than or equal to 99999999.')
178
+ end
179
+
180
+ if !@total_price_cents.nil? && @total_price_cents < 0
181
+ invalid_properties.push('invalid value for "total_price_cents", must be greater than or equal to 0.')
182
+ end
183
+
184
+ invalid_properties
185
+ end
186
+
187
+ # Check to see if the all the properties in the model are valid
188
+ # @return true if the model is valid
189
+ def valid?
190
+ warn '[DEPRECATED] the `valid?` method is obsolete'
191
+ return false if !@key.nil? && @key.to_s.length > 64
192
+ return false if !@key.nil? && @key.to_s.length < 1
193
+ return false if !@key.nil? && @key !~ Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
194
+ return false if !@type.nil? && @type.to_s.length > 64
195
+ return false if !@type.nil? && @type.to_s.length < 1
196
+ return false if !@type.nil? && @type !~ Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
197
+ return false if @objects.nil?
198
+ return false if @objects.length > 50
199
+ return false if @objects.length < 1
200
+ return false if !@price_cents.nil? && @price_cents > 99999999
201
+ return false if !@price_cents.nil? && @price_cents < 0
202
+ return false if !@total_price_cents.nil? && @total_price_cents > 99999999
203
+ return false if !@total_price_cents.nil? && @total_price_cents < 0
204
+ true
205
+ end
206
+
207
+ # Custom attribute writer method with validation
208
+ # @param [Object] key Value to be assigned
209
+ def key=(key)
210
+ if key.nil?
211
+ fail ArgumentError, 'key cannot be nil'
212
+ end
213
+
214
+ if key.to_s.length > 64
215
+ fail ArgumentError, 'invalid value for "key", the character length must be smaller than or equal to 64.'
216
+ end
217
+
218
+ if key.to_s.length < 1
219
+ fail ArgumentError, 'invalid value for "key", the character length must be great than or equal to 1.'
220
+ end
221
+
222
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
223
+ if key !~ pattern
224
+ fail ArgumentError, "invalid value for \"key\", must conform to the pattern #{pattern}."
225
+ end
226
+
227
+ @key = key
228
+ end
229
+
230
+ # Custom attribute writer method with validation
231
+ # @param [Object] type Value to be assigned
232
+ def type=(type)
233
+ if !type.nil? && type.to_s.length > 64
234
+ fail ArgumentError, 'invalid value for "type", the character length must be smaller than or equal to 64.'
235
+ end
236
+
237
+ if !type.nil? && type.to_s.length < 1
238
+ fail ArgumentError, 'invalid value for "type", the character length must be great than or equal to 1.'
239
+ end
240
+
241
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.~:-]{0,63}$/)
242
+ if !type.nil? && type !~ pattern
243
+ fail ArgumentError, "invalid value for \"type\", must conform to the pattern #{pattern}."
244
+ end
245
+
246
+ @type = type
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] objects Value to be assigned
251
+ def objects=(objects)
252
+ if objects.nil?
253
+ fail ArgumentError, 'objects cannot be nil'
254
+ end
255
+
256
+ if objects.length > 50
257
+ fail ArgumentError, 'invalid value for "objects", number of items must be less than or equal to 50.'
258
+ end
259
+
260
+ if objects.length < 1
261
+ fail ArgumentError, 'invalid value for "objects", number of items must be greater than or equal to 1.'
262
+ end
263
+
264
+ @objects = objects
265
+ end
266
+
267
+ # Custom attribute writer method with validation
268
+ # @param [Object] price_cents Value to be assigned
269
+ def price_cents=(price_cents)
270
+ if !price_cents.nil? && price_cents > 99999999
271
+ fail ArgumentError, 'invalid value for "price_cents", must be smaller than or equal to 99999999.'
272
+ end
273
+
274
+ if !price_cents.nil? && price_cents < 0
275
+ fail ArgumentError, 'invalid value for "price_cents", must be greater than or equal to 0.'
276
+ end
277
+
278
+ @price_cents = price_cents
279
+ end
280
+
281
+ # Custom attribute writer method with validation
282
+ # @param [Object] total_price_cents Value to be assigned
283
+ def total_price_cents=(total_price_cents)
284
+ if !total_price_cents.nil? && total_price_cents > 99999999
285
+ fail ArgumentError, 'invalid value for "total_price_cents", must be smaller than or equal to 99999999.'
286
+ end
287
+
288
+ if !total_price_cents.nil? && total_price_cents < 0
289
+ fail ArgumentError, 'invalid value for "total_price_cents", must be greater than or equal to 0.'
290
+ end
291
+
292
+ @total_price_cents = total_price_cents
293
+ end
294
+
295
+ # Checks equality by comparing each attribute.
296
+ # @param [Object] Object to be compared
297
+ def ==(o)
298
+ return true if self.equal?(o)
299
+ self.class == o.class &&
300
+ key == o.key &&
301
+ type == o.type &&
302
+ objects == o.objects &&
303
+ sell_as_whole == o.sell_as_whole &&
304
+ price_cents == o.price_cents &&
305
+ total_price_cents == o.total_price_cents &&
306
+ partner_metadata == o.partner_metadata
307
+ end
308
+
309
+ # @see the `==` method
310
+ # @param [Object] Object to be compared
311
+ def eql?(o)
312
+ self == o
313
+ end
314
+
315
+ # Calculates hash code according to all attributes.
316
+ # @return [Integer] Hash code
317
+ def hash
318
+ [key, type, objects, sell_as_whole, price_cents, total_price_cents, partner_metadata].hash
319
+ end
320
+
321
+ # Builds the object from hash
322
+ # @param [Hash] attributes Model attributes in the form of hash
323
+ # @return [Object] Returns the model itself
324
+ def self.build_from_hash(attributes)
325
+ return nil unless attributes.is_a?(Hash)
326
+ attributes = attributes.transform_keys(&:to_sym)
327
+ transformed_hash = {}
328
+ openapi_types.each_pair do |key, type|
329
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
330
+ transformed_hash["#{key}"] = nil
331
+ elsif type =~ /\AArray<(.*)>/i
332
+ # check to ensure the input is an array given that the attribute
333
+ # is documented as an array but the input is not
334
+ if attributes[attribute_map[key]].is_a?(Array)
335
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
336
+ end
337
+ elsif !attributes[attribute_map[key]].nil?
338
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
339
+ end
340
+ end
341
+ new(transformed_hash)
342
+ end
343
+
344
+ # Deserializes the data based on type
345
+ # @param string type Data type
346
+ # @param string value Value to be deserialized
347
+ # @return [Object] Deserialized data
348
+ def self._deserialize(type, value)
349
+ case type.to_sym
350
+ when :Time
351
+ Time.parse(value)
352
+ when :Date
353
+ Date.parse(value)
354
+ when :String
355
+ value.to_s
356
+ when :Integer
357
+ value.to_i
358
+ when :Float
359
+ value.to_f
360
+ when :Boolean
361
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
362
+ true
363
+ else
364
+ false
365
+ end
366
+ when :Object
367
+ # generic object (usually a Hash), return directly
368
+ value
369
+ when /\AArray<(?<inner_type>.+)>\z/
370
+ inner_type = Regexp.last_match[:inner_type]
371
+ value.map { |v| _deserialize(inner_type, v) }
372
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
373
+ k_type = Regexp.last_match[:k_type]
374
+ v_type = Regexp.last_match[:v_type]
375
+ {}.tap do |hash|
376
+ value.each do |k, v|
377
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
378
+ end
379
+ end
380
+ else # model
381
+ # models (e.g. Pet) or oneOf
382
+ klass = SeatsChart.const_get(type)
383
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
384
+ end
385
+ end
386
+
387
+ # Returns the string representation of the object
388
+ # @return [String] String presentation of the object
389
+ def to_s
390
+ to_hash.to_s
391
+ end
392
+
393
+ # to_body is an alias to to_hash (backward compatibility)
394
+ # @return [Hash] Returns the object in the form of hash
395
+ def to_body
396
+ to_hash
397
+ end
398
+
399
+ # Returns the object in the form of hash
400
+ # @return [Hash] Returns the object in the form of hash
401
+ def to_hash
402
+ hash = {}
403
+ self.class.attribute_map.each_pair do |attr, param|
404
+ value = self.send(attr)
405
+ if value.nil?
406
+ is_nullable = self.class.openapi_nullable.include?(attr)
407
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
408
+ end
409
+
410
+ hash[param] = _to_hash(value)
411
+ end
412
+ hash
413
+ end
414
+
415
+ # Outputs non-array value in the form of hash
416
+ # For object, use to_hash. Otherwise, just return the value
417
+ # @param [Object] value Any valid value
418
+ # @return [Hash] Returns the value in the form of hash
419
+ def _to_hash(value)
420
+ if value.is_a?(Array)
421
+ value.compact.map { |v| _to_hash(v) }
422
+ elsif value.is_a?(Hash)
423
+ {}.tap do |hash|
424
+ value.each { |k, v| hash[k] = _to_hash(v) }
425
+ end
426
+ elsif value.respond_to? :to_hash
427
+ value.to_hash
428
+ else
429
+ value
430
+ end
431
+ end
432
+
433
+ end
434
+
435
+ end