trophy_api_client 1.0.29 → 1.0.30

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/trophy_api_client/achievements/client.rb +2 -2
  4. data/lib/trophy_api_client/leaderboards/client.rb +9 -5
  5. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +186 -0
  6. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item_status.rb +12 -0
  7. data/lib/trophy_api_client/metrics/client.rb +2 -2
  8. data/lib/trophy_api_client/streaks/client.rb +2 -2
  9. data/lib/trophy_api_client/types/achievement_completion_response.rb +9 -11
  10. data/lib/trophy_api_client/types/achievement_completion_response_achievement.rb +171 -0
  11. data/lib/trophy_api_client/types/achievement_response.rb +5 -19
  12. data/lib/trophy_api_client/types/achievement_with_stats_response.rb +9 -23
  13. data/lib/trophy_api_client/types/bulk_streak_response_item.rb +4 -6
  14. data/lib/trophy_api_client/types/completed_achievement_response.rb +7 -21
  15. data/lib/trophy_api_client/types/event_response.rb +10 -10
  16. data/lib/trophy_api_client/types/get_user_points_response.rb +21 -4
  17. data/lib/trophy_api_client/types/leaderboard_response.rb +8 -16
  18. data/lib/trophy_api_client/types/leaderboard_response_run_unit.rb +11 -0
  19. data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +17 -16
  20. data/lib/trophy_api_client/types/{leaderboard_response_status.rb → leaderboard_response_with_rankings_status.rb} +1 -1
  21. data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +11 -19
  22. data/lib/trophy_api_client/types/metric_event_points_response.rb +24 -8
  23. data/lib/trophy_api_client/types/metric_event_streak_response.rb +4 -4
  24. data/lib/trophy_api_client/types/points_award.rb +6 -6
  25. data/lib/trophy_api_client/types/points_range.rb +14 -16
  26. data/lib/trophy_api_client/types/points_system_response.rb +10 -1
  27. data/lib/trophy_api_client/types/points_trigger.rb +30 -11
  28. data/lib/trophy_api_client/types/points_trigger_response.rb +39 -22
  29. data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +9 -0
  30. data/lib/trophy_api_client/types/points_trigger_response_type.rb +2 -0
  31. data/lib/trophy_api_client/types/points_trigger_time_unit.rb +9 -0
  32. data/lib/trophy_api_client/types/points_trigger_type.rb +2 -0
  33. data/lib/trophy_api_client/types/updated_user.rb +11 -11
  34. data/lib/trophy_api_client/types/upserted_user.rb +12 -12
  35. data/lib/trophy_api_client/types/user.rb +18 -18
  36. data/lib/trophy_api_client/types/user_leaderboard_response.rb +8 -28
  37. data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +208 -0
  38. data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +212 -0
  39. data/lib/trophy_api_client/types/webhooks_achievement_completed_payload.rb +84 -0
  40. data/lib/trophy_api_client/types/webhooks_leaderboard_changed_payload.rb +71 -0
  41. data/lib/trophy_api_client/types/webhooks_leaderboard_finished_payload.rb +71 -0
  42. data/lib/trophy_api_client/types/webhooks_leaderboard_rank_changed_payload.rb +85 -0
  43. data/lib/trophy_api_client/types/webhooks_leaderboard_started_payload.rb +71 -0
  44. data/lib/trophy_api_client/types/webhooks_points_changed_payload.rb +84 -0
  45. data/lib/trophy_api_client/types/webhooks_streak_extended_payload.rb +84 -0
  46. data/lib/trophy_api_client/types/webhooks_streak_freeze_consumed_payload.rb +85 -0
  47. data/lib/trophy_api_client/types/webhooks_streak_freeze_earned_payload.rb +85 -0
  48. data/lib/trophy_api_client/types/webhooks_streak_lost_payload.rb +78 -0
  49. data/lib/trophy_api_client/types/webhooks_streak_started_payload.rb +84 -0
  50. data/lib/trophy_api_client/users/client.rb +25 -17
  51. data/lib/trophy_api_client/version.rb +1 -1
  52. data/lib/types_export.rb +20 -1
  53. metadata +21 -2
@@ -3,7 +3,6 @@
3
3
  require_relative "achievement_with_stats_response_user_attributes_item"
