stormgate_world 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +73 -0
  3. data/README.md +20 -5
  4. data/docs/ActivityStatistics.md +24 -0
  5. data/docs/ActivityStatisticsActivity.md +20 -0
  6. data/docs/ActivityStatisticsEntry.md +24 -0
  7. data/docs/Aggregation.md +15 -0
  8. data/docs/CountriesStatistics.md +24 -0
  9. data/docs/CountriesStatisticsEntry.md +22 -0
  10. data/docs/DumpFormat.md +15 -0
  11. data/docs/LeaderboardEntriesApi.md +10 -4
  12. data/docs/LeaderboardEntryHistory.md +7 -1
  13. data/docs/LeaderboardEntryHistoryRow.md +22 -0
  14. data/docs/LeaderboardEntryResponse.md +3 -1
  15. data/docs/LeaderboardsApi.md +10 -5
  16. data/docs/League.md +15 -0
  17. data/docs/MatchParticipantPlayerLeaderboardEntryResponse.md +1 -1
  18. data/docs/PlayerMatchesResponse.md +2 -0
  19. data/docs/PlayerResponse.md +5 -1
  20. data/docs/PlayersApi.md +14 -146
  21. data/docs/Resolution.md +15 -0
  22. data/docs/ServersStatistics.md +24 -0
  23. data/docs/ServersStatisticsEntry.md +22 -0
  24. data/docs/StatisticsApi.md +205 -2
  25. data/docs/StatsByTime.md +1 -1
  26. data/lib/stormgate_world/api/leaderboard_entries_api.rb +6 -0
  27. data/lib/stormgate_world/api/leaderboards_api.rb +3 -0
  28. data/lib/stormgate_world/api/players_api.rb +20 -129
  29. data/lib/stormgate_world/api/statistics_api.rb +186 -2
  30. data/lib/stormgate_world/models/activity_statistics.rb +269 -0
  31. data/lib/stormgate_world/models/activity_statistics_activity.rb +239 -0
  32. data/lib/stormgate_world/models/activity_statistics_entry.rb +263 -0
  33. data/lib/stormgate_world/models/aggregation.rb +41 -0
  34. data/lib/stormgate_world/models/countries_statistics.rb +271 -0
  35. data/lib/stormgate_world/models/countries_statistics_entry.rb +241 -0
  36. data/lib/stormgate_world/models/dump_format.rb +40 -0
  37. data/lib/stormgate_world/models/leaderboard_entry_history.rb +72 -2
  38. data/lib/stormgate_world/models/leaderboard_entry_history_row.rb +241 -0
  39. data/lib/stormgate_world/models/leaderboard_entry_response.rb +12 -2
  40. data/lib/stormgate_world/models/league.rb +45 -0
  41. data/lib/stormgate_world/models/match_participant_player_leaderboard_entry_response.rb +23 -1
  42. data/lib/stormgate_world/models/player_matches_response.rb +36 -1
  43. data/lib/stormgate_world/models/player_response.rb +25 -5
  44. data/lib/stormgate_world/models/race.rb +1 -2
  45. data/lib/stormgate_world/models/resolution.rb +42 -0
  46. data/lib/stormgate_world/models/servers_statistics.rb +271 -0
  47. data/lib/stormgate_world/models/servers_statistics_entry.rb +253 -0
  48. data/lib/stormgate_world/models/stats_by_time.rb +23 -1
  49. data/lib/stormgate_world/version.rb +1 -1
  50. data/lib/stormgate_world.rb +12 -2
  51. data/pkg/stormgate_world-1.0.0.gem +0 -0
  52. data/spec/models/activity_statistics_activity_spec.rb +42 -0
  53. data/spec/models/activity_statistics_entry_spec.rb +54 -0
  54. data/spec/models/activity_statistics_spec.rb +54 -0
  55. data/spec/models/aggregation_spec.rb +30 -0
  56. data/spec/models/countries_statistics_entry_spec.rb +48 -0
  57. data/spec/models/countries_statistics_spec.rb +54 -0
  58. data/spec/models/dump_format_spec.rb +30 -0
  59. data/spec/models/leaderboard_entry_history_row_spec.rb +48 -0
  60. data/spec/models/league_spec.rb +30 -0
  61. data/spec/models/resolution_spec.rb +30 -0
  62. data/spec/models/servers_statistics_entry_spec.rb +48 -0
  63. data/spec/models/servers_statistics_spec.rb +54 -0
  64. data/stormgate_world.json +1 -1
  65. metadata +52 -2
