seatschart 0.1.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 (168) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +552 -0
  4. data/lib/seatschart/api/api_keys_api.rb +364 -0
  5. data/lib/seatschart/api/assets_api.rb +95 -0
  6. data/lib/seatschart/api/audit_api.rb +88 -0
  7. data/lib/seatschart/api/auth_api.rb +1187 -0
  8. data/lib/seatschart/api/billing_api.rb +355 -0
  9. data/lib/seatschart/api/charts_api.rb +4195 -0
  10. data/lib/seatschart/api/default_api.rb +763 -0
  11. data/lib/seatschart/api/embed_api.rb +407 -0
  12. data/lib/seatschart/api/embed_origins_api.rb +281 -0
  13. data/lib/seatschart/api/event_log_api.rb +148 -0
  14. data/lib/seatschart/api/events_api.rb +6608 -0
  15. data/lib/seatschart/api/health_api.rb +77 -0
  16. data/lib/seatschart/api/map_designer_api.rb +135 -0
  17. data/lib/seatschart/api/object_status_api.rb +805 -0
  18. data/lib/seatschart/api/orders_api.rb +166 -0
  19. data/lib/seatschart/api/public_api.rb +455 -0
  20. data/lib/seatschart/api/quotes_api.rb +103 -0
  21. data/lib/seatschart/api/seasons_api.rb +5543 -0
  22. data/lib/seatschart/api/seats_api.rb +1103 -0
  23. data/lib/seatschart/api/sse_api.rb +83 -0
  24. data/lib/seatschart/api/team_api.rb +428 -0
  25. data/lib/seatschart/api/usage_api.rb +540 -0
  26. data/lib/seatschart/api/webhooks_api.rb +771 -0
  27. data/lib/seatschart/api/workspace_api.rb +1244 -0
  28. data/lib/seatschart/api_client.rb +394 -0
  29. data/lib/seatschart/api_error.rb +58 -0
  30. data/lib/seatschart/configuration.rb +316 -0
  31. data/lib/seatschart/models/delete_api_workspaces_by_workspace_id200_response.rb +283 -0
  32. data/lib/seatschart/models/get_api_charts_by_chart_id_versions200_response.rb +247 -0
  33. data/lib/seatschart/models/get_api_charts_by_chart_id_versions200_response_items_inner.rb +473 -0
  34. data/lib/seatschart/models/get_api_charts_by_chart_id_versions200_response_items_inner_published_by.rb +280 -0
  35. data/lib/seatschart/models/get_api_events_by_event_id_map_versions200_response.rb +247 -0
  36. data/lib/seatschart/models/get_api_events_by_event_id_map_versions200_response_items_inner.rb +444 -0
  37. data/lib/seatschart/models/get_api_events_by_event_id_seat_views200_response.rb +267 -0
  38. data/lib/seatschart/models/get_api_events_by_event_id_seat_views200_response_views_value.rb +273 -0
  39. data/lib/seatschart/models/get_api_events_by_event_id_seat_views404_response.rb +237 -0
  40. data/lib/seatschart/models/get_api_monitoring_requests200_response.rb +388 -0
  41. data/lib/seatschart/models/get_api_monitoring_requests200_response_lanes.rb +237 -0
  42. data/lib/seatschart/models/get_api_monitoring_requests200_response_lanes_sales.rb +256 -0
  43. data/lib/seatschart/models/get_api_monitoring_requests200_response_points_inner.rb +286 -0
  44. data/lib/seatschart/models/get_api_workspace_integration200_response.rb +287 -0
  45. data/lib/seatschart/models/get_api_workspace_settings200_response.rb +329 -0
  46. data/lib/seatschart/models/get_api_workspace_settings200_response_bounds.rb +237 -0
  47. data/lib/seatschart/models/get_api_workspace_settings200_response_bounds_hold_period_minutes.rb +237 -0
  48. data/lib/seatschart/models/get_api_workspace_settings200_response_effective.rb +269 -0
  49. data/lib/seatschart/models/get_api_workspace_settings200_response_overrides.rb +241 -0
  50. data/lib/seatschart/models/get_api_workspace_settings200_response_sources.rb +339 -0
  51. data/lib/seatschart/models/get_api_workspaces200_response.rb +223 -0
  52. data/lib/seatschart/models/get_api_workspaces200_response_items_inner.rb +423 -0
  53. data/lib/seatschart/models/patch_api_charts_by_chart_id_categories_by_category_id_request.rb +304 -0
  54. data/lib/seatschart/models/patch_api_charts_by_chart_id_request.rb +288 -0
  55. data/lib/seatschart/models/patch_api_events_by_event_id_inventory_channels_by_channel_key_id_request.rb +272 -0
  56. data/lib/seatschart/models/patch_api_events_by_event_id_request.rb +448 -0
  57. data/lib/seatschart/models/patch_api_events_by_event_id_request_categories_inner.rb +343 -0
  58. data/lib/seatschart/models/patch_api_events_by_event_id_request_table_booking_config.rb +266 -0
  59. data/lib/seatschart/models/patch_api_keys_by_id_request.rb +292 -0
  60. data/lib/seatschart/models/patch_api_seasons_by_season_id_events_by_event_id_request.rb +221 -0
  61. data/lib/seatschart/models/patch_api_seasons_by_season_id_request.rb +276 -0
  62. data/lib/seatschart/models/patch_api_team_members_by_user_id_request.rb +255 -0
  63. data/lib/seatschart/models/patch_api_webhooks_by_id_request.rb +291 -0
  64. data/lib/seatschart/models/patch_api_workspace_chart_validation_request.rb +224 -0
  65. data/lib/seatschart/models/patch_api_workspace_chart_validation_request_severities.rb +543 -0
  66. data/lib/seatschart/models/patch_api_workspace_integration_request.rb +257 -0
  67. data/lib/seatschart/models/patch_api_workspace_request.rb +249 -0
  68. data/lib/seatschart/models/patch_api_workspace_settings_request.rb +307 -0
  69. data/lib/seatschart/models/post_api_auth2fa_disable_request.rb +281 -0
  70. data/lib/seatschart/models/post_api_auth2fa_enable_request.rb +250 -0
  71. data/lib/seatschart/models/post_api_auth2fa_enroll_confirm_request.rb +295 -0
  72. data/lib/seatschart/models/post_api_auth2fa_enroll_start_request.rb +250 -0
  73. data/lib/seatschart/models/post_api_auth2fa_verify_request.rb +326 -0
  74. data/lib/seatschart/models/post_api_auth_accept_invite_request.rb +293 -0
  75. data/lib/seatschart/models/post_api_auth_login_request.rb +293 -0
  76. data/lib/seatschart/models/post_api_auth_logout_request.rb +242 -0
  77. data/lib/seatschart/models/post_api_auth_refresh_request.rb +292 -0
  78. data/lib/seatschart/models/post_api_auth_signup_request.rb +321 -0
  79. data/lib/seatschart/models/post_api_auth_switch_workspace_request.rb +249 -0
  80. data/lib/seatschart/models/post_api_billing_checkout_session_request.rb +249 -0
  81. data/lib/seatschart/models/post_api_billing_confirm_checkout_request.rb +249 -0
  82. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_archive200_response.rb +221 -0
  83. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_archive200_response_chart.rb +249 -0
  84. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_copy_to_workspace_request.rb +287 -0
  85. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_validate_request.rb +348 -0
  86. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_validate_request_seats_inner.rb +555 -0
  87. data/lib/seatschart/models/post_api_charts_by_chart_id_actions_validate_request_seats_inner_accessibility.rb +356 -0
  88. data/lib/seatschart/models/post_api_charts_by_chart_id_categories_request.rb +361 -0
  89. data/lib/seatschart/models/post_api_charts_by_chart_id_categories_request_ticket_types_inner.rb +448 -0
  90. data/lib/seatschart/models/post_api_charts_by_chart_id_duplicate_request.rb +233 -0
  91. data/lib/seatschart/models/post_api_charts_by_chart_id_map_publish422_response.rb +289 -0
  92. data/lib/seatschart/models/post_api_charts_by_chart_id_map_publish422_response_issues_inner.rb +402 -0
  93. data/lib/seatschart/models/post_api_charts_by_chart_id_map_publish_request.rb +244 -0
  94. data/lib/seatschart/models/post_api_charts_by_chart_id_preview_link_request.rb +243 -0
  95. data/lib/seatschart/models/post_api_charts_by_chart_id_versions_by_version_actions_copy_request.rb +242 -0
  96. data/lib/seatschart/models/post_api_charts_request.rb +372 -0
  97. data/lib/seatschart/models/post_api_charts_request_categories_inner.rb +346 -0
  98. data/lib/seatschart/models/post_api_embed_origins_request.rb +249 -0
  99. data/lib/seatschart/models/post_api_embed_tokens_request.rb +394 -0
  100. data/lib/seatschart/models/post_api_events_actions_change_object_status_request.rb +251 -0
  101. data/lib/seatschart/models/post_api_events_actions_change_object_status_request_status_changes_inner.rb +737 -0
  102. data/lib/seatschart/models/post_api_events_actions_change_object_status_request_status_changes_inner_objects_inner.rb +104 -0
  103. data/lib/seatschart/models/post_api_events_actions_change_object_status_request_status_changes_inner_objects_inner_any_of.rb +335 -0
  104. data/lib/seatschart/models/post_api_events_bulk_request.rb +332 -0
  105. data/lib/seatschart/models/post_api_events_bulk_request_events_inner.rb +398 -0
  106. data/lib/seatschart/models/post_api_events_by_event_id_actions_change_object_status_request.rb +824 -0
  107. data/lib/seatschart/models/post_api_events_by_event_id_actions_override_season_status_request.rb +272 -0
  108. data/lib/seatschart/models/post_api_events_by_event_id_actions_update_extra_data_request.rb +260 -0
  109. data/lib/seatschart/models/post_api_events_by_event_id_actions_update_extra_data_request_objects_inner.rb +263 -0
  110. data/lib/seatschart/models/post_api_events_by_event_id_actions_use_season_status_request.rb +252 -0
  111. data/lib/seatschart/models/post_api_events_by_event_id_duplicate_request.rb +261 -0
  112. data/lib/seatschart/models/post_api_events_by_event_id_inventory_channels_assign_request.rb +321 -0
  113. data/lib/seatschart/models/post_api_events_by_event_id_inventory_channels_request.rb +323 -0
  114. data/lib/seatschart/models/post_api_events_by_event_id_inventory_for_sale_apply_request.rb +333 -0
  115. data/lib/seatschart/models/post_api_events_by_event_id_objects_actions_retrieve_request.rb +252 -0
  116. data/lib/seatschart/models/post_api_events_request.rb +502 -0
  117. data/lib/seatschart/models/post_api_events_request_category_overrides_value.rb +276 -0
  118. data/lib/seatschart/models/post_api_events_request_channels_inner.rb +360 -0
  119. data/lib/seatschart/models/post_api_events_request_for_sale_config.rb +295 -0
  120. data/lib/seatschart/models/post_api_events_request_table_booking_config.rb +267 -0
  121. data/lib/seatschart/models/post_api_extract_seats_request.rb +279 -0
  122. data/lib/seatschart/models/post_api_ga_confirm409_response.rb +271 -0
  123. data/lib/seatschart/models/post_api_ga_confirm_request.rb +687 -0
  124. data/lib/seatschart/models/post_api_ga_release_request.rb +385 -0
  125. data/lib/seatschart/models/post_api_ga_reserve_request.rb +527 -0
  126. data/lib/seatschart/models/post_api_hold_tokens_by_token_request.rb +249 -0
  127. data/lib/seatschart/models/post_api_hold_tokens_request.rb +391 -0
  128. data/lib/seatschart/models/post_api_keys_request.rb +299 -0
  129. data/lib/seatschart/models/post_api_orders_by_order_id_cancel_request.rb +249 -0
  130. data/lib/seatschart/models/post_api_quotes_request.rb +351 -0
  131. data/lib/seatschart/models/post_api_seasons_by_season_id_actions_add_events_request.rb +261 -0
  132. data/lib/seatschart/models/post_api_seasons_by_season_id_actions_create_events_request.rb +322 -0
  133. data/lib/seatschart/models/post_api_seasons_by_season_id_actions_create_events_request_events_inner.rb +289 -0
  134. data/lib/seatschart/models/post_api_seasons_by_season_id_actions_remove_events_request.rb +251 -0
  135. data/lib/seatschart/models/post_api_seasons_by_season_id_events_request.rb +267 -0
  136. data/lib/seatschart/models/post_api_seasons_by_season_id_inventory_sync_request.rb +235 -0
  137. data/lib/seatschart/models/post_api_seasons_by_season_id_partial_seasons_request.rb +279 -0
  138. data/lib/seatschart/models/post_api_seasons_request.rb +395 -0
  139. data/lib/seatschart/models/post_api_seats_best_available_request.rb +809 -0
  140. data/lib/seatschart/models/post_api_seats_confirm409_response.rb +271 -0
  141. data/lib/seatschart/models/post_api_seats_confirm_request.rb +711 -0
  142. data/lib/seatschart/models/post_api_seats_holds_renew_request.rb +249 -0
  143. data/lib/seatschart/models/post_api_seats_release_request.rb +387 -0
  144. data/lib/seatschart/models/post_api_seats_reserve_request.rb +561 -0
  145. data/lib/seatschart/models/post_api_team_invitations_request.rb +299 -0
  146. data/lib/seatschart/models/post_api_ticket_buyers_request.rb +252 -0
  147. data/lib/seatschart/models/post_api_viewer_tokens_request.rb +292 -0
  148. data/lib/seatschart/models/post_api_webhooks_request.rb +298 -0
  149. data/lib/seatschart/models/post_api_workspaces_request.rb +269 -0
  150. data/lib/seatschart/models/put_api_charts_by_chart_id_tags_request.rb +243 -0
  151. data/lib/seatschart/models/put_api_charts_by_chart_id_versions_by_version_thumbnail_request.rb +261 -0
  152. data/lib/seatschart/models/put_api_events_by_event_id_inventory_channels_definitions_request.rb +242 -0
  153. data/lib/seatschart/models/put_api_events_by_event_id_inventory_channels_definitions_request_channels_inner.rb +405 -0
  154. data/lib/seatschart/models/put_api_events_by_event_id_inventory_channels_request.rb +242 -0
  155. data/lib/seatschart/models/put_api_events_by_event_id_inventory_channels_request_assignments_inner.rb +320 -0
  156. data/lib/seatschart/models/put_api_events_by_event_id_inventory_for_sale_request.rb +333 -0
  157. data/lib/seatschart/models/put_api_events_by_event_id_pricing_request.rb +297 -0
  158. data/lib/seatschart/models/put_api_events_by_event_id_pricing_request_categories_inner.rb +295 -0
  159. data/lib/seatschart/models/put_api_events_by_event_id_pricing_request_categories_inner_ticket_types_inner.rb +425 -0
  160. data/lib/seatschart/models/put_api_events_by_event_id_sales_rules_request.rb +320 -0
  161. data/lib/seatschart/models/put_api_events_by_event_id_sales_rules_request_buyer_limit.rb +259 -0
  162. data/lib/seatschart/models/put_api_events_by_event_id_sales_rules_request_lot_plans_inner.rb +374 -0
  163. data/lib/seatschart/models/put_api_events_by_event_id_sales_rules_request_lot_plans_inner_lots_inner.rb +364 -0
  164. data/lib/seatschart/models/put_api_events_by_event_id_sales_rules_request_quotas_inner.rb +418 -0
  165. data/lib/seatschart/retry.rb +118 -0
  166. data/lib/seatschart/version.rb +15 -0
  167. data/lib/seatschart.rb +198 -0
  168. metadata +254 -0