4
4
  require_relative "achievement_with_stats_response_event_attribute"
5
5
  require_relative "achievement_response_trigger"
6
- require_relative "metric_event_streak_response"
7
6
  require "ostruct"
8
7
  require "json"
9
8
 
@@ -44,8 +43,6 @@ module TrophyApiClient
44
43
  # @return [String] The name of the metric associated with this achievement (only applicable if
45
44
  # trigger = 'metric')
46
45
  attr_reader :metric_name
47
- # @return [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
48
- attr_reader :current_streak
49
46
  # @return [OpenStruct] Additional properties unmapped to the current class definition
50
47
  attr_reader :additional_properties
51
48
  # @return [Object]
@@ -75,13 +72,12 @@ module TrophyApiClient
75
72
  # trigger = 'metric')
76
73
  # @param metric_name [String] The name of the metric associated with this achievement (only applicable if
77
74
  # trigger = 'metric')
78
- # @param current_streak [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
79
75
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
80
76
  # @return [TrophyApiClient::AchievementWithStatsResponse]
81
- def initialize(id:, name:, trigger:, completions: OMIT, rarity: OMIT, user_attributes: OMIT, event_attribute: OMIT,
82
- description: OMIT, badge_url: OMIT, key: OMIT, streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, current_streak: OMIT, additional_properties: nil)
83
- @completions = completions if completions != OMIT
84
- @rarity = rarity if rarity != OMIT
77
+ def initialize(completions:, rarity:, id:, name:, trigger:, key:, user_attributes: OMIT, event_attribute: OMIT,
78
+ description: OMIT, badge_url: OMIT, streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, additional_properties: nil)
79
+ @completions = completions
80
+ @rarity = rarity
85
81
  @user_attributes = user_attributes if user_attributes != OMIT
86
82
  @event_attribute = event_attribute if event_attribute != OMIT
87
83
  @id = id
@@ -89,12 +85,11 @@ module TrophyApiClient
89
85
  @trigger = trigger
90
86
  @description = description if description != OMIT
91
87
  @badge_url = badge_url if badge_url != OMIT
92
- @key = key if key != OMIT
88
+ @key = key
93
89
  @streak_length = streak_length if streak_length != OMIT
94
90
  @metric_id = metric_id if metric_id != OMIT
95
91
  @metric_value = metric_value if metric_value != OMIT
96
92
  @metric_name = metric_name if metric_name != OMIT
97
- @current_streak = current_streak if current_streak != OMIT
98
93
  @additional_properties = additional_properties
99
94
  @_field_set = {
100
95
  "completions": completions,
@@ -110,8 +105,7 @@ module TrophyApiClient
110
105
  "streakLength": streak_length,
111
106
  "metricId": metric_id,
112
107
  "metricValue": metric_value,
113
- "metricName": metric_name,
114
- "currentStreak": current_streak
108
+ "metricName": metric_name
115
109
  }.reject do |_k, v|
116
110
  v == OMIT
117
111
  end
@@ -146,12 +140,6 @@ module TrophyApiClient
146
140
  metric_id = parsed_json["metricId"]
147
141
  metric_value = parsed_json["metricValue"]
148
142
  metric_name = parsed_json["metricName"]
149
- if parsed_json["currentStreak"].nil?
150
- current_streak = nil
151
- else
152
- current_streak = parsed_json["currentStreak"].to_json
153
- current_streak = TrophyApiClient::MetricEventStreakResponse.from_json(json_object: current_streak)
154
- end
155
143
  new(
156
144
  completions: completions,
157
145
  rarity: rarity,
@@ -167,7 +155,6 @@ module TrophyApiClient
167
155
  metric_id: metric_id,
168
156
  metric_value: metric_value,
169
157
  metric_name: metric_name,
170
- current_streak: current_streak,
171
158
  additional_properties: struct
172
159
  )
173
160
  end
@@ -186,8 +173,8 @@ module TrophyApiClient
186
173
  # @param obj [Object]
187
174
  # @return [Void]
188
175
  def self.validate_raw(obj:)