@@ -139,6 +139,10 @@ module StormgateWorld
139
139
 
140
140
  # @param player_id [String] Player ID
141
141
  # @param [Hash] opts the optional parameters
142
+ # @option opts [Race] :race
143
+ # @option opts [String] :opponent_player_id
144
+ # @option opts [Integer] :page
145
+ # @option opts [Integer] :count
142
146
  # @return [PlayerMatchesResponse]
143
147
  def get_player_matches(player_id, opts = {})
144
148
  data, _status_code, _headers = get_player_matches_with_http_info(player_id, opts)
@@ -147,6 +151,10 @@ module StormgateWorld
147
151
 
148
152
  # @param player_id [String] Player ID
149
153
  # @param [Hash] opts the optional parameters
154
+ # @option opts [Race] :race
155
+ # @option opts [String] :opponent_player_id
156
+ # @option opts [Integer] :page
157
+ # @option opts [Integer] :count
150
158
  # @return [Array<(PlayerMatchesResponse, Integer, Hash)>] PlayerMatchesResponse data, response status code and response headers
151
159
  def get_player_matches_with_http_info(player_id, opts = {})
152
160
  if @api_client.config.debugging
@@ -156,11 +164,23 @@ module StormgateWorld
156
164
  if @api_client.config.client_side_validation && player_id.nil?
157
165
  fail ArgumentError, "Missing the required parameter 'player_id' when calling PlayersApi.get_player_matches"
158
166
  end
167
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0
168
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling PlayersApi.get_player_matches, must be greater than or equal to 0.'
169
+ end
170
+
171
+ if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 0
172
+ fail ArgumentError, 'invalid value for "opts[:"count"]" when calling PlayersApi.get_player_matches, must be greater than or equal to 0.'
173
+ end
174
+
159
175
  # resource path
160
176
  local_var_path = '/v0/players/{player_id}/matches'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
161
177
 
162
178
  # query parameters
163
179
  query_params = opts[:query_params] || {}
180
+ query_params[:'race'] = opts[:'race'] if !opts[:'race'].nil?
181
+ query_params[:'opponent_player_id'] = opts[:'opponent_player_id'] if !opts[:'opponent_player_id'].nil?
182
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
183
+ query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
164
184
 
165
185
  # header parameters
166
186
  header_params = opts[:header_params] || {}
@@ -196,65 +216,6 @@ module StormgateWorld
196
216
  return data, status_code, headers
197
217
  end
198
218
 
199
- # @param player_id [String] Player ID
200
- # @param [Hash] opts the optional parameters
201
- # @return [PlayerPreferences]
202
- def get_player_preferences(player_id, opts = {})
203
- data, _status_code, _headers = get_player_preferences_with_http_info(player_id, opts)
204
- data
205
- end
206
-
207
- # @param player_id [String] Player ID
208
- # @param [Hash] opts the optional parameters
209
- # @return [Array<(PlayerPreferences, Integer, Hash)>] PlayerPreferences data, response status code and response headers
210
- def get_player_preferences_with_http_info(player_id, opts = {})
211
- if @api_client.config.debugging
212
- @api_client.config.logger.debug 'Calling API: PlayersApi.get_player_preferences ...'
213
- end
214
- # verify the required parameter 'player_id' is set
215
- if @api_client.config.client_side_validation && player_id.nil?
216
- fail ArgumentError, "Missing the required parameter 'player_id' when calling PlayersApi.get_player_preferences"
217
- end
218
- # resource path
219
- local_var_path = '/v0/players/{player_id}/preferences'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
220
-
221
- # query parameters
222
- query_params = opts[:query_params] || {}
223
-
224
- # header parameters
225
- header_params = opts[:header_params] || {}
226
- # HTTP header 'Accept' (if needed)
227
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
228
-
229
- # form parameters
230
- form_params = opts[:form_params] || {}
231
-
232
- # http body (model)
233
- post_body = opts[:debug_body]
234
-
235
- # return_type
236
- return_type = opts[:debug_return_type] || 'PlayerPreferences'
237
-
238
- # auth_names
239
- auth_names = opts[:debug_auth_names] || ['api_key']
240
-
241
- new_options = opts.merge(
242
- :operation => :"PlayersApi.get_player_preferences",
243
- :header_params => header_params,
244
- :query_params => query_params,
245
- :form_params => form_params,
246
- :body => post_body,
247
- :auth_names => auth_names,
248
- :return_type => return_type
249
- )
250
-
251
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
252
- if @api_client.config.debugging
253
- @api_client.config.logger.debug "API called: PlayersApi#get_player_preferences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
254
- end
255
- return data, status_code, headers
256
- end
257
-
258
219
  # @param player_id [String] Player ID