@@ -0,0 +1,418 @@
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 PutApiEventsByEventIdSalesRulesRequestQuotasInner
18
+ attr_accessor :id
19
+
20
+ attr_accessor :label
21
+
22
+ # Ticket type ids counted by this quota (e.g. [\"meia\"]).
23
+ attr_accessor :ticket_types
24
+
25
+ # Share of the event capacity (0.4 = 40%, Lei 12.933).
26
+ attr_accessor :max_share
27
+
28
+ # Absolute ticket count; with maxShare the lower limit applies.
29
+ attr_accessor :max_count
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'id' => :'id',
35
+ :'label' => :'label',
36
+ :'ticket_types' => :'ticketTypes',
37
+ :'max_share' => :'maxShare',
38
+ :'max_count' => :'maxCount'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'id' => :'String',
51
+ :'label' => :'String',
52
+ :'ticket_types' => :'Array<String>',
53
+ :'max_share' => :'Float',
54
+ :'max_count' => :'Integer'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PutApiEventsByEventIdSalesRulesRequestQuotasInner` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PutApiEventsByEventIdSalesRulesRequestQuotasInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'id')
80
+ self.id = attributes[:'id']
81
+ else
82
+ self.id = nil
83
+ end
84
+
85
+ if attributes.key?(:'label')
86
+ self.label = attributes[:'label']
87
+ else
88
+ self.label = nil
89
+ end
90
+
91
+ if attributes.key?(:'ticket_types')
92
+ if (value = attributes[:'ticket_types']).is_a?(Array)
93
+ self.ticket_types = value
94
+ end
95
+ else
96
+ self.ticket_types = nil
97
+ end
98
+
99
+ if attributes.key?(:'max_share')
100
+ self.max_share = attributes[:'max_share']
101
+ end
102
+
103
+ if attributes.key?(:'max_count')
104
+ self.max_count = attributes[:'max_count']
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ if @id.nil?
114
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
115
+ end
116
+
117
+ if @id.to_s.length > 64
118
+ invalid_properties.push('invalid value for "id", the character length must be smaller than or equal to 64.')
119
+ end
120
+
121
+ if @id.to_s.length < 1
122
+ invalid_properties.push('invalid value for "id", the character length must be great than or equal to 1.')
123
+ end
124
+
125
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/)
126
+ if @id !~ pattern
127
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
128
+ end
129
+
130
+ if @label.nil?
131
+ invalid_properties.push('invalid value for "label", label cannot be nil.')
132
+ end
133
+
134
+ if @label.to_s.length > 64
135
+ invalid_properties.push('invalid value for "label", the character length must be smaller than or equal to 64.')
136
+ end
137
+
138
+ if @label.to_s.length < 1
139
+ invalid_properties.push('invalid value for "label", the character length must be great than or equal to 1.')
140
+ end
141
+
142
+ if @ticket_types.nil?
143
+ invalid_properties.push('invalid value for "ticket_types", ticket_types cannot be nil.')
144
+ end
145
+
146
+ if @ticket_types.length > 16
147
+ invalid_properties.push('invalid value for "ticket_types", number of items must be less than or equal to 16.')
148
+ end
149
+
150
+ if @ticket_types.length < 1
151
+ invalid_properties.push('invalid value for "ticket_types", number of items must be greater than or equal to 1.')
152
+ end
153
+
154
+ if !@max_share.nil? && @max_share > 1
155
+ invalid_properties.push('invalid value for "max_share", must be smaller than or equal to 1.')
156
+ end
157
+
158
+ if !@max_count.nil? && @max_count > 1000000
159
+ invalid_properties.push('invalid value for "max_count", must be smaller than or equal to 1000000.')
160
+ end
161
+
162
+ if !@max_count.nil? && @max_count < 0
163
+ invalid_properties.push('invalid value for "max_count", must be greater than or equal to 0.')
164
+ end
165
+
166
+ invalid_properties
167
+ end
168
+
169
+ # Check to see if the all the properties in the model are valid
170
+ # @return true if the model is valid
171
+ def valid?
172
+ warn '[DEPRECATED] the `valid?` method is obsolete'
173
+ return false if @id.nil?
174
+ return false if @id.to_s.length > 64
175
+ return false if @id.to_s.length < 1
176
+ return false if @id !~ Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/)
177
+ return false if @label.nil?
178
+ return false if @label.to_s.length > 64
179
+ return false if @label.to_s.length < 1
180
+ return false if @ticket_types.nil?
181
+ return false if @ticket_types.length > 16
182
+ return false if @ticket_types.length < 1
183
+ return false if !@max_share.nil? && @max_share > 1
184
+ return false if !@max_count.nil? && @max_count > 1000000
185
+ return false if !@max_count.nil? && @max_count < 0
186
+ true
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] id Value to be assigned
191
+ def id=(id)
192
+ if id.nil?
193
+ fail ArgumentError, 'id cannot be nil'
194
+ end
195
+
196
+ if id.to_s.length > 64
197
+ fail ArgumentError, 'invalid value for "id", the character length must be smaller than or equal to 64.'
198
+ end
199
+
200
+ if id.to_s.length < 1
201
+ fail ArgumentError, 'invalid value for "id", the character length must be great than or equal to 1.'
202
+ end
203
+
204
+ pattern = Regexp.new(/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/)
205
+ if id !~ pattern
206
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
207
+ end
208
+
209
+ @id = id
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] label Value to be assigned
214
+ def label=(label)
215
+ if label.nil?
216
+ fail ArgumentError, 'label cannot be nil'
217
+ end
218
+
219
+ if label.to_s.length > 64
220
+ fail ArgumentError, 'invalid value for "label", the character length must be smaller than or equal to 64.'
221
+ end
222
+
223
+ if label.to_s.length < 1
224
+ fail ArgumentError, 'invalid value for "label", the character length must be great than or equal to 1.'
225
+ end
226
+
227
+ @label = label
228
+ end
229
+
230
+ # Custom attribute writer method with validation
231
+ # @param [Object] ticket_types Value to be assigned
232
+ def ticket_types=(ticket_types)
233
+ if ticket_types.nil?
234
+ fail ArgumentError, 'ticket_types cannot be nil'
235
+ end
236
+
237
+ if ticket_types.length > 16
238
+ fail ArgumentError, 'invalid value for "ticket_types", number of items must be less than or equal to 16.'
239
+ end
240
+
241
+ if ticket_types.length < 1
242
+ fail ArgumentError, 'invalid value for "ticket_types", number of items must be greater than or equal to 1.'
243
+ end
244
+
245
+ @ticket_types = ticket_types
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] max_share Value to be assigned
250
+ def max_share=(max_share)
251
+ if max_share.nil?
252
+ fail ArgumentError, 'max_share cannot be nil'
253
+ end
254
+
255
+ if max_share > 1
256
+ fail ArgumentError, 'invalid value for "max_share", must be smaller than or equal to 1.'
257
+ end
258
+
259
+ @max_share = max_share
260
+ end
261
+
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] max_count Value to be assigned
264
+ def max_count=(max_count)
265
+ if max_count.nil?
266
+ fail ArgumentError, 'max_count cannot be nil'
267
+ end
268
+
269
+ if max_count > 1000000
270
+ fail ArgumentError, 'invalid value for "max_count", must be smaller than or equal to 1000000.'
271
+ end
272
+
273
+ if max_count < 0
274
+ fail ArgumentError, 'invalid value for "max_count", must be greater than or equal to 0.'
275
+ end
276
+
277
+ @max_count = max_count
278
+ end
279
+
280
+ # Checks equality by comparing each attribute.
281
+ # @param [Object] Object to be compared
282
+ def ==(o)
283
+ return true if self.equal?(o)
284
+ self.class == o.class &&
285
+ id == o.id &&
286
+ label == o.label &&
287
+ ticket_types == o.ticket_types &&
288
+ max_share == o.max_share &&
289
+ max_count == o.max_count
290
+ end
291
+
292
+ # @see the `==` method
293
+ # @param [Object] Object to be compared
294
+ def eql?(o)
295
+ self == o
296
+ end
297
+
298
+ # Calculates hash code according to all attributes.
299
+ # @return [Integer] Hash code
300
+ def hash
301
+ [id, label, ticket_types, max_share, max_count].hash
302
+ end
303
+
304
+ # Builds the object from hash
305
+ # @param [Hash] attributes Model attributes in the form of hash
306
+ # @return [Object] Returns the model itself
307
+ def self.build_from_hash(attributes)
308
+ return nil unless attributes.is_a?(Hash)
309
+ attributes = attributes.transform_keys(&:to_sym)
310
+ transformed_hash = {}
311
+ openapi_types.each_pair do |key, type|
312
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
313
+ transformed_hash["#{key}"] = nil
314
+ elsif type =~ /\AArray<(.*)>/i
315
+ # check to ensure the input is an array given that the attribute
316
+ # is documented as an array but the input is not
317
+ if attributes[attribute_map[key]].is_a?(Array)
318
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
319
+ end
320
+ elsif !attributes[attribute_map[key]].nil?
321
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
322
+ end
323
+ end
324
+ new(transformed_hash)
325
+ end
326
+
327
+ # Deserializes the data based on type
328
+ # @param string type Data type
329
+ # @param string value Value to be deserialized
330
+ # @return [Object] Deserialized data
331
+ def self._deserialize(type, value)
332
+ case type.to_sym
333
+ when :Time
334
+ Time.parse(value)
335
+ when :Date
336
+ Date.parse(value)
337
+ when :String
338
+ value.to_s
339
+ when :Integer
340
+ value.to_i
341
+ when :Float
342
+ value.to_f
343
+ when :Boolean
344
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
345
+ true
346
+ else
347
+ false
348
+ end
349
+ when :Object
350
+ # generic object (usually a Hash), return directly
351
+ value
352
+ when /\AArray<(?<inner_type>.+)>\z/
353
+ inner_type = Regexp.last_match[:inner_type]
354
+ value.map { |v| _deserialize(inner_type, v) }
355
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
356
+ k_type = Regexp.last_match[:k_type]
357
+ v_type = Regexp.last_match[:v_type]
358
+ {}.tap do |hash|
359
+ value.each do |k, v|
360
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
361
+ end
362
+ end
363
+ else # model
364
+ # models (e.g. Pet) or oneOf
365
+ klass = SeatsChart.const_get(type)
366
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
367
+ end
368
+ end
369
+
370
+ # Returns the string representation of the object
371
+ # @return [String] String presentation of the object
372
+ def to_s
373
+ to_hash.to_s
374
+ end
375
+
376
+ # to_body is an alias to to_hash (backward compatibility)
377
+ # @return [Hash] Returns the object in the form of hash
378
+ def to_body
379
+ to_hash
380
+ end
381
+
382
+ # Returns the object in the form of hash
383
+ # @return [Hash] Returns the object in the form of hash
384
+ def to_hash
385
+ hash = {}
386
+ self.class.attribute_map.each_pair do |attr, param|
387
+ value = self.send(attr)
388
+ if value.nil?
389
+ is_nullable = self.class.openapi_nullable.include?(attr)
390
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
391
+ end
392
+
393
+ hash[param] = _to_hash(value)
394
+ end
395
+ hash
396
+ end
397
+
398
+ # Outputs non-array value in the form of hash
399
+ # For object, use to_hash. Otherwise, just return the value
400
+ # @param [Object] value Any valid value
401
+ # @return [Hash] Returns the value in the form of hash
402
+ def _to_hash(value)
403
+ if value.is_a?(Array)
404
+ value.compact.map { |v| _to_hash(v) }
405
+ elsif value.is_a?(Hash)
406
+ {}.tap do |hash|
407
+ value.each { |k, v| hash[k] = _to_hash(v) }
408
+ end
409
+ elsif value.respond_to? :to_hash
410
+ value.to_hash
411
+ else
412
+ value
413
+ end
414
+ end
415
+
416
+ end
417
+
418
+ end
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Retry and idempotency helpers for the SeatsChart Ruby client.
4
+ # Copied into the generated gem (lib/seatschart/retry.rb) and required from lib/seatschart.rb by
5
+ # scripts/generate-server-sdks.sh.
6
+ #
7
+ # Throttled (429) and unavailable (503) responses are retried with exponential backoff and full jitter,
8
+ # honouring Retry-After. Only requests that are safe to repeat are retried: idempotent methods (GET, HEAD,
9
+ # OPTIONS, PUT, DELETE) and requests carrying an Idempotency-Key header, which is resent unchanged so the
10
+ # API replays the stored outcome instead of applying it twice.
11
+ #
12
+ # SeatsChart.configure { |c| c.api_key['x-api-key'] = ENV['SEATSCHART_KEY'] }
13
+ # SeatsChart::Retry.policy = SeatsChart::Retry::Policy.new(max_attempts: 5) # optional
14
+ # api.reserve(body, header_params: SeatsChart::Retry.idempotency_headers('order-42'))
15
+ require 'securerandom'
16
+ require 'time'
17
+
18
+ module SeatsChart
19
+ module Retry
20
+ IDEMPOTENCY_KEY_HEADER = 'Idempotency-Key'
21
+ IDEMPOTENT_METHODS = %w[GET HEAD OPTIONS PUT DELETE].freeze
22
+
23
+ # A fresh key for one logical operation; reuse it for every retry of that operation.
24
+ def self.new_idempotency_key
25
+ SecureRandom.uuid
26
+ end
27
+
28
+ def self.idempotency_headers(key = nil)
29
+ { IDEMPOTENCY_KEY_HEADER => key || new_idempotency_key }
30
+ end
31
+
32
+ def self.retry_safe?(method, headers)
33
+ return true if IDEMPOTENT_METHODS.include?(method.to_s.upcase)
34
+
35
+ (headers || {}).any? { |name, value| name.to_s.casecmp?('idempotency-key') && !value.to_s.strip.empty? }
36
+ end
37
+
38
+ # Retry-After in seconds (delta-seconds or HTTP date); nil when absent or invalid.
39
+ def self.parse_retry_after(value, now = Time.now)
40
+ return nil if value.nil? || value.to_s.strip.empty?
41
+
42
+ raw = value.to_s.strip
43
+ return Float(raw) if raw.match?(/\A\d+(\.\d+)?\z/)
44
+
45
+ [Time.httpdate(raw) - now, 0.0].max
46
+ rescue ArgumentError
47
+ nil
48
+ end
49
+
50
+ def self.header(headers, name)
51
+ return nil if headers.nil?
52
+
53
+ pair = headers.to_h.find { |k, _| k.to_s.casecmp?(name) }
54
+ value = pair && pair[1]
55
+ value.is_a?(Array) ? value.first : value
56
+ end
57
+
58
+ class Policy
59
+ attr_reader :max_attempts, :base_delay, :max_delay, :max_retry_after, :statuses
60
+
61
+ def initialize(max_attempts: 4, base_delay: 0.25, max_delay: 8.0, max_retry_after: 30.0, statuses: [429, 503],
62
+ sleeper: ->(seconds) { sleep(seconds) }, random: -> { rand })
63
+ raise ArgumentError, 'max_attempts must be >= 1' if max_attempts < 1
64
+
65
+ @max_attempts = max_attempts
66
+ @base_delay = base_delay
67
+ @max_delay = max_delay
68
+ @max_retry_after = max_retry_after
69
+ @statuses = statuses
70
+ @sleeper = sleeper
71
+ @random = random
72
+ end
73
+
74
+ # Seconds to wait before retry number attempt (1-based); nil when Retry-After is too long.
75
+ def delay(attempt, retry_after)
76
+ return(retry_after > max_retry_after ? nil : retry_after) unless retry_after.nil?
77
+
78
+ ceiling = [max_delay, base_delay * (2**[attempt - 1, 0].max)].min
79
+ @random.call * ceiling
80
+ end
81
+
82
+ def wait(seconds)
83
+ @sleeper.call(seconds)
84
+ end
85
+ end
86
+
87
+ class << self
88
+ attr_writer :policy
89
+
90
+ def policy
91
+ @policy ||= Policy.new
92
+ end
93
+ end
94
+
95
+ # Prepended to the generated ApiClient: repeats call_api on retryable ApiErrors.
96
+ module ApiClientExtension
97
+ def call_api(http_method, path, opts = {})
98
+ policy = SeatsChart::Retry.policy
99
+ attempt = 1
100
+ begin
101
+ super
102
+ rescue SeatsChart::ApiError => e
103
+ raise unless attempt < policy.max_attempts && policy.statuses.include?(e.code.to_i) &&
104
+ SeatsChart::Retry.retry_safe?(http_method, opts[:header_params])
105
+
106
+ wait = policy.delay(attempt, SeatsChart::Retry.parse_retry_after(SeatsChart::Retry.header(e.response_headers, 'Retry-After')))
107
+ raise if wait.nil?
108
+
109
+ policy.wait(wait)
110
+ attempt += 1
111
+ retry
112
+ end
113
+ end
114
+ end
115
+ end
116
+
117
+ ApiClient.prepend(Retry::ApiClientExtension) if const_defined?(:ApiClient)
118
+ end
@@ -0,0 +1,15 @@
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
+ module SeatsChart
14
+ VERSION = '0.1.0'
15
+ end