189
- obj.completions&.is_a?(Integer) != false || raise("Passed value for field obj.completions is not the expected type, validation failed.")
190
- obj.rarity&.is_a?(Float) != false || raise("Passed value for field obj.rarity is not the expected type, validation failed.")
176
+ obj.completions.is_a?(Integer) != false || raise("Passed value for field obj.completions is not the expected type, validation failed.")
177
+ obj.rarity.is_a?(Float) != false || raise("Passed value for field obj.rarity is not the expected type, validation failed.")
191
178
  obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
192
179
  obj.event_attribute.nil? || TrophyApiClient::AchievementWithStatsResponseEventAttribute.validate_raw(obj: obj.event_attribute)
193
180
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
@@ -195,12 +182,11 @@ module TrophyApiClient
195
182
  obj.trigger.is_a?(TrophyApiClient::AchievementResponseTrigger) != false || raise("Passed value for field obj.trigger is not the expected type, validation failed.")
196
183
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
197
184
  obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
198
- obj.key&.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
185
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
199
186
  obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
200
187
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
201
188
  obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
202
189
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
203
- obj.current_streak.nil? || TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
204
190
  end
205
191
  end
206
192
  end
@@ -24,14 +24,12 @@ module TrophyApiClient
24
24
  # @param extended [String] The timestamp the streak was extended, as a string.
25
25
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
26
  # @return [TrophyApiClient::BulkStreakResponseItem]
27
- def initialize(user_id:, streak_length:, extended: OMIT, additional_properties: nil)
27
+ def initialize(user_id:, streak_length:, extended:, additional_properties: nil)
28
28
  @user_id = user_id
29
29
  @streak_length = streak_length
30
- @extended = extended if extended != OMIT
30
+ @extended = extended
31
31
  @additional_properties = additional_properties
32
- @_field_set = { "userId": user_id, "streakLength": streak_length, "extended": extended }.reject do |_k, v|
33
- v == OMIT
34
- end
32
+ @_field_set = { "userId": user_id, "streakLength": streak_length, "extended": extended }
35
33
  end
36
34
 
37
35
  # Deserialize a JSON object to an instance of BulkStreakResponseItem
@@ -68,7 +66,7 @@ module TrophyApiClient
68
66
  def self.validate_raw(obj:)
69
67
  obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
70
68
  obj.streak_length.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
71
- obj.extended&.is_a?(String) != false || raise("Passed value for field obj.extended is not the expected type, validation failed.")
69
+ obj.extended.is_a?(String) != false || raise("Passed value for field obj.extended is not the expected type, validation failed.")
72
70
  end
73
71
  end
74
72
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "date"
4
4
  require_relative "achievement_response_trigger"
5
- require_relative "metric_event_streak_response"
6
5
  require "ostruct"
7
6
  require "json"
8
7
 
@@ -35,8 +34,6 @@ module TrophyApiClient
35
34
  # @return [String] The name of the metric associated with this achievement (only applicable if
36
35
  # trigger = 'metric')
37
36
  attr_reader :metric_name
38
- # @return [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
39
- attr_reader :current_streak
40
37
  # @return [OpenStruct] Additional properties unmapped to the current class definition
41
38
  attr_reader :additional_properties
42
39
  # @return [Object]
@@ -61,23 +58,21 @@ module TrophyApiClient
61
58
  # trigger = 'metric')
62
59
  # @param metric_name [String] The name of the metric associated with this achievement (only applicable if
63
60
  # trigger = 'metric')
64
- # @param current_streak [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
65
61
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
66
62
  # @return [TrophyApiClient::CompletedAchievementResponse]
67
- def initialize(id:, name:, trigger:, achieved_at: OMIT, description: OMIT, badge_url: OMIT, key: OMIT,
68
- streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, current_streak: OMIT, additional_properties: nil)
69
- @achieved_at = achieved_at if achieved_at != OMIT
63
+ def initialize(achieved_at:, id:, name:, trigger:, key:, description: OMIT, badge_url: OMIT, streak_length: OMIT,
64
+ metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, additional_properties: nil)
65
+ @achieved_at = achieved_at
70
66
  @id = id
71
67
  @name = name
72
68
  @trigger = trigger
73
69
  @description = description if description != OMIT
74
70
  @badge_url = badge_url if badge_url != OMIT
75
- @key = key if key != OMIT
71
+ @key = key
76
72
  @streak_length = streak_length if streak_length != OMIT