259
220
  # @param [Hash] opts the optional parameters
260
221
  # @return [PlayerActivityStats]
@@ -438,75 +399,5 @@ module StormgateWorld
438
399
  end
439
400
  return data, status_code, headers
440
401
  end
441
-
442
- # @param player_id [String] Player ID
443
- # @param player_preferences [PlayerPreferences]
444
- # @param [Hash] opts the optional parameters
445
- # @return [PlayerPreferences]
446
- def update_player_preferences(player_id, player_preferences, opts = {})
447
- data, _status_code, _headers = update_player_preferences_with_http_info(player_id, player_preferences, opts)
448
- data
449
- end
450
-
451
- # @param player_id [String] Player ID
452
- # @param player_preferences [PlayerPreferences]
453
- # @param [Hash] opts the optional parameters
454
- # @return [Array<(PlayerPreferences, Integer, Hash)>] PlayerPreferences data, response status code and response headers
455
- def update_player_preferences_with_http_info(player_id, player_preferences, opts = {})
456
- if @api_client.config.debugging
457
- @api_client.config.logger.debug 'Calling API: PlayersApi.update_player_preferences ...'
458
- end
459
- # verify the required parameter 'player_id' is set
460
- if @api_client.config.client_side_validation && player_id.nil?
461
- fail ArgumentError, "Missing the required parameter 'player_id' when calling PlayersApi.update_player_preferences"
462
- end
463
- # verify the required parameter 'player_preferences' is set
464
- if @api_client.config.client_side_validation && player_preferences.nil?
465
- fail ArgumentError, "Missing the required parameter 'player_preferences' when calling PlayersApi.update_player_preferences"
466
- end
467
- # resource path
468
- local_var_path = '/v0/players/{player_id}/preferences'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
469
-
470
- # query parameters
471
- query_params = opts[:query_params] || {}
472
-
473
- # header parameters
474
- header_params = opts[:header_params] || {}
475
- # HTTP header 'Accept' (if needed)
476
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
477
- # HTTP header 'Content-Type'
478
- content_type = @api_client.select_header_content_type(['application/json'])
479
- if !content_type.nil?
480
- header_params['Content-Type'] = content_type
481
- end
482
-
483
- # form parameters
484
- form_params = opts[:form_params] || {}
485
-
486
- # http body (model)
487
- post_body = opts[:debug_body] || @api_client.object_to_http_body(player_preferences)
488
-
489
- # return_type
490
- return_type = opts[:debug_return_type] || 'PlayerPreferences'
491
-
492
- # auth_names
493
- auth_names = opts[:debug_auth_names] || ['api_key']
494
-
495
- new_options = opts.merge(
496
- :operation => :"PlayersApi.update_player_preferences",
497
- :header_params => header_params,
498
- :query_params => query_params,
499
- :form_params => form_params,
500
- :body => post_body,
501
- :auth_names => auth_names,
502
- :return_type => return_type
503
- )
504
-
505
- data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
506
- if @api_client.config.debugging
507
- @api_client.config.logger.debug "API called: PlayersApi#update_player_preferences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
508
- end
509
- return data, status_code, headers
510
- end
511
402
  end
512
403
  end
@@ -20,7 +20,8 @@ module StormgateWorld
20
20
  @api_client = api_client
21
21
  end
22
22
  # @param [Hash] opts the optional parameters
23
- # @option opts [String] :league
23
+ # @option opts [League] :league
24
+ # @option opts [Integer] :count
24
25
  # @return [StatsByTime]
25
26
  def get_statistics(opts = {})
