trophy_api_client 1.2.1 → 1.4.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/trophy_api_client/admin/points/boosts/client.rb +13 -11
  4. data/lib/trophy_api_client/admin/streaks/client.rb +10 -6
  5. data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -2
  6. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +12 -4
  7. data/lib/trophy_api_client/types/achievement_response.rb +23 -11
  8. data/lib/trophy_api_client/types/achievement_response_event_attribute.rb +2 -2
  9. data/lib/trophy_api_client/types/achievement_response_event_attributes_item.rb +66 -0
  10. data/lib/trophy_api_client/types/achievement_with_stats_response.rb +23 -11
  11. data/lib/trophy_api_client/types/admin_issue.rb +98 -0
  12. data/lib/trophy_api_client/types/{bulk_insert_issue_level.rb → admin_issue_severity.rb} +1 -1
  13. data/lib/trophy_api_client/types/create_points_boosts_response.rb +4 -4
  14. data/lib/trophy_api_client/types/create_streak_freezes_response.rb +4 -4
  15. data/lib/trophy_api_client/types/delete_points_boosts_response.rb +75 -0
  16. data/lib/trophy_api_client/types/{archive_points_boosts_response.rb → deleted_resource.rb} +15 -15
  17. data/lib/trophy_api_client/types/leaderboard_response.rb +12 -4
  18. data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +12 -4
  19. data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +30 -8
  20. data/lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb +67 -0
  21. data/lib/trophy_api_client/types/points_system_response.rb +4 -4
  22. data/lib/trophy_api_client/types/points_trigger.rb +101 -9
  23. data/lib/trophy_api_client/types/{points_trigger_response_event_attribute.rb → points_trigger_event_attribute.rb} +7 -7
  24. data/lib/trophy_api_client/types/points_trigger_event_attributes_item.rb +65 -0
  25. data/lib/trophy_api_client/types/{points_trigger_response_status.rb → points_trigger_status.rb} +2 -1
  26. data/lib/trophy_api_client/types/{points_trigger_response_user_attributes_item.rb → points_trigger_user_attributes_item.rb} +7 -9
  27. data/lib/trophy_api_client/types/restore_streaks_response.rb +4 -4
  28. data/lib/trophy_api_client/types/streak_response.rb +4 -2
  29. data/lib/trophy_api_client/types/user_achievement_response.rb +23 -11
  30. data/lib/trophy_api_client/types/user_achievement_with_stats_response.rb +23 -11
  31. data/lib/trophy_api_client/types/user_leaderboard_response.rb +12 -4
  32. data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +12 -4
  33. data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +11 -3
  34. data/lib/trophy_api_client/version.rb +1 -1
  35. data/lib/types_export.rb +10 -9
  36. metadata +11 -10
  37. data/lib/trophy_api_client/types/bulk_insert_issue.rb +0 -74
  38. data/lib/trophy_api_client/types/points_trigger_response.rb +0 -211
  39. data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +0 -9
  40. data/lib/trophy_api_client/types/points_trigger_response_type.rb +0 -12
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "created_points_boost"
4
- require_relative "bulk_insert_issue"
4
+ require_relative "admin_issue"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -11,7 +11,7 @@ module TrophyApiClient
11
11
  class CreatePointsBoostsResponse
12
12
  # @return [Array<TrophyApiClient::CreatedPointsBoost>] Array of successfully created boosts.
13
13
  attr_reader :created
14
- # @return [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during boost creation.
14
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
15
15
  attr_reader :issues
16
16
  # @return [OpenStruct] Additional properties unmapped to the current class definition
17
17
  attr_reader :additional_properties
@@ -22,7 +22,7 @@ module TrophyApiClient
22
22
  OMIT = Object.new
23
23
 
24
24
  # @param created [Array<TrophyApiClient::CreatedPointsBoost>] Array of successfully created boosts.
25
- # @param issues [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during boost creation.
25
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
26
26
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
27
  # @return [TrophyApiClient::CreatePointsBoostsResponse]
28
28
  def initialize(created:, issues:, additional_properties: nil)
@@ -45,7 +45,7 @@ module TrophyApiClient
45
45
  end