77
73
  @metric_id = metric_id if metric_id != OMIT
78
74
  @metric_value = metric_value if metric_value != OMIT
79
75
  @metric_name = metric_name if metric_name != OMIT
80
- @current_streak = current_streak if current_streak != OMIT
81
76
  @additional_properties = additional_properties
82
77
  @_field_set = {
83
78
  "achievedAt": achieved_at,
@@ -90,8 +85,7 @@ module TrophyApiClient
90
85
  "streakLength": streak_length,
91
86
  "metricId": metric_id,
92
87
  "metricValue": metric_value,
93
- "metricName": metric_name,
94
- "currentStreak": current_streak
88
+ "metricName": metric_name
95
89
  }.reject do |_k, v|
96
90
  v == OMIT
97
91
  end
@@ -115,12 +109,6 @@ module TrophyApiClient
115
109
  metric_id = parsed_json["metricId"]
116
110
  metric_value = parsed_json["metricValue"]
117
111
  metric_name = parsed_json["metricName"]
118
- if parsed_json["currentStreak"].nil?
119
- current_streak = nil
120
- else
121
- current_streak = parsed_json["currentStreak"].to_json
122
- current_streak = TrophyApiClient::MetricEventStreakResponse.from_json(json_object: current_streak)
123
- end
124
112
  new(
125
113
  achieved_at: achieved_at,
126
114
  id: id,
@@ -133,7 +121,6 @@ module TrophyApiClient
133
121
  metric_id: metric_id,
134
122
  metric_value: metric_value,
135
123
  metric_name: metric_name,
136
- current_streak: current_streak,
137
124
  additional_properties: struct
138
125
  )
139
126
  end
@@ -152,18 +139,17 @@ module TrophyApiClient
152
139
  # @param obj [Object]
153
140
  # @return [Void]
154
141
  def self.validate_raw(obj:)
155
- obj.achieved_at&.is_a?(DateTime) != false || raise("Passed value for field obj.achieved_at is not the expected type, validation failed.")
142
+ obj.achieved_at.is_a?(DateTime) != false || raise("Passed value for field obj.achieved_at is not the expected type, validation failed.")
156
143
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
157
144
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
158
145
  obj.trigger.is_a?(TrophyApiClient::AchievementResponseTrigger) != false || raise("Passed value for field obj.trigger is not the expected type, validation failed.")
159
146
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
160
147
  obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
161
- obj.key&.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
148
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
162
149
  obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
163
150
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
164
151
  obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
165
152
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
166
- obj.current_streak.nil? || TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
167
153
  end
168
154
  end
169
155
  end
@@ -44,15 +44,15 @@ module TrophyApiClient
44
44
  # @param idempotent_replayed [Boolean] Whether the event was replayed due to idempotency.
45
45
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
46
46
  # @return [TrophyApiClient::EventResponse]
47
- def initialize(event_id:, metric_id:, total:, achievements: OMIT, current_streak: OMIT, points: OMIT,
48
- leaderboards: OMIT, idempotency_key: OMIT, idempotent_replayed: OMIT, additional_properties: nil)
47
+ def initialize(event_id:, metric_id:, total:, achievements:, current_streak:, points:, leaderboards:,
48
+ idempotency_key: OMIT, idempotent_replayed: OMIT, additional_properties: nil)
49
49
  @event_id = event_id
50
50
  @metric_id = metric_id
51
51
  @total = total
52
- @achievements = achievements if achievements != OMIT
53
- @current_streak = current_streak if current_streak != OMIT
54
- @points = points if points != OMIT
55
- @leaderboards = leaderboards if leaderboards != OMIT
52
+ @achievements = achievements
53
+ @current_streak = current_streak
54
+ @points = points
55
+ @leaderboards = leaderboards
56
56
  @idempotency_key = idempotency_key if idempotency_key != OMIT
57
57
  @idempotent_replayed = idempotent_replayed if idempotent_replayed != OMIT
58
58
  @additional_properties = additional_properties
@@ -132,10 +132,10 @@ module TrophyApiClient
132
132
  obj.event_id.is_a?(String) != false || raise("Passed value for field obj.event_id is not the expected type, validation failed.")
133
133
  obj.metric_id.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
