stormgate_world 1.0.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 (137) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +141 -0
  4. data/Rakefile +10 -0
  5. data/docs/ErrorResponse.md +26 -0
  6. data/docs/Leaderboard.md +15 -0
  7. data/docs/LeaderboardDumpResponse.md +22 -0
  8. data/docs/LeaderboardEntriesApi.md +70 -0
  9. data/docs/LeaderboardEntryHistory.md +18 -0
  10. data/docs/LeaderboardEntryHistoryEntry.md +24 -0
  11. data/docs/LeaderboardEntryResponse.md +52 -0
  12. data/docs/LeaderboardOrder.md +15 -0
  13. data/docs/LeaderboardResponse.md +24 -0
  14. data/docs/LeaderboardsApi.md +140 -0
  15. data/docs/MatchParticipantPlayerLeaderboardEntryResponse.md +32 -0
  16. data/docs/MatchParticipantPlayerResponse.md +22 -0
  17. data/docs/MatchParticipantResponse.md +38 -0
  18. data/docs/MatchResponse.md +34 -0
  19. data/docs/MatchResult.md +15 -0
  20. data/docs/MatchState.md +15 -0
  21. data/docs/MatchesApi.md +76 -0
  22. data/docs/MatchesResponse.md +24 -0
  23. data/docs/PlayerActivityStats.md +24 -0
  24. data/docs/PlayerActivityStatsRace.md +20 -0
  25. data/docs/PlayerMatchesResponse.md +22 -0
  26. data/docs/PlayerMatchupsStats.md +20 -0
  27. data/docs/PlayerMatchupsStatsEntry.md +34 -0
  28. data/docs/PlayerMatchupsStatsMatchup.md +24 -0
  29. data/docs/PlayerOpponentsStats.md +22 -0
  30. data/docs/PlayerOpponentsStatsOpponent.md +34 -0
  31. data/docs/PlayerPreferences.md +18 -0
  32. data/docs/PlayerResponse.md +28 -0
  33. data/docs/PlayerStatsEntry.md +36 -0
  34. data/docs/PlayerStatsEntryAggregated.md +34 -0
  35. data/docs/PlayerStatsEntryNumBreakdown.md +24 -0
  36. data/docs/PlayersApi.md +531 -0
  37. data/docs/ProfilePrivacy.md +15 -0
  38. data/docs/Race.md +15 -0
  39. data/docs/StatisticsApi.md +72 -0
  40. data/docs/StatsByTime.md +30 -0
  41. data/docs/StatsByTimeEntry.md +22 -0
  42. data/docs/StatsByTimeHistoryPoint.md +34 -0
  43. data/docs/StatsByTimeMatchLength.md +20 -0
  44. data/docs/StatsByTimeMatchLengthEntry.md +28 -0
  45. data/git_push.sh +57 -0
  46. data/lib/stormgate_world/api/leaderboard_entries_api.rb +81 -0
  47. data/lib/stormgate_world/api/leaderboards_api.rb +151 -0
  48. data/lib/stormgate_world/api/matches_api.rb +92 -0
  49. data/lib/stormgate_world/api/players_api.rb +512 -0
  50. data/lib/stormgate_world/api/statistics_api.rb +78 -0
  51. data/lib/stormgate_world/api_client.rb +394 -0
  52. data/lib/stormgate_world/api_error.rb +58 -0
  53. data/lib/stormgate_world/configuration.rb +298 -0
  54. data/lib/stormgate_world/models/error_response.rb +289 -0
  55. data/lib/stormgate_world/models/leaderboard.rb +41 -0
  56. data/lib/stormgate_world/models/leaderboard_dump_response.rb +274 -0
  57. data/lib/stormgate_world/models/leaderboard_entry_history.rb +223 -0
  58. data/lib/stormgate_world/models/leaderboard_entry_history_entry.rb +257 -0
  59. data/lib/stormgate_world/models/leaderboard_entry_response.rb +461 -0
  60. data/lib/stormgate_world/models/leaderboard_order.rb +40 -0
  61. data/lib/stormgate_world/models/leaderboard_response.rb +328 -0
  62. data/lib/stormgate_world/models/match_participant_player_leaderboard_entry_response.rb +309 -0
  63. data/lib/stormgate_world/models/match_participant_player_response.rb +241 -0
  64. data/lib/stormgate_world/models/match_participant_response.rb +361 -0
  65. data/lib/stormgate_world/models/match_response.rb +355 -0
  66. data/lib/stormgate_world/models/match_result.rb +41 -0
  67. data/lib/stormgate_world/models/match_state.rb +40 -0
  68. data/lib/stormgate_world/models/matches_response.rb +328 -0
  69. data/lib/stormgate_world/models/player_activity_stats.rb +267 -0
  70. data/lib/stormgate_world/models/player_activity_stats_race.rb +233 -0
  71. data/lib/stormgate_world/models/player_matches_response.rb +293 -0
  72. data/lib/stormgate_world/models/player_matchups_stats.rb +239 -0
  73. data/lib/stormgate_world/models/player_matchups_stats_entry.rb +337 -0
  74. data/lib/stormgate_world/models/player_matchups_stats_matchup.rb +293 -0
  75. data/lib/stormgate_world/models/player_opponents_stats.rb +274 -0
  76. data/lib/stormgate_world/models/player_opponents_stats_opponent.rb +343 -0
  77. data/lib/stormgate_world/models/player_preferences.rb +237 -0
  78. data/lib/stormgate_world/models/player_response.rb +285 -0
  79. data/lib/stormgate_world/models/player_stats_entry.rb +369 -0
  80. data/lib/stormgate_world/models/player_stats_entry_aggregated.rb +343 -0
  81. data/lib/stormgate_world/models/player_stats_entry_num_breakdown.rb +245 -0
  82. data/lib/stormgate_world/models/profile_privacy.rb +40 -0
  83. data/lib/stormgate_world/models/race.rb +41 -0
  84. data/lib/stormgate_world/models/stats_by_time.rb +332 -0
  85. data/lib/stormgate_world/models/stats_by_time_entry.rb +277 -0
  86. data/lib/stormgate_world/models/stats_by_time_history_point.rb +303 -0
  87. data/lib/stormgate_world/models/stats_by_time_match_length.rb +239 -0
  88. data/lib/stormgate_world/models/stats_by_time_match_length_entry.rb +265 -0
  89. data/lib/stormgate_world/version.rb +15 -0
  90. data/lib/stormgate_world.rb +79 -0
  91. data/openapitools.json +7 -0
  92. data/pkg/stormgate_world_client-1.0.0.gem +0 -0
  93. data/spec/api/leaderboard_entries_api_spec.rb +45 -0
  94. data/spec/api/leaderboards_api_spec.rb +58 -0
  95. data/spec/api/matches_api_spec.rb +47 -0
  96. data/spec/api/players_api_spec.rb +117 -0
  97. data/spec/api/statistics_api_spec.rb +45 -0
  98. data/spec/models/error_response_spec.rb +60 -0
  99. data/spec/models/leaderboard_dump_response_spec.rb +48 -0
  100. data/spec/models/leaderboard_entry_history_entry_spec.rb +54 -0
  101. data/spec/models/leaderboard_entry_history_spec.rb +36 -0
  102. data/spec/models/leaderboard_entry_response_spec.rb +138 -0
  103. data/spec/models/leaderboard_order_spec.rb +30 -0
  104. data/spec/models/leaderboard_response_spec.rb +54 -0
  105. data/spec/models/leaderboard_spec.rb +30 -0
  106. data/spec/models/match_participant_player_leaderboard_entry_response_spec.rb +78 -0
  107. data/spec/models/match_participant_player_response_spec.rb +48 -0
  108. data/spec/models/match_participant_response_spec.rb +96 -0
  109. data/spec/models/match_response_spec.rb +84 -0
  110. data/spec/models/match_result_spec.rb +30 -0
  111. data/spec/models/match_state_spec.rb +30 -0
  112. data/spec/models/matches_response_spec.rb +54 -0
  113. data/spec/models/player_activity_stats_race_spec.rb +42 -0
  114. data/spec/models/player_activity_stats_spec.rb +54 -0
  115. data/spec/models/player_matches_response_spec.rb +48 -0
  116. data/spec/models/player_matchups_stats_entry_spec.rb +84 -0
  117. data/spec/models/player_matchups_stats_matchup_spec.rb +54 -0
  118. data/spec/models/player_matchups_stats_spec.rb +42 -0
  119. data/spec/models/player_opponents_stats_opponent_spec.rb +84 -0
  120. data/spec/models/player_opponents_stats_spec.rb +48 -0
  121. data/spec/models/player_preferences_spec.rb +36 -0
  122. data/spec/models/player_response_spec.rb +66 -0
  123. data/spec/models/player_stats_entry_aggregated_spec.rb +84 -0
  124. data/spec/models/player_stats_entry_num_breakdown_spec.rb +54 -0
  125. data/spec/models/player_stats_entry_spec.rb +90 -0
  126. data/spec/models/profile_privacy_spec.rb +30 -0
  127. data/spec/models/race_spec.rb +30 -0
  128. data/spec/models/stats_by_time_entry_spec.rb +48 -0
  129. data/spec/models/stats_by_time_history_point_spec.rb +84 -0
  130. data/spec/models/stats_by_time_match_length_entry_spec.rb +66 -0
  131. data/spec/models/stats_by_time_match_length_spec.rb +42 -0
  132. data/spec/models/stats_by_time_spec.rb +72 -0
  133. data/spec/spec_helper.rb +111 -0
  134. data/stormgate_world.gemspec +40 -0
  135. data/stormgate_world.json +1 -0
  136. data/update.sh +4 -0
  137. metadata +260 -0