46
46
  issues = parsed_json["issues"]&.map do |item|
47
47
  item = item.to_json
48
- TrophyApiClient::BulkInsertIssue.from_json(json_object: item)
48
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
49
49
  end
50
50
  new(
51
51
  created: created,
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "bulk_insert_issue"
3
+ require_relative "admin_issue"
4
4
  require "ostruct"
5
5
  require "json"
6
6
 
7
7
  module TrophyApiClient
8
8
  # Response containing any issues encountered while creating streak freezes.
9
9
  class CreateStreakFreezesResponse
10
- # @return [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during freeze creation.
10
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during freeze creation.
11
11
  attr_reader :issues
12
12
  # @return [OpenStruct] Additional properties unmapped to the current class definition
13
13
  attr_reader :additional_properties
@@ -17,7 +17,7 @@ module TrophyApiClient
17
17
 
18
18
  OMIT = Object.new
19
19
 
20
- # @param issues [Array<TrophyApiClient::BulkInsertIssue>] Array of issues encountered during freeze creation.
20
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during freeze creation.
21
21
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
22
  # @return [TrophyApiClient::CreateStreakFreezesResponse]
23
23
  def initialize(issues:, additional_properties: nil)
@@ -35,7 +35,7 @@ module TrophyApiClient
35
35
  parsed_json = JSON.parse(json_object)
36
36
  issues = parsed_json["issues"]&.map do |item|
37
37
  item = item.to_json
38
- TrophyApiClient::BulkInsertIssue.from_json(json_object: item)
38
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
39
39
  end
40
40
  new(issues: issues, additional_properties: struct)
41
41
  end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "deleted_resource"
4
+ require_relative "admin_issue"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module TrophyApiClient
9
+ # Response containing the points boosts that were archived and any per-item
10
+ # issues.
11
+ class DeletePointsBoostsResponse
12
+ # @return [Array<TrophyApiClient::DeletedResource>] Array of archived points boosts represented by ID.
13
+ attr_reader :deleted
14
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost archival.
15
+ attr_reader :issues
16
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
17
+ attr_reader :additional_properties
18
+ # @return [Object]
19
+ attr_reader :_field_set
20
+ protected :_field_set
21
+
22
+ OMIT = Object.new
23
+
24
+ # @param deleted [Array<TrophyApiClient::DeletedResource>] Array of archived points boosts represented by ID.
25
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost archival.
26
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
28
+ def initialize(deleted:, issues:, additional_properties: nil)
29
+ @deleted = deleted
30
+ @issues = issues
31
+ @additional_properties = additional_properties
32
+ @_field_set = { "deleted": deleted, "issues": issues }
33
+ end
34
+
35
+ # Deserialize a JSON object to an instance of DeletePointsBoostsResponse
36
+ #
37
+ # @param json_object [String]
38
+ # @return [TrophyApiClient::DeletePointsBoostsResponse]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ deleted = parsed_json["deleted"]&.map do |item|
43
+ item = item.to_json
44
+ TrophyApiClient::DeletedResource.from_json(json_object: item)
45
+ end
46
+ issues = parsed_json["issues"]&.map do |item|
47
+ item = item.to_json
48
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
49
+ end
50
+ new(
51
+ deleted: deleted,
52
+ issues: issues,
53
+ additional_properties: struct
54
+ )
55
+ end
56
+
57
+ # Serialize an instance of DeletePointsBoostsResponse to a JSON object
58
+ #
59
+ # @return [String]
60
+ def to_json(*_args)
61
+ @_field_set&.to_json
62
+ end
63
+
64
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
65
+ # hash and check each fields type against the current object's property
66
+ # definitions.
67
+ #
68
+ # @param obj [Object]
69
+ # @return [Void]
70
+ def self.validate_raw(obj:)
71
+ obj.deleted.is_a?(Array) != false || raise("Passed value for field obj.deleted is not the expected type, validation failed.")
72
+ obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
73
+ end
74
+ end
75
+ end
@@ -4,10 +4,10 @@ require "ostruct"
4
4
  require "json"
5
5
 
6
6
  module TrophyApiClient
7
- # Response containing the count of archived points boosts.
8
- class ArchivePointsBoostsResponse
9
- # @return [Integer] The number of boosts that were archived.
10
- attr_reader :archived_count
7
+ # A soft-deleted resource represented by ID.
8
+ class DeletedResource
9
+ # @return [String] The ID of the archived resource.
10
+ attr_reader :id
11
11
  # @return [OpenStruct] Additional properties unmapped to the current class definition
12
12
  attr_reader :additional_properties
13
13
  # @return [Object]
@@ -16,27 +16,27 @@ module TrophyApiClient
16
16
 
17
17
  OMIT = Object.new
18
18
 
19
- # @param archived_count [Integer] The number of boosts that were archived.
19
+ # @param id [String] The ID of the archived resource.
20
20
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
21
- # @return [TrophyApiClient::ArchivePointsBoostsResponse]
22
- def initialize(archived_count:, additional_properties: nil)
23
- @archived_count = archived_count
21
+ # @return [TrophyApiClient::DeletedResource]
22
+ def initialize(id:, additional_properties: nil)
23
+ @id = id
24
24
  @additional_properties = additional_properties
25
- @_field_set = { "archivedCount": archived_count }
25
+ @_field_set = { "id": id }
26
26
  end
27
27
 
28
- # Deserialize a JSON object to an instance of ArchivePointsBoostsResponse
28
+ # Deserialize a JSON object to an instance of DeletedResource
29
29
  #
30
30
  # @param json_object [String]
31
- # @return [TrophyApiClient::ArchivePointsBoostsResponse]
31
+ # @return [TrophyApiClient::DeletedResource]
32
32
  def self.from_json(json_object:)
33
33
  struct = JSON.parse(json_object, object_class: OpenStruct)
34
34
  parsed_json = JSON.parse(json_object)
35
- archived_count = parsed_json["archivedCount"]
36
- new(archived_count: archived_count, additional_properties: struct)
35
+ id = parsed_json["id"]
36
+ new(id: id, additional_properties: struct)
37
37
  end
38
38
 
39
- # Serialize an instance of ArchivePointsBoostsResponse to a JSON object
39
+ # Serialize an instance of DeletedResource to a JSON object
40
40
  #
41
41
  # @return [String]
42
42
  def to_json(*_args)
@@ -50,7 +50,7 @@ module TrophyApiClient
50
50
  # @param obj [Object]
51
51
  # @return [Void]
52
52
  def self.validate_raw(obj:)
53
- obj.archived_count.is_a?(Integer) != false || raise("Passed value for field obj.archived_count is not the expected type, validation failed.")
53
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
54
54
  end
55
55
  end
56
56
  end
@@ -16,8 +16,10 @@ module TrophyApiClient
16
16
  attr_reader :key
17
17
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
18
18
  attr_reader :rank_by
19
- # @return [String] The key of the attribute to break down this leaderboard by.
19
+ # @return [String] Deprecated. The key of the attribute to break down this leaderboard by.
20
20
  attr_reader :breakdown_attribute
21
+ # @return [Array<String>] The user attribute keys that this leaderboard is broken down by.
22
+ attr_reader :breakdown_attributes
21
23
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
22
24
  attr_reader :metric_key
23
25
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -53,7 +55,8 @@ module TrophyApiClient
53
55
  # @param name [String] The user-facing name of the leaderboard.
54
56
  # @param key [String] The unique key used to reference the leaderboard in APIs.
55
57
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
56
- # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
58
+ # @param breakdown_attribute [String] Deprecated. The key of the attribute to break down this leaderboard by.
59
+ # @param breakdown_attributes [Array<String>] The user attribute keys that this leaderboard is broken down by.
57
60
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
58
61
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
59
62
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -69,13 +72,14 @@ module TrophyApiClient
69
72
  # type. Null for one-time leaderboards.
70
73
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
71
74
  # @return [TrophyApiClient::LeaderboardResponse]
72
- def initialize(id:, name:, key:, rank_by:, start:, max_participants:, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT,
73
- points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
75
+ def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, breakdown_attribute: OMIT, metric_key: OMIT,
76
+ metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
74
77
  @id = id
75
78
  @name = name
76
79
  @key = key
77
80
  @rank_by = rank_by
78
81
  @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
82
+ @breakdown_attributes = breakdown_attributes
79
83
  @metric_key = metric_key if metric_key != OMIT
80
84
  @metric_name = metric_name if metric_name != OMIT
81
85
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -93,6 +97,7 @@ module TrophyApiClient
93
97
  "key": key,
94
98
  "rankBy": rank_by,
95
99
  "breakdownAttribute": breakdown_attribute,
100
+ "breakdownAttributes": breakdown_attributes,
96
101
  "metricKey": metric_key,
97
102
  "metricName": metric_name,
98
103
  "pointsSystemKey": points_system_key,
@@ -120,6 +125,7 @@ module TrophyApiClient
120
125
  key = parsed_json["key"]
121
126
  rank_by = parsed_json["rankBy"]
122
127
  breakdown_attribute = parsed_json["breakdownAttribute"]
128
+ breakdown_attributes = parsed_json["breakdownAttributes"]
123
129
  metric_key = parsed_json["metricKey"]
124
130
  metric_name = parsed_json["metricName"]
125
131
  points_system_key = parsed_json["pointsSystemKey"]
@@ -136,6 +142,7 @@ module TrophyApiClient
136
142
  key: key,
137
143
  rank_by: rank_by,
138
144
  breakdown_attribute: breakdown_attribute,
145
+ breakdown_attributes: breakdown_attributes,
139
146
  metric_key: metric_key,
140
147
  metric_name: metric_name,
141
148
  points_system_key: points_system_key,
@@ -169,6 +176,7 @@ module TrophyApiClient
169
176
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
170
177
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
171
178
  obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
179
+ obj.breakdown_attributes.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
172
180
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
173
181
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
174
182
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -21,8 +21,10 @@ module TrophyApiClient
21
21
  attr_reader :key
22
22
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
23
23
  attr_reader :rank_by
24
- # @return [String] The key of the attribute to break down this leaderboard by.
24
+ # @return [String] Deprecated. The key of the attribute to break down this leaderboard by.
25
25
  attr_reader :breakdown_attribute
26
+ # @return [Array<String>] The user attribute keys that this leaderboard is broken down by.
27
+ attr_reader :breakdown_attributes
26
28
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
27
29
  attr_reader :metric_key
28
30
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -60,7 +62,8 @@ module TrophyApiClient
60
62
  # @param name [String] The user-facing name of the leaderboard.
61
63
  # @param key [String] The unique key used to reference the leaderboard in APIs.
62
64
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
63
- # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
65
+ # @param breakdown_attribute [String] Deprecated. The key of the attribute to break down this leaderboard by.
66
+ # @param breakdown_attributes [Array<String>] The user attribute keys that this leaderboard is broken down by.
64
67
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
65
68
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
66
69
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -76,8 +79,8 @@ module TrophyApiClient
76
79
  # type. Null for one-time leaderboards.
77
80
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
78
81
  # @return [TrophyApiClient::LeaderboardResponseWithRankings]
79
- def initialize(status:, rankings:, id:, name:, key:, rank_by:, start:, max_participants:, breakdown_attribute: OMIT, metric_key: OMIT,
80
- metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
82
+ def initialize(status:, rankings:, id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, breakdown_attribute: OMIT,
83
+ metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
81
84
  @status = status
82
85
  @rankings = rankings
83
86
  @id = id
@@ -85,6 +88,7 @@ module TrophyApiClient
85
88
  @key = key
86
89
  @rank_by = rank_by
87
90
  @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
91
+ @breakdown_attributes = breakdown_attributes
88
92
  @metric_key = metric_key if metric_key != OMIT
89
93
  @metric_name = metric_name if metric_name != OMIT
90
94
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -104,6 +108,7 @@ module TrophyApiClient
104
108
  "key": key,
105
109
  "rankBy": rank_by,
106
110
  "breakdownAttribute": breakdown_attribute,
111
+ "breakdownAttributes": breakdown_attributes,
107
112
  "metricKey": metric_key,
108
113
  "metricName": metric_name,
109
114
  "pointsSystemKey": points_system_key,
@@ -136,6 +141,7 @@ module TrophyApiClient
136
141
  key = parsed_json["key"]
137
142
  rank_by = parsed_json["rankBy"]
138
143
  breakdown_attribute = parsed_json["breakdownAttribute"]
144
+ breakdown_attributes = parsed_json["breakdownAttributes"]
139
145
  metric_key = parsed_json["metricKey"]
140
146
  metric_name = parsed_json["metricName"]
141
147
  points_system_key = parsed_json["pointsSystemKey"]
@@ -154,6 +160,7 @@ module TrophyApiClient
154
160
  key: key,
155
161
  rank_by: rank_by,
156
162
  breakdown_attribute: breakdown_attribute,
163
+ breakdown_attributes: breakdown_attributes,
157
164
  metric_key: metric_key,
158
165
  metric_name: metric_name,
159
166
  points_system_key: points_system_key,
@@ -189,6 +196,7 @@ module TrophyApiClient
189
196
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
190
197
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
191
198
  obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
199
+ obj.breakdown_attributes.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
192
200
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
193
201
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
194
202
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "metric_event_leaderboard_response_breakdown_attribute_values_item"
3
4
  require_relative "leaderboard_response_rank_by"
4
5
  require_relative "leaderboard_response_run_unit"
5
6
  require "ostruct"
@@ -19,9 +20,12 @@ module TrophyApiClient
19
20
  # @return [Integer] The minimum value required to enter the leaderboard according to its current
20
21
  # rankings.
21
22
  attr_reader :threshold
22
- # @return [String] For leaderboards with a breakdown attribute, the value of the attribute for the
23
- # user.
23
+ # @return [String] Deprecated. For leaderboards with a single breakdown attribute, the value of
24
+ # that attribute for the user.
24
25
  attr_reader :breakdown_attribute_value
26
+ # @return [Array<TrophyApiClient::MetricEventLeaderboardResponseBreakdownAttributeValuesItem>] For leaderboards with breakdown attributes, the user's values for each breakdown
27
+ # attribute.
28
+ attr_reader :breakdown_attribute_values
25
29
  # @return [String] The unique ID of the leaderboard.
26
30
  attr_reader :id
27
31
  # @return [String] The user-facing name of the leaderboard.
@@ -30,8 +34,10 @@ module TrophyApiClient
30
34
  attr_reader :key
31
35
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
32
36
  attr_reader :rank_by
33
- # @return [String] The key of the attribute to break down this leaderboard by.
37
+ # @return [String] Deprecated. The key of the attribute to break down this leaderboard by.
34
38
  attr_reader :breakdown_attribute
39
+ # @return [Array<String>] The user attribute keys that this leaderboard is broken down by.
40
+ attr_reader :breakdown_attributes
35
41
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
36
42
  attr_reader :metric_key
37
43
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -68,13 +74,16 @@ module TrophyApiClient
68
74
  # on the leaderboard before the event.
69
75
  # @param threshold [Integer] The minimum value required to enter the leaderboard according to its current
70
76
  # rankings.
71
- # @param breakdown_attribute_value [String] For leaderboards with a breakdown attribute, the value of the attribute for the
72
- # user.
77
+ # @param breakdown_attribute_value [String] Deprecated. For leaderboards with a single breakdown attribute, the value of
78
+ # that attribute for the user.
79
+ # @param breakdown_attribute_values [Array<TrophyApiClient::MetricEventLeaderboardResponseBreakdownAttributeValuesItem>] For leaderboards with breakdown attributes, the user's values for each breakdown
80
+ # attribute.
73
81
  # @param id [String] The unique ID of the leaderboard.
74
82
  # @param name [String] The user-facing name of the leaderboard.
75
83
  # @param key [String] The unique key used to reference the leaderboard in APIs.
76
84
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
77
- # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
85
+ # @param breakdown_attribute [String] Deprecated. The key of the attribute to break down this leaderboard by.
86
+ # @param breakdown_attributes [Array<String>] The user attribute keys that this leaderboard is broken down by.
78
87
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
79
88
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
80
89
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -88,18 +97,20 @@ module TrophyApiClient
88
97
  # type. Null for one-time leaderboards.
89
98
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
90
99
  # @return [TrophyApiClient::MetricEventLeaderboardResponse]
91
- def initialize(threshold:, id:, name:, key:, rank_by:, start:, max_participants:, end_: OMIT, rank: OMIT,
92
- previous_rank: OMIT, breakdown_attribute_value: OMIT, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
100
+ def initialize(threshold:, id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, end_: OMIT, rank: OMIT, previous_rank: OMIT, breakdown_attribute_value: OMIT,
101
+ breakdown_attribute_values: OMIT, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
93
102
  @end_ = end_ if end_ != OMIT
94
103
  @rank = rank if rank != OMIT
95
104
  @previous_rank = previous_rank if previous_rank != OMIT
96
105
  @threshold = threshold
97
106
  @breakdown_attribute_value = breakdown_attribute_value if breakdown_attribute_value != OMIT
107
+ @breakdown_attribute_values = breakdown_attribute_values if breakdown_attribute_values != OMIT
98
108
  @id = id
99
109
  @name = name
100
110
  @key = key
101
111
  @rank_by = rank_by
102
112
  @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
113
+ @breakdown_attributes = breakdown_attributes
103
114
  @metric_key = metric_key if metric_key != OMIT
104
115
  @metric_name = metric_name if metric_name != OMIT
105
116
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -116,11 +127,13 @@ module TrophyApiClient
116
127
  "previousRank": previous_rank,
117
128
  "threshold": threshold,
118
129
  "breakdownAttributeValue": breakdown_attribute_value,
130
+ "breakdownAttributeValues": breakdown_attribute_values,
119
131
  "id": id,
120
132
  "name": name,
121
133
  "key": key,
122
134
  "rankBy": rank_by,
123
135
  "breakdownAttribute": breakdown_attribute,
136
+ "breakdownAttributes": breakdown_attributes,
124
137
  "metricKey": metric_key,
125
138
  "metricName": metric_name,
126
139
  "pointsSystemKey": points_system_key,
@@ -147,11 +160,16 @@ module TrophyApiClient
147
160
  previous_rank = parsed_json["previousRank"]
148
161
  threshold = parsed_json["threshold"]
149
162
  breakdown_attribute_value = parsed_json["breakdownAttributeValue"]
163
+ breakdown_attribute_values = parsed_json["breakdownAttributeValues"]&.map do |item|
164
+ item = item.to_json
165
+ TrophyApiClient::MetricEventLeaderboardResponseBreakdownAttributeValuesItem.from_json(json_object: item)
166
+ end
150
167
  id = parsed_json["id"]
151
168
  name = parsed_json["name"]
152
169
  key = parsed_json["key"]
153
170
  rank_by = parsed_json["rankBy"]
154
171
  breakdown_attribute = parsed_json["breakdownAttribute"]
172
+ breakdown_attributes = parsed_json["breakdownAttributes"]
155
173
  metric_key = parsed_json["metricKey"]
156
174
  metric_name = parsed_json["metricName"]
157
175
  points_system_key = parsed_json["pointsSystemKey"]
@@ -167,11 +185,13 @@ module TrophyApiClient
167
185
  previous_rank: previous_rank,
168
186
  threshold: threshold,
169
187
  breakdown_attribute_value: breakdown_attribute_value,
188
+ breakdown_attribute_values: breakdown_attribute_values,
170
189
  id: id,
171
190
  name: name,
172
191
  key: key,
173
192
  rank_by: rank_by,
174
193
  breakdown_attribute: breakdown_attribute,
194
+ breakdown_attributes: breakdown_attributes,
175
195
  metric_key: metric_key,
176
196
  metric_name: metric_name,
177
197
  points_system_key: points_system_key,
@@ -204,11 +224,13 @@ module TrophyApiClient
204
224
  obj.previous_rank&.is_a?(Integer) != false || raise("Passed value for field obj.previous_rank is not the expected type, validation failed.")
205
225
  obj.threshold.is_a?(Integer) != false || raise("Passed value for field obj.threshold is not the expected type, validation failed.")
206
226
  obj.breakdown_attribute_value&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute_value is not the expected type, validation failed.")
227
+ obj.breakdown_attribute_values&.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attribute_values is not the expected type, validation failed.")
207
228
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
208
229
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
209
230
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
210
231
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
211
232
  obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
233
+ obj.breakdown_attributes.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
212
234
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
213
235
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
214
236
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module TrophyApiClient
7
+ class MetricEventLeaderboardResponseBreakdownAttributeValuesItem
8
+ # @return [String] The key of the breakdown attribute.
9
+ attr_reader :key
10
+ # @return [String] The user's value for the breakdown attribute.
11
+ attr_reader :value
12
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
13
+ attr_reader :additional_properties
14
+ # @return [Object]
15
+ attr_reader :_field_set
16
+ protected :_field_set
17
+
18
+ OMIT = Object.new
19
+
20
+ # @param key [String] The key of the breakdown attribute.
21
+ # @param value [String] The user's value for the breakdown attribute.
22
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
+ # @return [TrophyApiClient::MetricEventLeaderboardResponseBreakdownAttributeValuesItem]
24
+ def initialize(key:, value:, additional_properties: nil)
25
+ @key = key
26
+ @value = value
27
+ @additional_properties = additional_properties
28
+ @_field_set = { "key": key, "value": value }
29
+ end
30
+
31
+ # Deserialize a JSON object to an instance of
32
+ # MetricEventLeaderboardResponseBreakdownAttributeValuesItem
33
+ #
34
+ # @param json_object [String]
35
+ # @return [TrophyApiClient::MetricEventLeaderboardResponseBreakdownAttributeValuesItem]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ key = parsed_json["key"]
40
+ value = parsed_json["value"]
41
+ new(
42
+ key: key,
43
+ value: value,
44
+ additional_properties: struct
45
+ )
46
+ end
47
+
48
+ # Serialize an instance of
49
+ # MetricEventLeaderboardResponseBreakdownAttributeValuesItem to a JSON object
50
+ #
51
+ # @return [String]
52
+ def to_json(*_args)
53
+ @_field_set&.to_json
54
+ end
55
+
56
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
57
+ # hash and check each fields type against the current object's property
58
+ # definitions.
59
+ #
60
+ # @param obj [Object]
61
+ # @return [Void]
62
+ def self.validate_raw(obj:)
63
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
64
+ obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
65
+ end
66
+ end
67
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "points_trigger_response"
3
+ require_relative "points_trigger"
4
4
  require "ostruct"
5
5
  require "json"
6
6
 
@@ -16,7 +16,7 @@ module TrophyApiClient
16
16
  attr_reader :badge_url
17
17
  # @return [Float] The maximum number of points a user can be awarded in this points system
18
18
  attr_reader :max_points
19
- # @return [Array<TrophyApiClient::PointsTriggerResponse>] Array of active triggers for this points system.
19
+ # @return [Array<TrophyApiClient::PointsTrigger>] Array of active triggers for this points system.
20
20
  attr_reader :triggers
21
21
  # @return [OpenStruct] Additional properties unmapped to the current class definition
22
22
  attr_reader :additional_properties
@@ -31,7 +31,7 @@ module TrophyApiClient
31
31
  # @param description [String] The description of the points system.
32
32
  # @param badge_url [String] The URL of the badge image for the points system, if one has been uploaded.
33
33
  # @param max_points [Float] The maximum number of points a user can be awarded in this points system
34
- # @param triggers [Array<TrophyApiClient::PointsTriggerResponse>] Array of active triggers for this points system.
34
+ # @param triggers [Array<TrophyApiClient::PointsTrigger>] Array of active triggers for this points system.
35
35
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
36
36
  # @return [TrophyApiClient::PointsSystemResponse]
37
37
  def initialize(id:, name:, triggers:, description: OMIT, badge_url: OMIT, max_points: OMIT,
@@ -69,7 +69,7 @@ module TrophyApiClient
69
69
  max_points = parsed_json["maxPoints"]
70
70
  triggers = parsed_json["triggers"]&.map do |item|
71
71
  item = item.to_json
72
- TrophyApiClient::PointsTriggerResponse.from_json(json_object: item)
72
+ TrophyApiClient::PointsTrigger.from_json(json_object: item)
73
73
  end
74
74
  new(
75
75
  id: id,