134
134
  obj.total.is_a?(Float) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
135
- obj.achievements&.is_a?(Array) != false || raise("Passed value for field obj.achievements is not the expected type, validation failed.")
136
- obj.current_streak.nil? || TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
137
- obj.points&.is_a?(Hash) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
138
- obj.leaderboards&.is_a?(Hash) != false || raise("Passed value for field obj.leaderboards is not the expected type, validation failed.")
135
+ obj.achievements.is_a?(Array) != false || raise("Passed value for field obj.achievements is not the expected type, validation failed.")
136
+ TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
137
+ obj.points.is_a?(Hash) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
138
+ obj.leaderboards.is_a?(Hash) != false || raise("Passed value for field obj.leaderboards is not the expected type, validation failed.")
139
139
  obj.idempotency_key&.is_a?(String) != false || raise("Passed value for field obj.idempotency_key is not the expected type, validation failed.")
140
140
  obj.idempotent_replayed&.is_a?(Boolean) != false || raise("Passed value for field obj.idempotent_replayed is not the expected type, validation failed.")
141
141
  end
@@ -8,13 +8,17 @@ module TrophyApiClient
8
8
  class GetUserPointsResponse
9
9
  # @return [String] The ID of the points system
10
10
  attr_reader :id
11
+ # @return [String] The key of the points system
12
+ attr_reader :key
11
13
  # @return [String] The name of the points system
12
14
  attr_reader :name
13
15
  # @return [String] The description of the points system
14
16
  attr_reader :description
15
17
  # @return [String] The URL of the badge image for the points system
16
18
  attr_reader :badge_url
17
- # @return [Float] The user's total points
19
+ # @return [Float] The maximum number of points a user can be awarded in this points system
20
+ attr_reader :max_points
21
+ # @return [Integer] The user's total points
18
22
  attr_reader :total
19
23
  # @return [Array<TrophyApiClient::PointsAward>] Array of trigger awards that added points.
20
24
  attr_reader :awards
@@ -27,26 +31,33 @@ module TrophyApiClient
27
31
  OMIT = Object.new
28
32
 
29
33
  # @param id [String] The ID of the points system
34
+ # @param key [String] The key of the points system
30
35
  # @param name [String] The name of the points system
31
36
  # @param description [String] The description of the points system
32
37
  # @param badge_url [String] The URL of the badge image for the points system
33
- # @param total [Float] The user's total points
38
+ # @param max_points [Float] The maximum number of points a user can be awarded in this points system
39
+ # @param total [Integer] The user's total points
34
40
  # @param awards [Array<TrophyApiClient::PointsAward>] Array of trigger awards that added points.
35
41
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
36
42
  # @return [TrophyApiClient::GetUserPointsResponse]
37
- def initialize(id:, name:, total:, awards:, description: OMIT, badge_url: OMIT, additional_properties: nil)
43
+ def initialize(id:, key:, name:, total:, awards:, description: OMIT, badge_url: OMIT, max_points: OMIT,
44
+ additional_properties: nil)
38
45
  @id = id
46
+ @key = key
39
47
  @name = name
40
48
  @description = description if description != OMIT
41
49
  @badge_url = badge_url if badge_url != OMIT
50
+ @max_points = max_points if max_points != OMIT
42
51
  @total = total
43
52
  @awards = awards
44
53
  @additional_properties = additional_properties
45
54
  @_field_set = {
46
55
  "id": id,
56
+ "key": key,
47
57
  "name": name,
48
58
  "description": description,
49
59
  "badgeUrl": badge_url,
60
+ "maxPoints": max_points,
50
61
  "total": total,
51
62
  "awards": awards
52
63
  }.reject do |_k, v|
@@ -62,9 +73,11 @@ module TrophyApiClient
62
73
  struct = JSON.parse(json_object, object_class: OpenStruct)
63
74
  parsed_json = JSON.parse(json_object)
64
75
  id = parsed_json["id"]
76
+ key = parsed_json["key"]
65
77
  name = parsed_json["name"]
66
78
  description = parsed_json["description"]
67
79
  badge_url = parsed_json["badgeUrl"]
80
+ max_points = parsed_json["maxPoints"]
68
81
  total = parsed_json["total"]