@@ -0,0 +1,298 @@
1
+ =begin
2
+ #api
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ module StormgateWorld
14
+ class Configuration
15
+ # Defines url scheme
16
+ attr_accessor :scheme
17
+
18
+ # Defines url host
19
+ attr_accessor :host
20
+
21
+ # Defines url base path
22
+ attr_accessor :base_path
23
+
24
+ # Define server configuration index
25
+ attr_accessor :server_index
26
+
27
+ # Define server operation configuration index
28
+ attr_accessor :server_operation_index
29
+
30
+ # Default server variables
31
+ attr_accessor :server_variables
32
+
33
+ # Default server operation variables
34
+ attr_accessor :server_operation_variables
35
+
36
+ # Defines API keys used with API Key authentications.
37
+ #
38
+ # @return [Hash] key: parameter name, value: parameter value (API key)
39
+ #
40
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
41
+ # config.api_key['api_key'] = 'xxx'
42
+ attr_accessor :api_key
43
+
44
+ # Defines API key prefixes used with API Key authentications.
45
+ #
46
+ # @return [Hash] key: parameter name, value: API key prefix
47
+ #
48
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
49
+ # config.api_key_prefix['api_key'] = 'Token'
50
+ attr_accessor :api_key_prefix
51
+
52
+ # Defines the username used with HTTP basic authentication.
53
+ #
54
+ # @return [String]
55
+ attr_accessor :username
56
+
57
+ # Defines the password used with HTTP basic authentication.
58
+ #
59
+ # @return [String]
60
+ attr_accessor :password
61
+
62
+ # Defines the access token (Bearer) used with OAuth2.
63
+ attr_accessor :access_token
64
+
65
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
66
+ # Overrides the access_token if set
67
+ # @return [Proc]
68
+ attr_accessor :access_token_getter
69
+
70
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
71
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
72
+ # Default to false.
73
+ attr_accessor :return_binary_data
74
+
75
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
76
+ # details will be logged with `logger.debug` (see the `logger` attribute).
77
+ # Default to false.
78
+ #
79
+ # @return [true, false]
80
+ attr_accessor :debugging
81
+
82
+ # Defines the logger used for debugging.
83
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
84
+ #
85
+ # @return [#debug]
86
+ attr_accessor :logger
87
+
88
+ # Defines the temporary folder to store downloaded files
89
+ # (for API endpoints that have file response).
90
+ # Default to use `Tempfile`.
91
+ #
92
+ # @return [String]
93
+ attr_accessor :temp_folder_path
94
+
95
+ # The time limit for HTTP request in seconds.
96
+ # Default to 0 (never times out).
97
+ attr_accessor :timeout
98
+
99
+ # Set this to false to skip client side validation in the operation.
100
+ # Default to true.
101
+ # @return [true, false]
102
+ attr_accessor :client_side_validation
103
+
104
+ ### TLS/SSL setting
105
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
106
+ # Default to true.
107
+ #
108
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
109
+ #
110
+ # @return [true, false]
111
+ attr_accessor :verify_ssl
112
+
113
+ ### TLS/SSL setting
114
+ # Set this to false to skip verifying SSL host name
115
+ # Default to true.
116
+ #
117
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
118
+ #
119
+ # @return [true, false]
120
+ attr_accessor :verify_ssl_host
121
+
122
+ ### TLS/SSL setting
123
+ # Set this to customize the certificate file to verify the peer.
124
+ #
125
+ # @return [String] the path to the certificate file
126
+ #
127
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
128
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
129
+ attr_accessor :ssl_ca_cert
130
+
131
+ ### TLS/SSL setting
132
+ # Client certificate file (for client certificate)
133
+ attr_accessor :cert_file
134
+
135
+ ### TLS/SSL setting
136
+ # Client private key file (for client certificate)
137
+ attr_accessor :key_file
138
+
139
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
140
+ # Default to nil.
141
+ #
142
+ # @see The params_encoding option of Ethon. Related source code:
143
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
144
+ attr_accessor :params_encoding
145
+
146
+
147
+ attr_accessor :inject_format
148
+
149
+ attr_accessor :force_ending_format
150
+
151
+ def initialize
152
+ @scheme = 'https'
153
+ @host = 'api.stormgateworld.com'
154
+ @base_path = ''
155
+ @server_index = nil
156
+ @server_operation_index = {}
157
+ @server_variables = {}
158
+ @server_operation_variables = {}
159
+ @api_key = {}
160
+ @api_key_prefix = {}
161
+ @client_side_validation = true
162
+ @verify_ssl = true
163
+ @verify_ssl_host = true
164
+ @cert_file = nil
165
+ @key_file = nil
166
+ @timeout = 0
167
+ @params_encoding = nil
168
+ @debugging = false
169
+ @inject_format = false
170
+ @force_ending_format = false
171
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
172
+
173
+ yield(self) if block_given?
174
+ end
175
+
176
+ # The default Configuration object.
177
+ def self.default
178
+ @@default ||= Configuration.new
179
+ end
180
+
181
+ def configure
182
+ yield(self) if block_given?
183
+ end
184
+
185
+ def scheme=(scheme)
186
+ # remove :// from scheme
187
+ @scheme = scheme.sub(/:\/\//, '')
188
+ end
189
+
190
+ def host=(host)
191
+ # remove http(s):// and anything after a slash
192
+ @host = host.sub(/https?:\/\//, '').split('/').first
193
+ end
194
+
195
+ def base_path=(base_path)
196
+ # Add leading and trailing slashes to base_path
197
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
198
+ @base_path = '' if @base_path == '/'
199
+ end
200
+
201
+ # Returns base URL for specified operation based on server settings
202
+ def base_url(operation = nil)
203
+ if operation_server_settings.key?(operation) then
204
+ index = server_operation_index.fetch(operation, server_index)
205
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
206
+ else
207
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
208
+ end
209
+ end
210
+
211
+ # Gets API key (with prefix if set).
212
+ # @param [String] param_name the parameter name of API key auth
213
+ def api_key_with_prefix(param_name, param_alias = nil)
214
+ key = @api_key[param_name]
215
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
216
+ if @api_key_prefix[param_name]
217
+ "#{@api_key_prefix[param_name]} #{key}"
218
+ else
219
+ key
220
+ end
221
+ end
222
+
223
+ # Gets access_token using access_token_getter or uses the static access_token
224
+ def access_token_with_refresh
225
+ return access_token if access_token_getter.nil?
226
+ access_token_getter.call
227
+ end
228
+
229
+ # Gets Basic Auth token string
230
+ def basic_auth_token
231
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
232
+ end
233
+
234
+ # Returns Auth Settings hash for api client.
235
+ def auth_settings
236
+ {
237
+ 'api_key' =>
238
+ {
239
+ type: 'api_key',
240
+ in: 'header',
241
+ key: 'api-key',
242
+ value: api_key_with_prefix('api_key')
243
+ },
244
+ }
245
+ end
246
+
247
+ # Returns an array of Server setting
248
+ def server_settings
249
+ [
250
+ {
251
+ url: "https://api.stormgateworld.com",
252
+ description: "No description provided",
253
+ }
254
+ ]
255
+ end
256
+
257
+ def operation_server_settings
258
+ {
259
+ }
260
+ end
261
+
262
+ # Returns URL based on server settings
263
+ #
264
+ # @param index array index of the server settings
265
+ # @param variables hash of variable and the corresponding value
266
+ def server_url(index, variables = {}, servers = nil)
267
+ servers = server_settings if servers == nil
268
+
269
+ # check array index out of bound
270
+ if (index.nil? || index < 0 || index >= servers.size)
271
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
272
+ end
273
+
274
+ server = servers[index]
275
+ url = server[:url]
276
+
277
+ return url unless server.key? :variables
278
+
279
+ # go through variable and assign a value
280
+ server[:variables].each do |name, variable|
281
+ if variables.key?(name)
282
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
283
+ url.gsub! "{" + name.to_s + "}", variables[name]
284
+ else
285
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
286
+ end
287
+ else
288
+ # use default value
289
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
290
+ end
291
+ end
292
+
293
+ url
294
+ end
295
+
296
+
297
+ end
298
+ end
@@ -0,0 +1,289 @@
1
+ =begin
2
+ #api
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module StormgateWorld
17
+ class ErrorResponse
18
+ attr_accessor :code
19
+
20
+ attr_accessor :error
21
+
22
+ attr_accessor :full_error
23
+
24
+ attr_accessor :backtrace
25
+
26
+ attr_accessor :full_backtrace
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'code' => :'code',
32
+ :'error' => :'error',
33
+ :'full_error' => :'full_error',
34
+ :'backtrace' => :'backtrace',
35
+ :'full_backtrace' => :'full_backtrace'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'code' => :'Integer',
48
+ :'error' => :'String',
49
+ :'full_error' => :'Array<String>',
50
+ :'backtrace' => :'Array<String>',
51
+ :'full_backtrace' => :'Array<String>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StormgateWorld::ErrorResponse` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StormgateWorld::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'code')
77
+ self.code = attributes[:'code']
78
+ else
79
+ self.code = nil
80
+ end
81
+
82
+ if attributes.key?(:'error')
83
+ self.error = attributes[:'error']
84
+ else
85
+ self.error = nil
86
+ end
87
+
88
+ if attributes.key?(:'full_error')
89
+ if (value = attributes[:'full_error']).is_a?(Array)
90
+ self.full_error = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'backtrace')
95
+ if (value = attributes[:'backtrace']).is_a?(Array)
96
+ self.backtrace = value
97
+ end
98
+ end
99
+
100
+ if attributes.key?(:'full_backtrace')
101
+ if (value = attributes[:'full_backtrace']).is_a?(Array)
102
+ self.full_backtrace = value
103
+ end
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @code.nil?
113
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
114
+ end
115
+
116
+ if @code < 0
117
+ invalid_properties.push('invalid value for "code", must be greater than or equal to 0.')
118
+ end
119
+
120
+ if @error.nil?
121
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ return false if @code.nil?
132
+ return false if @code < 0
133
+ return false if @error.nil?
134
+ true
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] code Value to be assigned
139
+ def code=(code)
140
+ if code.nil?
141
+ fail ArgumentError, 'code cannot be nil'
142
+ end
143
+
144
+ if code < 0
145
+ fail ArgumentError, 'invalid value for "code", must be greater than or equal to 0.'
146
+ end
147
+
148
+ @code = code
149
+ end
150
+
151
+ # Checks equality by comparing each attribute.
152
+ # @param [Object] Object to be compared
153
+ def ==(o)
154
+ return true if self.equal?(o)
155
+ self.class == o.class &&
156
+ code == o.code &&
157
+ error == o.error &&
158
+ full_error == o.full_error &&
159
+ backtrace == o.backtrace &&
160
+ full_backtrace == o.full_backtrace
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Integer] Hash code
171
+ def hash
172
+ [code, error, full_error, backtrace, full_backtrace].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ attributes = attributes.transform_keys(&:to_sym)
181
+ transformed_hash = {}
182
+ openapi_types.each_pair do |key, type|
183
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
184
+ transformed_hash["#{key}"] = nil
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[attribute_map[key]].is_a?(Array)
189
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
190
+ end
191
+ elsif !attributes[attribute_map[key]].nil?
192
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
193
+ end
194
+ end
195
+ new(transformed_hash)
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def self._deserialize(type, value)
203
+ case type.to_sym
204
+ when :Time
205
+ Time.parse(value)
206
+ when :Date
207
+ Date.parse(value)
208
+ when :String
209
+ value.to_s
210
+ when :Integer
211
+ value.to_i
212
+ when :Float
213
+ value.to_f
214
+ when :Boolean
215
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
216
+ true
217
+ else
218
+ false
219
+ end
220
+ when :Object
221
+ # generic object (usually a Hash), return directly
222
+ value
223
+ when /\AArray<(?<inner_type>.+)>\z/
224
+ inner_type = Regexp.last_match[:inner_type]
225
+ value.map { |v| _deserialize(inner_type, v) }
226
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
+ k_type = Regexp.last_match[:k_type]
228
+ v_type = Regexp.last_match[:v_type]
229
+ {}.tap do |hash|
230
+ value.each do |k, v|
231
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
+ end
233
+ end
234
+ else # model
235
+ # models (e.g. Pet) or oneOf
236
+ klass = StormgateWorld.const_get(type)
237
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
238
+ end
239
+ end
240
+
241
+ # Returns the string representation of the object
242
+ # @return [String] String presentation of the object
243
+ def to_s
244
+ to_hash.to_s
245
+ end
246
+
247
+ # to_body is an alias to to_hash (backward compatibility)
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_body
250
+ to_hash
251
+ end
252
+
253
+ # Returns the object in the form of hash
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_hash
256
+ hash = {}
257
+ self.class.attribute_map.each_pair do |attr, param|
258
+ value = self.send(attr)
259
+ if value.nil?
260
+ is_nullable = self.class.openapi_nullable.include?(attr)
261
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
262
+ end
263
+
264
+ hash[param] = _to_hash(value)
265
+ end
266
+ hash
267
+ end
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to? :to_hash
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+
287
+ end
288
+
289
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #api
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 0.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module StormgateWorld
17
+ class Leaderboard
18
+ RANKED_1V1 = "ranked_1v1".freeze
19
+ UNRANKED_1V1 = "unranked_1v1".freeze
20
+ CUSTOM = "custom".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [RANKED_1V1, UNRANKED_1V1, CUSTOM].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if Leaderboard.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #Leaderboard"
39
+ end
40
+ end
41
+ end