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