69
82
  awards = parsed_json["awards"]&.map do |item|
70
83
  item = item.to_json
@@ -72,9 +85,11 @@ module TrophyApiClient
72
85
  end
73
86
  new(
74
87
  id: id,
88
+ key: key,
75
89
  name: name,
76
90
  description: description,
77
91
  badge_url: badge_url,
92
+ max_points: max_points,
78
93
  total: total,
79
94
  awards: awards,
80
95
  additional_properties: struct
@@ -96,10 +111,12 @@ module TrophyApiClient
96
111
  # @return [Void]
97
112
  def self.validate_raw(obj:)
98
113
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
114
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
99
115
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
100
116
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
101
117
  obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
102
- obj.total.is_a?(Float) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
118
+ obj.max_points&.is_a?(Float) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
119
+ obj.total.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
103
120
  obj.awards.is_a?(Array) != false || raise("Passed value for field obj.awards is not the expected type, validation failed.")
104
121
  end
105
122
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "leaderboard_response_status"
4
3
  require_relative "leaderboard_response_rank_by"
4
+ require_relative "leaderboard_response_run_unit"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -14,8 +14,6 @@ module TrophyApiClient
14
14
  attr_reader :name
15
15
  # @return [String] The unique key used to reference the leaderboard in APIs.
16
16
  attr_reader :key
17
- # @return [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
18
- attr_reader :status
19
17
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
20
18
  attr_reader :rank_by
21
19
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
@@ -35,7 +33,7 @@ module TrophyApiClient
35
33
  attr_reader :end_
36
34
  # @return [Integer] The maximum number of participants in the leaderboard.
37
35
  attr_reader :max_participants
38
- # @return [String] The repetition type for recurring leaderboards, or null for one-time
36
+ # @return [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
39
37
  # leaderboards.
40
38
  attr_reader :run_unit
41
39
  # @return [Integer] The interval between repetitions, relative to the start date and repetition
@@ -52,7 +50,6 @@ module TrophyApiClient
52
50
  # @param id [String] The unique ID of the leaderboard.
53
51
  # @param name [String] The user-facing name of the leaderboard.
54
52
  # @param key [String] The unique key used to reference the leaderboard in APIs.
55
- # @param status [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
56
53
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
57
54
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
58
55
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -63,24 +60,23 @@ module TrophyApiClient
63
60
  # @param end_ [String] The end date of the leaderboard in YYYY-MM-DD format, or null if it runs
64
61
  # forever.
65
62
  # @param max_participants [Integer] The maximum number of participants in the leaderboard.
66
- # @param run_unit [String] The repetition type for recurring leaderboards, or null for one-time
63
+ # @param run_unit [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
67
64
  # leaderboards.
68
65
  # @param run_interval [Integer] The interval between repetitions, relative to the start date and repetition
69
66
  # type.
70
67
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
71
68
  # @return [TrophyApiClient::LeaderboardResponse]
72
- def initialize(id:, name:, key:, rank_by:, start:, max_participants:, run_interval:, status: OMIT, metric_key: OMIT, metric_name: OMIT,
73
- points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
69
+ def initialize(id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT,
70
+ points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
74
71
  @id = id
75
72
  @name = name
76
73
  @key = key
77
- @status = status if status != OMIT
78
74
  @rank_by = rank_by
79
75
  @metric_key = metric_key if metric_key != OMIT
80
76
  @metric_name = metric_name if metric_name != OMIT
81
77
  @points_system_key = points_system_key if points_system_key != OMIT
82
78
  @points_system_name = points_system_name if points_system_name != OMIT
83
- @description = description if description != OMIT
79
+ @description = description
84
80
  @start = start
85
81
  @end_ = end_ if end_ != OMIT
86
82
  @max_participants = max_participants
@@ -91,7 +87,6 @@ module TrophyApiClient
91
87
  "id": id,
92
88
  "name": name,
93
89
  "key": key,
94
- "status": status,
95
90
  "rankBy": rank_by,
96
91
  "metricKey": metric_key,
97
92
  "metricName": metric_name,
@@ -118,7 +113,6 @@ module TrophyApiClient
118
113
  id = parsed_json["id"]
119
114
  name = parsed_json["name"]
120
115
  key = parsed_json["key"]
121
- status = parsed_json["status"]
122
116
  rank_by = parsed_json["rankBy"]
123
117
  metric_key = parsed_json["metricKey"]
124
118
  metric_name = parsed_json["metricName"]
@@ -134,7 +128,6 @@ module TrophyApiClient
134
128
  id: id,
135
129
  name: name,
136
130
  key: key,
137
- status: status,
138
131
  rank_by: rank_by,
139
132
  metric_key: metric_key,
140
133
  metric_name: metric_name,
@@ -167,17 +160,16 @@ module TrophyApiClient
167
160
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
168
161
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
169
162
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
170
- obj.status&.is_a?(TrophyApiClient::LeaderboardResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
171
163
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
172
164
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
173
165
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
174
166
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
175
167
  obj.points_system_name&.is_a?(String) != false || raise("Passed value for field obj.points_system_name is not the expected type, validation failed.")
176
- obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
168
+ obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
177
169
  obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
178
170
  obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
179
171
  obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
180
- obj.run_unit&.is_a?(String) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
172
+ obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
181
173
  obj.run_interval.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
182
174
  end
183
175
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TrophyApiClient
4
+ # The repetition type for recurring leaderboards, or null for one-time
5
+ # leaderboards.
6
+ class LeaderboardResponseRunUnit
7
+ DAY = "day"
8
+ MONTH = "month"
9
+ YEAR = "year"
10
+ end
11
+ end
@@ -1,13 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "leaderboard_response_with_rankings_status"
3
4
  require_relative "leaderboard_ranking"
4
- require_relative "leaderboard_response_status"
5
5
  require_relative "leaderboard_response_rank_by"
6
+ require_relative "leaderboard_response_run_unit"
6
7
  require "ostruct"
7
8
  require "json"
8
9
 
9
10
  module TrophyApiClient
10
11
  class LeaderboardResponseWithRankings
12
+ # @return [TrophyApiClient::LeaderboardResponseWithRankingsStatus] The status of the leaderboard.
13
+ attr_reader :status
11
14
  # @return [Array<TrophyApiClient::LeaderboardRanking>] Array of user rankings for the leaderboard.
12
15
  attr_reader :rankings
13
16
  # @return [String] The unique ID of the leaderboard.
@@ -16,8 +19,6 @@ module TrophyApiClient
16
19
  attr_reader :name
17
20
  # @return [String] The unique key used to reference the leaderboard in APIs.
18
21
  attr_reader :key
19
- # @return [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
20
- attr_reader :status
21
22
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
22
23
  attr_reader :rank_by
23
24
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
@@ -37,7 +38,7 @@ module TrophyApiClient
37
38
  attr_reader :end_
38
39
  # @return [Integer] The maximum number of participants in the leaderboard.
39
40
  attr_reader :max_participants
40
- # @return [String] The repetition type for recurring leaderboards, or null for one-time
41
+ # @return [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
41
42
  # leaderboards.
42
43
  attr_reader :run_unit
43
44
  # @return [Integer] The interval between repetitions, relative to the start date and repetition
@@ -51,11 +52,11 @@ module TrophyApiClient
51
52
 
52
53
  OMIT = Object.new
53
54
 
55
+ # @param status [TrophyApiClient::LeaderboardResponseWithRankingsStatus] The status of the leaderboard.
54
56
  # @param rankings [Array<TrophyApiClient::LeaderboardRanking>] Array of user rankings for the leaderboard.
55
57
  # @param id [String] The unique ID of the leaderboard.
56
58
  # @param name [String] The user-facing name of the leaderboard.
57
59
  # @param key [String] The unique key used to reference the leaderboard in APIs.
58
- # @param status [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
59
60
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
60
61
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
61
62
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -66,25 +67,25 @@ module TrophyApiClient
66
67
  # @param end_ [String] The end date of the leaderboard in YYYY-MM-DD format, or null if it runs
67
68
  # forever.
68
69
  # @param max_participants [Integer] The maximum number of participants in the leaderboard.
69
- # @param run_unit [String] The repetition type for recurring leaderboards, or null for one-time
70
+ # @param run_unit [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
70
71
  # leaderboards.
71
72
  # @param run_interval [Integer] The interval between repetitions, relative to the start date and repetition
72
73
  # type.
73
74
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
74
75
  # @return [TrophyApiClient::LeaderboardResponseWithRankings]
75
- def initialize(rankings:, id:, name:, key:, rank_by:, start:, max_participants:, run_interval:, status: OMIT, metric_key: OMIT, metric_name: OMIT,
76
- points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
76
+ def initialize(status:, rankings:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, metric_key: OMIT, metric_name: OMIT,
77
+ points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
78
+ @status = status
77
79
  @rankings = rankings
78
80
  @id = id
79
81
  @name = name
80
82
  @key = key
81
- @status = status if status != OMIT
82
83
  @rank_by = rank_by
83
84
  @metric_key = metric_key if metric_key != OMIT
84
85
  @metric_name = metric_name if metric_name != OMIT
85
86
  @points_system_key = points_system_key if points_system_key != OMIT
86
87
  @points_system_name = points_system_name if points_system_name != OMIT
87
- @description = description if description != OMIT
88
+ @description = description
88
89
  @start = start
89
90
  @end_ = end_ if end_ != OMIT
90
91
  @max_participants = max_participants
@@ -92,11 +93,11 @@ module TrophyApiClient
92
93
  @run_interval = run_interval
93
94
  @additional_properties = additional_properties
94
95
  @_field_set = {
96
+ "status": status,
95
97
  "rankings": rankings,
96
98
  "id": id,
97
99
  "name": name,
98
100
  "key": key,
99
- "status": status,
100
101
  "rankBy": rank_by,
101
102
  "metricKey": metric_key,
102
103
  "metricName": metric_name,
@@ -120,6 +121,7 @@ module TrophyApiClient
120
121
  def self.from_json(json_object:)
121
122
  struct = JSON.parse(json_object, object_class: OpenStruct)
122
123
  parsed_json = JSON.parse(json_object)
124
+ status = parsed_json["status"]
123
125
  rankings = parsed_json["rankings"]&.map do |item|
124
126
  item = item.to_json
125
127
  TrophyApiClient::LeaderboardRanking.from_json(json_object: item)
@@ -127,7 +129,6 @@ module TrophyApiClient
127
129
  id = parsed_json["id"]
128
130
  name = parsed_json["name"]
129
131
  key = parsed_json["key"]
130
- status = parsed_json["status"]
131
132
  rank_by = parsed_json["rankBy"]
132
133
  metric_key = parsed_json["metricKey"]
133
134
  metric_name = parsed_json["metricName"]
@@ -140,11 +141,11 @@ module TrophyApiClient
140
141
  run_unit = parsed_json["runUnit"]
141
142
  run_interval = parsed_json["runInterval"]
142
143
  new(
144
+ status: status,
143
145
  rankings: rankings,
144
146
  id: id,
145
147
  name: name,
146
148
  key: key,
147
- status: status,
148
149
  rank_by: rank_by,
149
150
  metric_key: metric_key,
150
151
  metric_name: metric_name,
@@ -174,21 +175,21 @@ module TrophyApiClient
174
175
  # @param obj [Object]
175
176
  # @return [Void]
176
177
  def self.validate_raw(obj:)
178
+ obj.status.is_a?(TrophyApiClient::LeaderboardResponseWithRankingsStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
177
179
  obj.rankings.is_a?(Array) != false || raise("Passed value for field obj.rankings is not the expected type, validation failed.")
178
180
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
179
181
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
180
182
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
181
- obj.status&.is_a?(TrophyApiClient::LeaderboardResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
182
183
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
183
184
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
184
185
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
185
186
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
186
187
  obj.points_system_name&.is_a?(String) != false || raise("Passed value for field obj.points_system_name is not the expected type, validation failed.")
187
- obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
188
+ obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
188
189
  obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
189
190
  obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
190
191
  obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
191
- obj.run_unit&.is_a?(String) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
192
+ obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
192
193
  obj.run_interval.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
193
194
  end
194
195
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  # The status of the leaderboard.
5
- class LeaderboardResponseStatus
5
+ class LeaderboardResponseWithRankingsStatus
6
6
  ACTIVE = "active"
7
7
  SCHEDULED = "scheduled"
8
8
  FINISHED = "finished"