26
27
  data, _status_code, _headers = get_statistics_with_http_info(opts)
@@ -28,18 +29,24 @@ module StormgateWorld
28
29
  end
29
30
 
30
31
  # @param [Hash] opts the optional parameters
31
- # @option opts [String] :league
32
+ # @option opts [League] :league
33
+ # @option opts [Integer] :count
32
34
  # @return [Array<(StatsByTime, Integer, Hash)>] StatsByTime data, response status code and response headers
33
35
  def get_statistics_with_http_info(opts = {})
34
36
  if @api_client.config.debugging
35
37
  @api_client.config.logger.debug 'Calling API: StatisticsApi.get_statistics ...'
36
38
  end
39
+ if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 0
40
+ fail ArgumentError, 'invalid value for "opts[:"count"]" when calling StatisticsApi.get_statistics, must be greater than or equal to 0.'
41
+ end
42
+
37
43
  # resource path
38
44
  local_var_path = '/v0/statistics/ranked_1v1'
39
45
 
40
46
  # query parameters
41
47
  query_params = opts[:query_params] || {}
42
48
  query_params[:'league'] = opts[:'league'] if !opts[:'league'].nil?
49
+ query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
43
50
 
44
51
  # header parameters
45
52
  header_params = opts[:header_params] || {}
@@ -74,5 +81,182 @@ module StormgateWorld
74
81
  end
75
82
  return data, status_code, headers
76
83
  end
