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,40 @@
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 LeaderboardOrder
18
+ POINTS = "points".freeze
19
+ MMR = "mmr".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [POINTS, MMR].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if LeaderboardOrder.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #LeaderboardOrder"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,328 @@
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 LeaderboardResponse
18
+ attr_accessor :page
19
+
20
+ attr_accessor :count
21
+
22
+ attr_accessor :total
23
+
24
+ attr_accessor :entries
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'page' => :'page',
30
+ :'count' => :'count',
31
+ :'total' => :'total',
32
+ :'entries' => :'entries'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'page' => :'Integer',
45
+ :'count' => :'Integer',
46
+ :'total' => :'Integer',
47
+ :'entries' => :'Array<LeaderboardEntryResponse>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StormgateWorld::LeaderboardResponse` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StormgateWorld::LeaderboardResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'page')
73
+ self.page = attributes[:'page']
74
+ else
75
+ self.page = nil
76
+ end
77
+
78
+ if attributes.key?(:'count')
79
+ self.count = attributes[:'count']
80
+ else
81
+ self.count = nil
82
+ end
83
+
84
+ if attributes.key?(:'total')
85
+ self.total = attributes[:'total']
86
+ else
87
+ self.total = nil
88
+ end
89
+
90
+ if attributes.key?(:'entries')
91
+ if (value = attributes[:'entries']).is_a?(Array)
92
+ self.entries = value
93
+ end
94
+ else
95
+ self.entries = nil
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @page.nil?
105
+ invalid_properties.push('invalid value for "page", page cannot be nil.')
106
+ end
107
+
108
+ if @page < 0
109
+ invalid_properties.push('invalid value for "page", must be greater than or equal to 0.')
110
+ end
111
+
112
+ if @count.nil?
113
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
114
+ end
115
+
116
+ if @count < 0
117
+ invalid_properties.push('invalid value for "count", must be greater than or equal to 0.')
118
+ end
119
+
120
+ if @total.nil?
121
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
122
+ end
123
+
124
+ if @total < 0
125
+ invalid_properties.push('invalid value for "total", must be greater than or equal to 0.')
126
+ end
127
+
128
+ if @entries.nil?
129
+ invalid_properties.push('invalid value for "entries", entries cannot be nil.')
130
+ end
131
+
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ warn '[DEPRECATED] the `valid?` method is obsolete'
139
+ return false if @page.nil?
140
+ return false if @page < 0
141
+ return false if @count.nil?
142
+ return false if @count < 0
143
+ return false if @total.nil?
144
+ return false if @total < 0
145
+ return false if @entries.nil?
146
+ true
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] page Value to be assigned
151
+ def page=(page)
152
+ if page.nil?
153
+ fail ArgumentError, 'page cannot be nil'
154
+ end
155
+
156
+ if page < 0
157
+ fail ArgumentError, 'invalid value for "page", must be greater than or equal to 0.'
158
+ end
159
+
160
+ @page = page
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] count Value to be assigned
165
+ def count=(count)
166
+ if count.nil?
167
+ fail ArgumentError, 'count cannot be nil'
168
+ end
169
+
170
+ if count < 0
171
+ fail ArgumentError, 'invalid value for "count", must be greater than or equal to 0.'
172
+ end
173
+
174
+ @count = count
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] total Value to be assigned
179
+ def total=(total)
180
+ if total.nil?
181
+ fail ArgumentError, 'total cannot be nil'
182
+ end
183
+
184
+ if total < 0
185
+ fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.'
186
+ end
187
+
188
+ @total = total
189
+ end
190
+
191
+ # Checks equality by comparing each attribute.
192
+ # @param [Object] Object to be compared
193
+ def ==(o)
194
+ return true if self.equal?(o)
195
+ self.class == o.class &&
196
+ page == o.page &&
197
+ count == o.count &&
198
+ total == o.total &&
199
+ entries == o.entries
200
+ end
201
+
202
+ # @see the `==` method
203
+ # @param [Object] Object to be compared
204
+ def eql?(o)
205
+ self == o
206
+ end
207
+
208
+ # Calculates hash code according to all attributes.
209
+ # @return [Integer] Hash code
210
+ def hash
211
+ [page, count, total, entries].hash
212
+ end
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def self.build_from_hash(attributes)
218
+ return nil unless attributes.is_a?(Hash)
219
+ attributes = attributes.transform_keys(&:to_sym)
220
+ transformed_hash = {}
221
+ openapi_types.each_pair do |key, type|
222
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
223
+ transformed_hash["#{key}"] = nil
224
+ elsif type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[attribute_map[key]].is_a?(Array)
228
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
229
+ end
230
+ elsif !attributes[attribute_map[key]].nil?
231
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
232
+ end
233
+ end
234
+ new(transformed_hash)
235
+ end
236
+
237
+ # Deserializes the data based on type
238
+ # @param string type Data type
239
+ # @param string value Value to be deserialized
240
+ # @return [Object] Deserialized data
241
+ def self._deserialize(type, value)
242
+ case type.to_sym
243
+ when :Time
244
+ Time.parse(value)
245
+ when :Date
246
+ Date.parse(value)
247
+ when :String
248
+ value.to_s
249
+ when :Integer
250
+ value.to_i
251
+ when :Float
252
+ value.to_f
253
+ when :Boolean
254
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
255
+ true
256
+ else
257
+ false
258
+ end
259
+ when :Object
260
+ # generic object (usually a Hash), return directly
261
+ value
262
+ when /\AArray<(?<inner_type>.+)>\z/
263
+ inner_type = Regexp.last_match[:inner_type]
264
+ value.map { |v| _deserialize(inner_type, v) }
265
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
266
+ k_type = Regexp.last_match[:k_type]
267
+ v_type = Regexp.last_match[:v_type]
268
+ {}.tap do |hash|
269
+ value.each do |k, v|
270
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
271
+ end
272
+ end
273
+ else # model
274
+ # models (e.g. Pet) or oneOf
275
+ klass = StormgateWorld.const_get(type)
276
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
277
+ end
278
+ end
279
+
280
+ # Returns the string representation of the object
281
+ # @return [String] String presentation of the object
282
+ def to_s
283
+ to_hash.to_s
284
+ end
285
+
286
+ # to_body is an alias to to_hash (backward compatibility)
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_body
289
+ to_hash
290
+ end
291
+
292
+ # Returns the object in the form of hash
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_hash
295
+ hash = {}
296
+ self.class.attribute_map.each_pair do |attr, param|
297
+ value = self.send(attr)
298
+ if value.nil?
299
+ is_nullable = self.class.openapi_nullable.include?(attr)
300
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
301
+ end
302
+
303
+ hash[param] = _to_hash(value)
304
+ end
305
+ hash
306
+ end
307
+
308
+ # Outputs non-array value in the form of hash
309
+ # For object, use to_hash. Otherwise, just return the value
310
+ # @param [Object] value Any valid value
311
+ # @return [Hash] Returns the value in the form of hash
312
+ def _to_hash(value)
313
+ if value.is_a?(Array)
314
+ value.compact.map { |v| _to_hash(v) }
315
+ elsif value.is_a?(Hash)
316
+ {}.tap do |hash|
317
+ value.each { |k, v| hash[k] = _to_hash(v) }
318
+ end
319
+ elsif value.respond_to? :to_hash
320
+ value.to_hash
321
+ else
322
+ value
323
+ end
324
+ end
325
+
326
+ end
327
+
328
+ end
@@ -0,0 +1,309 @@
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 MatchParticipantPlayerLeaderboardEntryResponse
18
+ attr_accessor :leaderboard_entry_id
19
+
20
+ attr_accessor :league
21
+
22
+ attr_accessor :tier
23
+
24
+ attr_accessor :rank
25
+
26
+ attr_accessor :wins
27
+
28
+ attr_accessor :losses
29
+
30
+ attr_accessor :ties
31
+
32
+ attr_accessor :win_rate
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'leaderboard_entry_id' => :'leaderboard_entry_id',
38
+ :'league' => :'league',
39
+ :'tier' => :'tier',
40
+ :'rank' => :'rank',
41
+ :'wins' => :'wins',
42
+ :'losses' => :'losses',
43
+ :'ties' => :'ties',
44
+ :'win_rate' => :'win_rate'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'leaderboard_entry_id' => :'String',
57
+ :'league' => :'String',
58
+ :'tier' => :'Integer',
59
+ :'rank' => :'Integer',
60
+ :'wins' => :'Integer',
61
+ :'losses' => :'Integer',
62
+ :'ties' => :'Integer',
63
+ :'win_rate' => :'Float'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ :'league',
71
+ :'tier',
72
+ :'rank',
73
+ :'ties',
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `StormgateWorld::MatchParticipantPlayerLeaderboardEntryResponse` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `StormgateWorld::MatchParticipantPlayerLeaderboardEntryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'leaderboard_entry_id')
93
+ self.leaderboard_entry_id = attributes[:'leaderboard_entry_id']
94
+ else
95
+ self.leaderboard_entry_id = nil
96
+ end
97
+
98
+ if attributes.key?(:'league')
99
+ self.league = attributes[:'league']
100
+ end
101
+
102
+ if attributes.key?(:'tier')
103
+ self.tier = attributes[:'tier']
104
+ end
105
+
106
+ if attributes.key?(:'rank')
107
+ self.rank = attributes[:'rank']
108
+ end
109
+
110
+ if attributes.key?(:'wins')
111
+ self.wins = attributes[:'wins']
112
+ else
113
+ self.wins = nil
114
+ end
115
+
116
+ if attributes.key?(:'losses')
117
+ self.losses = attributes[:'losses']
118
+ else
119
+ self.losses = nil
120
+ end
121
+
122
+ if attributes.key?(:'ties')
123
+ self.ties = attributes[:'ties']
124
+ end
125
+
126
+ if attributes.key?(:'win_rate')
127
+ self.win_rate = attributes[:'win_rate']
128
+ else
129
+ self.win_rate = nil
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
137
+ invalid_properties = Array.new
138
+ if @leaderboard_entry_id.nil?
139
+ invalid_properties.push('invalid value for "leaderboard_entry_id", leaderboard_entry_id cannot be nil.')
140
+ end
141
+
142
+ if @wins.nil?
143
+ invalid_properties.push('invalid value for "wins", wins cannot be nil.')
144
+ end
145
+
146
+ if @losses.nil?
147
+ invalid_properties.push('invalid value for "losses", losses cannot be nil.')
148
+ end
149
+
150
+ if @win_rate.nil?
151
+ invalid_properties.push('invalid value for "win_rate", win_rate cannot be nil.')
152
+ end
153
+
154
+ invalid_properties
155
+ end
156
+
157
+ # Check to see if the all the properties in the model are valid
158
+ # @return true if the model is valid
159
+ def valid?
160
+ warn '[DEPRECATED] the `valid?` method is obsolete'
161
+ return false if @leaderboard_entry_id.nil?
162
+ return false if @wins.nil?
163
+ return false if @losses.nil?
164
+ return false if @win_rate.nil?
165
+ true
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ leaderboard_entry_id == o.leaderboard_entry_id &&
174
+ league == o.league &&
175
+ tier == o.tier &&
176
+ rank == o.rank &&
177
+ wins == o.wins &&
178
+ losses == o.losses &&
179
+ ties == o.ties &&
180
+ win_rate == o.win_rate
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Integer] Hash code
191
+ def hash
192
+ [leaderboard_entry_id, league, tier, rank, wins, losses, ties, win_rate].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def self.build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ attributes = attributes.transform_keys(&:to_sym)
201
+ transformed_hash = {}
202
+ openapi_types.each_pair do |key, type|
203
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
204
+ transformed_hash["#{key}"] = nil
205
+ elsif type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[attribute_map[key]].is_a?(Array)
209
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
210
+ end
211
+ elsif !attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
213
+ end
214
+ end
215
+ new(transformed_hash)
216
+ end
217
+
218
+ # Deserializes the data based on type
219
+ # @param string type Data type
220
+ # @param string value Value to be deserialized
221
+ # @return [Object] Deserialized data
222
+ def self._deserialize(type, value)
223
+ case type.to_sym
224
+ when :Time
225
+ Time.parse(value)
226
+ when :Date
227
+ Date.parse(value)
228
+ when :String
229
+ value.to_s
230
+ when :Integer
231
+ value.to_i
232
+ when :Float
233
+ value.to_f
234
+ when :Boolean
235
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
236
+ true
237
+ else
238
+ false
239
+ end
240
+ when :Object
241
+ # generic object (usually a Hash), return directly
242
+ value
243
+ when /\AArray<(?<inner_type>.+)>\z/
244
+ inner_type = Regexp.last_match[:inner_type]
245
+ value.map { |v| _deserialize(inner_type, v) }
246
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
247
+ k_type = Regexp.last_match[:k_type]
248
+ v_type = Regexp.last_match[:v_type]
249
+ {}.tap do |hash|
250
+ value.each do |k, v|
251
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
252
+ end
253
+ end
254
+ else # model
255
+ # models (e.g. Pet) or oneOf
256
+ klass = StormgateWorld.const_get(type)
257
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ # Returns the string representation of the object
262
+ # @return [String] String presentation of the object
263
+ def to_s
264
+ to_hash.to_s
265
+ end
266
+
267
+ # to_body is an alias to to_hash (backward compatibility)
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_body
270
+ to_hash
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = self.send(attr)
279
+ if value.nil?
280
+ is_nullable = self.class.openapi_nullable.include?(attr)
281
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
282
+ end
283
+
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+
307
+ end
308
+
309
+ end