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