84
+
85
+ # @param [Hash] opts the optional parameters
86
+ # @option opts [Date] :since
87
+ # @option opts [Date] :_until
88
+ # @return [ActivityStatistics]
89
+ def get_statistics_activity(opts = {})
90
+ data, _status_code, _headers = get_statistics_activity_with_http_info(opts)
91
+ data
92
+ end
93
+
94
+ # @param [Hash] opts the optional parameters
95
+ # @option opts [Date] :since
96
+ # @option opts [Date] :_until
97
+ # @return [Array<(ActivityStatistics, Integer, Hash)>] ActivityStatistics data, response status code and response headers
98
+ def get_statistics_activity_with_http_info(opts = {})
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug 'Calling API: StatisticsApi.get_statistics_activity ...'
101
+ end
102
+ # resource path
103
+ local_var_path = '/v0/statistics/activity'
104
+
105
+ # query parameters
106
+ query_params = opts[:query_params] || {}
107
+ query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
108
+ query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
109
+
110
+ # header parameters
111
+ header_params = opts[:header_params] || {}
112
+ # HTTP header 'Accept' (if needed)
113
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
114
+
115
+ # form parameters
116
+ form_params = opts[:form_params] || {}
117
+
118
+ # http body (model)
119
+ post_body = opts[:debug_body]
120
+
121
+ # return_type
122
+ return_type = opts[:debug_return_type] || 'ActivityStatistics'
123
+
124
+ # auth_names
125
+ auth_names = opts[:debug_auth_names] || []
126
+
127
+ new_options = opts.merge(
128
+ :operation => :"StatisticsApi.get_statistics_activity",
129
+ :header_params => header_params,
130
+ :query_params => query_params,
131
+ :form_params => form_params,
132
+ :body => post_body,
133
+ :auth_names => auth_names,
134
+ :return_type => return_type
135
+ )
136
+
137
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
138
+ if @api_client.config.debugging
139
+ @api_client.config.logger.debug "API called: StatisticsApi#get_statistics_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
140
+ end
141
+ return data, status_code, headers
142
+ end
143
+
144
+ # @param [Hash] opts the optional parameters
145
+ # @option opts [Date] :since
146
+ # @option opts [Date] :_until
147
+ # @return [CountriesStatistics]
148
+ def get_statistics_countries(opts = {})
149
+ data, _status_code, _headers = get_statistics_countries_with_http_info(opts)
150
+ data
151
+ end
152
+
153
+ # @param [Hash] opts the optional parameters
154
+ # @option opts [Date] :since
155
+ # @option opts [Date] :_until
156
+ # @return [Array<(CountriesStatistics, Integer, Hash)>] CountriesStatistics data, response status code and response headers
157
+ def get_statistics_countries_with_http_info(opts = {})
158
+ if @api_client.config.debugging
159
+ @api_client.config.logger.debug 'Calling API: StatisticsApi.get_statistics_countries ...'
160
+ end
161
+ # resource path
162
+ local_var_path = '/v0/statistics/countries'
163
+
164
+ # query parameters
165
+ query_params = opts[:query_params] || {}
166
+ query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
167
+ query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
168
+
169
+ # header parameters
170
+ header_params = opts[:header_params] || {}
171
+ # HTTP header 'Accept' (if needed)
172
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
173
+
174
+ # form parameters
175
+ form_params = opts[:form_params] || {}
176
+
177
+ # http body (model)
178
+ post_body = opts[:debug_body]
179
+
180
+ # return_type
181
+ return_type = opts[:debug_return_type] || 'CountriesStatistics'
182
+
183
+ # auth_names
184
+ auth_names = opts[:debug_auth_names] || []
185
+
186
+ new_options = opts.merge(
187
+ :operation => :"StatisticsApi.get_statistics_countries",
188
+ :header_params => header_params,
189
+ :query_params => query_params,
190
+ :form_params => form_params,
191
+ :body => post_body,
192
+ :auth_names => auth_names,
193
+ :return_type => return_type
194
+ )
195
+
196
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
197
+ if @api_client.config.debugging
198
+ @api_client.config.logger.debug "API called: StatisticsApi#get_statistics_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
199
+ end
200
+ return data, status_code, headers
201
+ end
202
+
203
+ # @param [Hash] opts the optional parameters
204
+ # @option opts [Date] :since
205
+ # @option opts [Date] :_until
206
+ # @return [ServersStatistics]
207
+ def get_statistics_servers(opts = {})
208
+ data, _status_code, _headers = get_statistics_servers_with_http_info(opts)
209
+ data
210
+ end
211
+
212
+ # @param [Hash] opts the optional parameters
213
+ # @option opts [Date] :since
214
+ # @option opts [Date] :_until
215
+ # @return [Array<(ServersStatistics, Integer, Hash)>] ServersStatistics data, response status code and response headers
216
+ def get_statistics_servers_with_http_info(opts = {})
217
+ if @api_client.config.debugging
218
+ @api_client.config.logger.debug 'Calling API: StatisticsApi.get_statistics_servers ...'
219
+ end
220
+ # resource path
221
+ local_var_path = '/v0/statistics/servers'
222
+
223
+ # query parameters
224
+ query_params = opts[:query_params] || {}
225
+ query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
226
+ query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
227
+
228
+ # header parameters
229
+ header_params = opts[:header_params] || {}
230
+ # HTTP header 'Accept' (if needed)
231
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
232
+
233
+ # form parameters
234
+ form_params = opts[:form_params] || {}
235
+
236
+ # http body (model)
237
+ post_body = opts[:debug_body]
238
+
239
+ # return_type
240
+ return_type = opts[:debug_return_type] || 'ServersStatistics'
241
+
242
+ # auth_names
243
+ auth_names = opts[:debug_auth_names] || []
244
+
245
+ new_options = opts.merge(
246
+ :operation => :"StatisticsApi.get_statistics_servers",
247
+ :header_params => header_params,
248
+ :query_params => query_params,
249
+ :form_params => form_params,
250
+ :body => post_body,
251
+ :auth_names => auth_names,
252
+ :return_type => return_type
253
+ )
254
+
255
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
256
+ if @api_client.config.debugging
257
+ @api_client.config.logger.debug "API called: StatisticsApi#get_statistics_servers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
258
+ end
259
+ return data, status_code, headers
260
+ end
77
261
  end
78
262
  end
@@ -0,0 +1,269 @@
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 ActivityStatistics
18
+ attr_accessor :cached_at
19
+
20
+ attr_accessor :since
21
+
22
+ attr_accessor :_until
23
+
24
+ attr_accessor :activity
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'cached_at' => :'cached_at',
30
+ :'since' => :'since',
31
+ :'_until' => :'until',
32
+ :'activity' => :'activity'
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
+ :'cached_at' => :'Time',
45
+ :'since' => :'Date',
46
+ :'_until' => :'Date',
47
+ :'activity' => :'ActivityStatisticsActivity'
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::ActivityStatistics` 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::ActivityStatistics`. 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?(:'cached_at')
73
+ self.cached_at = attributes[:'cached_at']
74
+ else
75
+ self.cached_at = nil
76
+ end
77
+
78
+ if attributes.key?(:'since')
79
+ self.since = attributes[:'since']
80
+ else
81
+ self.since = nil
82
+ end
83
+
84
+ if attributes.key?(:'_until')
85
+ self._until = attributes[:'_until']
86
+ else
87
+ self._until = nil
88
+ end
89
+
90
+ if attributes.key?(:'activity')
91
+ self.activity = attributes[:'activity']
92
+ else
93
+ self.activity = nil
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ if @cached_at.nil?
103
+ invalid_properties.push('invalid value for "cached_at", cached_at cannot be nil.')
104
+ end
105
+
106
+ if @since.nil?
107
+ invalid_properties.push('invalid value for "since", since cannot be nil.')
108
+ end
109
+
110
+ if @_until.nil?
111
+ invalid_properties.push('invalid value for "_until", _until cannot be nil.')
112
+ end
113
+
114
+ if @activity.nil?
115
+ invalid_properties.push('invalid value for "activity", activity cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @cached_at.nil?
126
+ return false if @since.nil?
127
+ return false if @_until.nil?
128
+ return false if @activity.nil?
129
+ true
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ cached_at == o.cached_at &&
138
+ since == o.since &&
139
+ _until == o._until &&
140
+ activity == o.activity
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [cached_at, since, _until, activity].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ return nil unless attributes.is_a?(Hash)
160
+ attributes = attributes.transform_keys(&:to_sym)
161
+ transformed_hash = {}
162
+ openapi_types.each_pair do |key, type|
163
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = nil
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[attribute_map[key]].is_a?(Array)
169
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
170
+ end
171
+ elsif !attributes[attribute_map[key]].nil?
172
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
173
+ end
174
+ end
175
+ new(transformed_hash)
176
+ end
177
+
178
+ # Deserializes the data based on type
179
+ # @param string type Data type
180
+ # @param string value Value to be deserialized
181
+ # @return [Object] Deserialized data
182
+ def self._deserialize(type, value)
183
+ case type.to_sym
184
+ when :Time
185
+ Time.parse(value)
186
+ when :Date
187
+ Date.parse(value)
188
+ when :String
189
+ value.to_s
190
+ when :Integer
191
+ value.to_i
192
+ when :Float
193
+ value.to_f
194
+ when :Boolean
195
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
+ true
197
+ else
198
+ false
199
+ end
200
+ when :Object
201
+ # generic object (usually a Hash), return directly
202
+ value
203
+ when /\AArray<(?<inner_type>.+)>\z/
204
+ inner_type = Regexp.last_match[:inner_type]
205
+ value.map { |v| _deserialize(inner_type, v) }
206
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
207
+ k_type = Regexp.last_match[:k_type]
208
+ v_type = Regexp.last_match[:v_type]
209
+ {}.tap do |hash|
210
+ value.each do |k, v|
211
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
212
+ end
213
+ end
214
+ else # model
215
+ # models (e.g. Pet) or oneOf
216
+ klass = StormgateWorld.const_get(type)
217
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ # Returns the string representation of the object
222
+ # @return [String] String presentation of the object
223
+ def to_s
224
+ to_hash.to_s
225
+ end
226
+
227
+ # to_body is an alias to to_hash (backward compatibility)
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_body
230
+ to_hash
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ if value.nil?
240
+ is_nullable = self.class.openapi_nullable.include?(attr)
241
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
242
+ end
243
+
244
+ hash[param] = _to_hash(value)
245
+ end
246
+ hash
247
+ end
248
+
249
+ # Outputs non-array value in the form of hash
250
+ # For object, use to_hash. Otherwise, just return the value
251
+ # @param [Object] value Any valid value
252
+ # @return [Hash] Returns the value in the form of hash
253
+ def _to_hash(value)
254
+ if value.is_a?(Array)
255
+ value.compact.map { |v| _to_hash(v) }
256
+ elsif value.is_a?(Hash)
257
+ {}.tap do |hash|
258
+ value.each { |k, v| hash[k] = _to_hash(v) }
259
+ end
260
+ elsif value.respond_to? :to_hash
261
+ value.to_hash
262
+ else
263
+ value
264
+ end
265
+ end
266
+
267
+ end
268
+
269
+ end