trophy_api_client 1.2.1 → 1.3.4

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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +12 -4
  4. data/lib/trophy_api_client/types/achievement_response.rb +23 -11
  5. data/lib/trophy_api_client/types/achievement_response_event_attribute.rb +2 -2
  6. data/lib/trophy_api_client/types/achievement_response_event_attributes_item.rb +66 -0
  7. data/lib/trophy_api_client/types/achievement_with_stats_response.rb +23 -11
  8. data/lib/trophy_api_client/types/leaderboard_response.rb +12 -4
  9. data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +12 -4
  10. data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +30 -8
  11. data/lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb +67 -0
  12. data/lib/trophy_api_client/types/points_system_response.rb +4 -4
  13. data/lib/trophy_api_client/types/points_trigger.rb +101 -9
  14. data/lib/trophy_api_client/types/{points_trigger_response_event_attribute.rb → points_trigger_event_attribute.rb} +7 -7
  15. data/lib/trophy_api_client/types/points_trigger_event_attributes_item.rb +65 -0
  16. data/lib/trophy_api_client/types/{points_trigger_response_status.rb → points_trigger_status.rb} +2 -1
  17. data/lib/trophy_api_client/types/{points_trigger_response_user_attributes_item.rb → points_trigger_user_attributes_item.rb} +7 -9
  18. data/lib/trophy_api_client/types/streak_response.rb +4 -2
  19. data/lib/trophy_api_client/types/user_achievement_response.rb +23 -11
  20. data/lib/trophy_api_client/types/user_achievement_with_stats_response.rb +23 -11
  21. data/lib/trophy_api_client/types/user_leaderboard_response.rb +12 -4
  22. data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +12 -4
  23. data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +11 -3
  24. data/lib/trophy_api_client/version.rb +1 -1
  25. data/lib/types_export.rb +6 -6
  26. metadata +7 -7
  27. data/lib/trophy_api_client/types/points_trigger_response.rb +0 -211
  28. data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +0 -9
  29. data/lib/trophy_api_client/types/points_trigger_response_type.rb +0 -12
@@ -4,6 +4,7 @@ require "date"
4
4
  require_relative "achievement_response_trigger"
5
5
  require_relative "achievement_response_user_attributes_item"
6
6
  require_relative "achievement_response_event_attribute"
7
+ require_relative "achievement_response_event_attributes_item"
7
8
  require "ostruct"
8
9
  require "json"
9
10
 
@@ -45,11 +46,13 @@ module TrophyApiClient
45
46
  # trigger = 'metric')
46
47
  attr_reader :metric_name
47
48
  # @return [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
48
- # Only present if the achievement has user attribute filters configured.
49
49
  attr_reader :user_attributes
50
- # @return [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
51
- # Only present if the achievement has an event filter configured.
50
+ # @return [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
51
+ # completed. Only present if the achievement has an event filter configured.
52
52
  attr_reader :event_attribute
53
+ # @return [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
54
+ # Omitted for non-metric achievements.
55
+ attr_reader :event_attributes
53
56
  # @return [OpenStruct] Additional properties unmapped to the current class definition
54
57
  attr_reader :additional_properties
55
58
  # @return [Object]
@@ -80,13 +83,14 @@ module TrophyApiClient
80
83
  # @param metric_name [String] The name of the metric associated with this achievement (only applicable if
81
84
  # trigger = 'metric')
82
85
  # @param user_attributes [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
83
- # Only present if the achievement has user attribute filters configured.
84
- # @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
85
- # Only present if the achievement has an event filter configured.
86
+ # @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
87
+ # completed. Only present if the achievement has an event filter configured.
88
+ # @param event_attributes [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
89
+ # Omitted for non-metric achievements.
86
90
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
87
91
  # @return [TrophyApiClient::UserAchievementWithStatsResponse]
88
- def initialize(completions:, rarity:, id:, name:, trigger:, achieved_at: OMIT, description: OMIT, badge_url: OMIT,
89
- key: OMIT, streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, user_attributes: OMIT, event_attribute: OMIT, additional_properties: nil)
92
+ def initialize(completions:, rarity:, id:, name:, trigger:, user_attributes:, achieved_at: OMIT, description: OMIT, badge_url: OMIT,
93
+ key: OMIT, streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, event_attribute: OMIT, event_attributes: OMIT, additional_properties: nil)
90
94
  @achieved_at = achieved_at if achieved_at != OMIT
91
95
  @completions = completions
92
96
  @rarity = rarity
@@ -101,8 +105,9 @@ module TrophyApiClient
101
105
  @metric_id = metric_id if metric_id != OMIT
102
106
  @metric_value = metric_value if metric_value != OMIT
103
107
  @metric_name = metric_name if metric_name != OMIT
104
- @user_attributes = user_attributes if user_attributes != OMIT
108
+ @user_attributes = user_attributes
105
109
  @event_attribute = event_attribute if event_attribute != OMIT
110
+ @event_attributes = event_attributes if event_attributes != OMIT
106
111
  @additional_properties = additional_properties
107
112
  @_field_set = {
108
113
  "achievedAt": achieved_at,
@@ -120,7 +125,8 @@ module TrophyApiClient
120
125
  "metricValue": metric_value,
121
126
  "metricName": metric_name,
122
127
  "userAttributes": user_attributes,
123
- "eventAttribute": event_attribute
128
+ "eventAttribute": event_attribute,
129
+ "eventAttributes": event_attributes
124
130
  }.reject do |_k, v|
125
131
  v == OMIT
126
132
  end
@@ -157,6 +163,10 @@ module TrophyApiClient
157
163
  event_attribute = parsed_json["eventAttribute"].to_json
158
164
  event_attribute = TrophyApiClient::AchievementResponseEventAttribute.from_json(json_object: event_attribute)
159
165
  end
166
+ event_attributes = parsed_json["eventAttributes"]&.map do |item|
167
+ item = item.to_json
168
+ TrophyApiClient::AchievementResponseEventAttributesItem.from_json(json_object: item)
169
+ end
160
170
  new(
161
171
  achieved_at: achieved_at,
162
172
  completions: completions,
@@ -174,6 +184,7 @@ module TrophyApiClient
174
184
  metric_name: metric_name,
175
185
  user_attributes: user_attributes,
176
186
  event_attribute: event_attribute,
187
+ event_attributes: event_attributes,
177
188
  additional_properties: struct
178
189
  )
179
190
  end
@@ -206,8 +217,9 @@ module TrophyApiClient
206
217
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
207
218
  obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
208
219
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
209
- obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
220
+ obj.user_attributes.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
210
221
  obj.event_attribute.nil? || TrophyApiClient::AchievementResponseEventAttribute.validate_raw(obj: obj.event_attribute)
222
+ obj.event_attributes&.is_a?(Array) != false || raise("Passed value for field obj.event_attributes is not the expected type, validation failed.")
211
223
  end
212
224
  end
213
225
  end
@@ -22,8 +22,10 @@ module TrophyApiClient
22
22
  attr_reader :key
23
23
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
24
24
  attr_reader :rank_by
25
- # @return [String] The key of the attribute to break down this leaderboard by.
25
+ # @return [String] Deprecated. The key of the attribute to break down this leaderboard by.
26
26
  attr_reader :breakdown_attribute
27
+ # @return [Array<String>] The user attribute keys that this leaderboard is broken down by.
28
+ attr_reader :breakdown_attributes
27
29
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
28
30
  attr_reader :metric_key
29
31
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -63,7 +65,8 @@ module TrophyApiClient
63
65
  # @param name [String] The user-facing name of the leaderboard.
64
66
  # @param key [String] The unique key used to reference the leaderboard in APIs.
65
67
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
66
- # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
68
+ # @param breakdown_attribute [String] Deprecated. The key of the attribute to break down this leaderboard by.
69
+ # @param breakdown_attributes [Array<String>] The user attribute keys that this leaderboard is broken down by.
67
70
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
68
71
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
69
72
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -79,8 +82,8 @@ module TrophyApiClient
79
82
  # type. Null for one-time leaderboards.
80
83
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
81
84
  # @return [TrophyApiClient::UserLeaderboardResponse]
82
- def initialize(id:, name:, key:, rank_by:, start:, max_participants:, rank: OMIT, value: OMIT, breakdown_attribute: OMIT, metric_key: OMIT,
83
- metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
85
+ def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, rank: OMIT,
86
+ value: OMIT, breakdown_attribute: OMIT, 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)
84
87
  @rank = rank if rank != OMIT
85
88
  @value = value if value != OMIT
86
89
  @id = id
@@ -88,6 +91,7 @@ module TrophyApiClient
88
91
  @key = key
89
92
  @rank_by = rank_by
90
93
  @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
94
+ @breakdown_attributes = breakdown_attributes
91
95
  @metric_key = metric_key if metric_key != OMIT
92
96
  @metric_name = metric_name if metric_name != OMIT
93
97
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -107,6 +111,7 @@ module TrophyApiClient
107
111
  "key": key,
108
112
  "rankBy": rank_by,
109
113
  "breakdownAttribute": breakdown_attribute,
114
+ "breakdownAttributes": breakdown_attributes,
110
115
  "metricKey": metric_key,
111
116
  "metricName": metric_name,
112
117
  "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.")
@@ -25,8 +25,10 @@ module TrophyApiClient
25
25
  attr_reader :key
26
26
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
27
27
  attr_reader :rank_by
28
- # @return [String] The key of the attribute to break down this leaderboard by.
28
+ # @return [String] Deprecated. The key of the attribute to break down this leaderboard by.
29
29
  attr_reader :breakdown_attribute
30
+ # @return [Array<String>] The user attribute keys that this leaderboard is broken down by.
31
+ attr_reader :breakdown_attributes
30
32
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
31
33
  attr_reader :metric_key
32
34
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -67,7 +69,8 @@ module TrophyApiClient
67
69
  # @param name [String] The user-facing name of the leaderboard.
68
70
  # @param key [String] The unique key used to reference the leaderboard in APIs.
69
71
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
70
- # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
72
+ # @param breakdown_attribute [String] Deprecated. The key of the attribute to break down this leaderboard by.
73
+ # @param breakdown_attributes [Array<String>] The user attribute keys that this leaderboard is broken down by.
71
74
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
72
75
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
73
76
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -83,8 +86,8 @@ module TrophyApiClient
83
86
  # type. Null for one-time leaderboards.
84
87
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
85
88
  # @return [TrophyApiClient::UserLeaderboardResponseWithHistory]
86
- def initialize(history:, id:, name:, key:, rank_by:, start:, max_participants:, rank: OMIT, value: OMIT, breakdown_attribute: OMIT,
87
- 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)
89
+ def initialize(history:, id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, rank: OMIT,
90
+ value: OMIT, breakdown_attribute: OMIT, 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)
88
91
  @history = history
89
92
  @rank = rank if rank != OMIT
90
93
  @value = value if value != OMIT
@@ -93,6 +96,7 @@ module TrophyApiClient
93
96
  @key = key
94
97
  @rank_by = rank_by
95
98
  @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
99
+ @breakdown_attributes = breakdown_attributes
96
100
  @metric_key = metric_key if metric_key != OMIT
97
101
  @metric_name = metric_name if metric_name != OMIT
98
102
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -113,6 +117,7 @@ module TrophyApiClient
113
117
  "key": key,
114
118
  "rankBy": rank_by,
115
119
  "breakdownAttribute": breakdown_attribute,
120
+ "breakdownAttributes": breakdown_attributes,
116
121
  "metricKey": metric_key,
117
122
  "metricName": metric_name,
118
123
  "pointsSystemKey": points_system_key,
@@ -146,6 +151,7 @@ module TrophyApiClient
146
151
  key = parsed_json["key"]
147
152
  rank_by = parsed_json["rankBy"]
148
153
  breakdown_attribute = parsed_json["breakdownAttribute"]
154
+ breakdown_attributes = parsed_json["breakdownAttributes"]
149
155
  metric_key = parsed_json["metricKey"]
150
156
  metric_name = parsed_json["metricName"]
151
157
  points_system_key = parsed_json["pointsSystemKey"]
@@ -165,6 +171,7 @@ module TrophyApiClient
165
171
  key: key,
166
172
  rank_by: rank_by,
167
173
  breakdown_attribute: breakdown_attribute,
174
+ breakdown_attributes: breakdown_attributes,
168
175
  metric_key: metric_key,
169
176
  metric_name: metric_name,
170
177
  points_system_key: points_system_key,
@@ -201,6 +208,7 @@ module TrophyApiClient
201
208
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
202
209
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
203
210
  obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
211
+ obj.breakdown_attributes.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
204
212
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
205
213
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
206
214
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -26,8 +26,10 @@ module TrophyApiClient
26
26
  attr_reader :key
27
27
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
28
28
  attr_reader :rank_by
29
- # @return [String] The key of the attribute to break down this leaderboard by.
29
+ # @return [String] Deprecated. The key of the attribute to break down this leaderboard by.
30
30
  attr_reader :breakdown_attribute
31
+ # @return [Array<String>] The user attribute keys that this leaderboard is broken down by.
32
+ attr_reader :breakdown_attributes
31
33
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
32
34
  attr_reader :metric_key
33
35
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -69,7 +71,8 @@ module TrophyApiClient
69
71
  # @param name [String] The user-facing name of the leaderboard.
70
72
  # @param key [String] The unique key used to reference the leaderboard in APIs.
71
73
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
72
- # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
74
+ # @param breakdown_attribute [String] Deprecated. The key of the attribute to break down this leaderboard by.
75
+ # @param breakdown_attributes [Array<String>] The user attribute keys that this leaderboard is broken down by.
73
76
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
74
77
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
75
78
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -85,7 +88,7 @@ module TrophyApiClient
85
88
  # type. Null for one-time leaderboards.
86
89
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
87
90
  # @return [TrophyApiClient::WebhookUserLeaderboardResponse]
88
- def initialize(id:, name:, key:, rank_by:, start:, max_participants:, previous_rank: OMIT, previous_value: OMIT, rank: OMIT, value: OMIT,
91
+ def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, previous_rank: OMIT, previous_value: OMIT, rank: OMIT, value: OMIT,
89
92
  breakdown_attribute: OMIT, 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)
90
93
  @previous_rank = previous_rank if previous_rank != OMIT
91
94
  @previous_value = previous_value if previous_value != OMIT
@@ -96,6 +99,7 @@ module TrophyApiClient
96
99
  @key = key
97
100
  @rank_by = rank_by
98
101
  @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
102
+ @breakdown_attributes = breakdown_attributes
99
103
  @metric_key = metric_key if metric_key != OMIT
100
104
  @metric_name = metric_name if metric_name != OMIT
101
105
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -117,6 +121,7 @@ module TrophyApiClient
117
121
  "key": key,
118
122
  "rankBy": rank_by,
119
123
  "breakdownAttribute": breakdown_attribute,
124
+ "breakdownAttributes": breakdown_attributes,
120
125
  "metricKey": metric_key,
121
126
  "metricName": metric_name,
122
127
  "pointsSystemKey": points_system_key,
@@ -148,6 +153,7 @@ module TrophyApiClient
148
153
  key = parsed_json["key"]
149
154
  rank_by = parsed_json["rankBy"]
150
155
  breakdown_attribute = parsed_json["breakdownAttribute"]
156
+ breakdown_attributes = parsed_json["breakdownAttributes"]
151
157
  metric_key = parsed_json["metricKey"]
152
158
  metric_name = parsed_json["metricName"]
153
159
  points_system_key = parsed_json["pointsSystemKey"]
@@ -168,6 +174,7 @@ module TrophyApiClient
168
174
  key: key,
169
175
  rank_by: rank_by,
170
176
  breakdown_attribute: breakdown_attribute,
177
+ breakdown_attributes: breakdown_attributes,
171
178
  metric_key: metric_key,
172
179
  metric_name: metric_name,
173
180
  points_system_key: points_system_key,
@@ -205,6 +212,7 @@ module TrophyApiClient
205
212
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
206
213
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
207
214
  obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
215
+ obj.breakdown_attributes.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
208
216
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
209
217
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
210
218
  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,3 +1,3 @@
1
1
  module MyGem
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.4"
3
3
  end
data/lib/types_export.rb CHANGED
@@ -35,7 +35,11 @@ require_relative "trophy_api_client/types/metric_event_streak_response"
35
35
  require_relative "trophy_api_client/types/streak_response_streak_history_item"
36
36
  require_relative "trophy_api_client/types/streak_response"
37
37
  require_relative "trophy_api_client/types/points_trigger_type"
38
+ require_relative "trophy_api_client/types/points_trigger_status"
38
39
  require_relative "trophy_api_client/types/points_trigger_time_unit"
40
+ require_relative "trophy_api_client/types/points_trigger_user_attributes_item"
41
+ require_relative "trophy_api_client/types/points_trigger_event_attribute"
42
+ require_relative "trophy_api_client/types/points_trigger_event_attributes_item"
39
43
  require_relative "trophy_api_client/types/points_trigger"
40
44
  require_relative "trophy_api_client/types/points_award"
41
45
  require_relative "trophy_api_client/types/points_boost_status"
@@ -55,10 +59,12 @@ require_relative "trophy_api_client/types/leaderboard_response"
55
59
  require_relative "trophy_api_client/types/leaderboard_response_with_rankings_status"
56
60
  require_relative "trophy_api_client/types/leaderboard_response_with_rankings"
57
61
  require_relative "trophy_api_client/types/metric_event_points_response"
62
+ require_relative "trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item"
58
63
  require_relative "trophy_api_client/types/metric_event_leaderboard_response"
59
64
  require_relative "trophy_api_client/types/achievement_response_trigger"
60
65
  require_relative "trophy_api_client/types/achievement_response_user_attributes_item"
61
66
  require_relative "trophy_api_client/types/achievement_response_event_attribute"
67
+ require_relative "trophy_api_client/types/achievement_response_event_attributes_item"
62
68
  require_relative "trophy_api_client/types/achievement_response"
63
69
  require_relative "trophy_api_client/types/user_achievement_response"
64
70
  require_relative "trophy_api_client/types/user_achievement_with_stats_response"
@@ -76,12 +82,6 @@ require_relative "trophy_api_client/types/achievement_completion_response"
76
82
  require_relative "trophy_api_client/types/event_response"
77
83
  require_relative "trophy_api_client/types/points_range"
78
84
  require_relative "trophy_api_client/types/points_summary_response"
79
- require_relative "trophy_api_client/types/points_trigger_response_type"
80
- require_relative "trophy_api_client/types/points_trigger_response_status"
81
- require_relative "trophy_api_client/types/points_trigger_response_time_unit"
82
- require_relative "trophy_api_client/types/points_trigger_response_user_attributes_item"
83
- require_relative "trophy_api_client/types/points_trigger_response_event_attribute"
84
- require_relative "trophy_api_client/types/points_trigger_response"
85
85
  require_relative "trophy_api_client/types/points_system_response"
86
86
  require_relative "trophy_api_client/types/streak_ranking_user"
87
87
  require_relative "trophy_api_client/types/leaderboard_ranking"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trophy_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trophy Labs, Inc
@@ -119,6 +119,7 @@ files:
119
119
  - lib/trophy_api_client/types/achievement_completion_response.rb
120
120
  - lib/trophy_api_client/types/achievement_response.rb
121
121
  - lib/trophy_api_client/types/achievement_response_event_attribute.rb
122
+ - lib/trophy_api_client/types/achievement_response_event_attributes_item.rb
122
123
  - lib/trophy_api_client/types/achievement_response_trigger.rb
123
124
  - lib/trophy_api_client/types/achievement_response_user_attributes_item.rb
124
125
  - lib/trophy_api_client/types/achievement_with_stats_response.rb
@@ -144,6 +145,7 @@ files:
144
145
  - lib/trophy_api_client/types/leaderboard_response_with_rankings.rb
145
146
  - lib/trophy_api_client/types/leaderboard_response_with_rankings_status.rb
146
147
  - lib/trophy_api_client/types/metric_event_leaderboard_response.rb
148
+ - lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb
147
149
  - lib/trophy_api_client/types/metric_event_points_response.rb
148
150
  - lib/trophy_api_client/types/metric_event_streak_response.rb
149
151
  - lib/trophy_api_client/types/metric_response.rb
@@ -166,14 +168,12 @@ files:
166
168
  - lib/trophy_api_client/types/points_summary_response.rb
167
169
  - lib/trophy_api_client/types/points_system_response.rb
168
170
  - lib/trophy_api_client/types/points_trigger.rb
169
- - lib/trophy_api_client/types/points_trigger_response.rb
170
- - lib/trophy_api_client/types/points_trigger_response_event_attribute.rb
171
- - lib/trophy_api_client/types/points_trigger_response_status.rb
172
- - lib/trophy_api_client/types/points_trigger_response_time_unit.rb
173
- - lib/trophy_api_client/types/points_trigger_response_type.rb
174
- - lib/trophy_api_client/types/points_trigger_response_user_attributes_item.rb
171
+ - lib/trophy_api_client/types/points_trigger_event_attribute.rb
172
+ - lib/trophy_api_client/types/points_trigger_event_attributes_item.rb
173
+ - lib/trophy_api_client/types/points_trigger_status.rb
175
174
  - lib/trophy_api_client/types/points_trigger_time_unit.rb
176
175
  - lib/trophy_api_client/types/points_trigger_type.rb
176
+ - lib/trophy_api_client/types/points_trigger_user_attributes_item.rb
177
177
  - lib/trophy_api_client/types/restore_streaks_response.rb
178
178
  - lib/trophy_api_client/types/streak_frequency.rb
179
179
  - lib/trophy_api_client/types/streak_ranking_user.rb
@@ -1,211 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "points_trigger_response_type"
4
- require_relative "points_trigger_response_status"
5
- require_relative "points_trigger_response_time_unit"
6
- require_relative "points_trigger_response_user_attributes_item"
7
- require_relative "points_trigger_response_event_attribute"
8
- require "date"
9
- require "ostruct"
10
- require "json"
11
-
12
- module TrophyApiClient
13
- class PointsTriggerResponse
14
- # @return [String] The unique ID of the trigger.
15
- attr_reader :id
16
- # @return [TrophyApiClient::PointsTriggerResponseType] The type of trigger.
17
- attr_reader :type
18
- # @return [Integer] The points awarded by this trigger.
19
- attr_reader :points
20
- # @return [TrophyApiClient::PointsTriggerResponseStatus] The status of the trigger.
21
- attr_reader :status
22
- # @return [String] The unique ID of the achievement associated with this trigger, if the trigger is
23
- # an achievement.
24
- attr_reader :achievement_id
25
- # @return [String] The unique ID of the metric associated with this trigger, if the trigger is a
26
- # metric.
27
- attr_reader :metric_id
28
- # @return [Integer] The amount that a user must increase the metric to earn the points, if the
29
- # trigger is a metric.
30
- attr_reader :metric_threshold
31
- # @return [Integer] The number of consecutive streak periods that a user must complete to earn the
32
- # points, if the trigger is a streak.
33
- attr_reader :streak_length_threshold
34
- # @return [String] The name of the metric associated with this trigger, if the trigger is a metric.
35
- attr_reader :metric_name
36
- # @return [String] The name of the achievement associated with this trigger, if the trigger is an
37
- # achievement.
38
- attr_reader :achievement_name
39
- # @return [TrophyApiClient::PointsTriggerResponseTimeUnit] The time unit of the trigger, if the trigger is a time interval.
40
- attr_reader :time_unit
41
- # @return [Integer] The interval of the trigger in the time unit, if the trigger is a time interval.
42
- attr_reader :time_interval
43
- # @return [Array<TrophyApiClient::PointsTriggerResponseUserAttributesItem>] User attribute filters that must be met for this trigger to activate. Only
44
- # present if the trigger has user attribute filters configured.
45
- attr_reader :user_attributes
46
- # @return [TrophyApiClient::PointsTriggerResponseEventAttribute] Event attribute filter that must be met for this trigger to activate. Only
47
- # present if the trigger has an event filter configured.
48
- attr_reader :event_attribute
49
- # @return [DateTime] The date and time the trigger was created, in ISO 8601 format.
50
- attr_reader :created
51
- # @return [DateTime] The date and time the trigger was last updated, in ISO 8601 format.
52
- attr_reader :updated
53
- # @return [OpenStruct] Additional properties unmapped to the current class definition
54
- attr_reader :additional_properties
55
- # @return [Object]
56
- attr_reader :_field_set
57
- protected :_field_set
58
-
59
- OMIT = Object.new
60
-
61
- # @param id [String] The unique ID of the trigger.
62
- # @param type [TrophyApiClient::PointsTriggerResponseType] The type of trigger.
63
- # @param points [Integer] The points awarded by this trigger.
64
- # @param status [TrophyApiClient::PointsTriggerResponseStatus] The status of the trigger.
65
- # @param achievement_id [String] The unique ID of the achievement associated with this trigger, if the trigger is
66
- # an achievement.
67
- # @param metric_id [String] The unique ID of the metric associated with this trigger, if the trigger is a
68
- # metric.
69
- # @param metric_threshold [Integer] The amount that a user must increase the metric to earn the points, if the
70
- # trigger is a metric.
71
- # @param streak_length_threshold [Integer] The number of consecutive streak periods that a user must complete to earn the
72
- # points, if the trigger is a streak.
73
- # @param metric_name [String] The name of the metric associated with this trigger, if the trigger is a metric.
74
- # @param achievement_name [String] The name of the achievement associated with this trigger, if the trigger is an
75
- # achievement.
76
- # @param time_unit [TrophyApiClient::PointsTriggerResponseTimeUnit] The time unit of the trigger, if the trigger is a time interval.
77
- # @param time_interval [Integer] The interval of the trigger in the time unit, if the trigger is a time interval.
78
- # @param user_attributes [Array<TrophyApiClient::PointsTriggerResponseUserAttributesItem>] User attribute filters that must be met for this trigger to activate. Only
79
- # present if the trigger has user attribute filters configured.
80
- # @param event_attribute [TrophyApiClient::PointsTriggerResponseEventAttribute] Event attribute filter that must be met for this trigger to activate. Only
81
- # present if the trigger has an event filter configured.
82
- # @param created [DateTime] The date and time the trigger was created, in ISO 8601 format.
83
- # @param updated [DateTime] The date and time the trigger was last updated, in ISO 8601 format.
84
- # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
85
- # @return [TrophyApiClient::PointsTriggerResponse]
86
- def initialize(id:, type:, points:, status:, created:, updated:, achievement_id: OMIT, metric_id: OMIT, metric_threshold: OMIT,
87
- streak_length_threshold: OMIT, metric_name: OMIT, achievement_name: OMIT, time_unit: OMIT, time_interval: OMIT, user_attributes: OMIT, event_attribute: OMIT, additional_properties: nil)
88
- @id = id
89
- @type = type
90
- @points = points
91
- @status = status
92
- @achievement_id = achievement_id if achievement_id != OMIT
93
- @metric_id = metric_id if metric_id != OMIT
94
- @metric_threshold = metric_threshold if metric_threshold != OMIT
95
- @streak_length_threshold = streak_length_threshold if streak_length_threshold != OMIT
96
- @metric_name = metric_name if metric_name != OMIT
97
- @achievement_name = achievement_name if achievement_name != OMIT
98
- @time_unit = time_unit if time_unit != OMIT
99
- @time_interval = time_interval if time_interval != OMIT
100
- @user_attributes = user_attributes if user_attributes != OMIT
101
- @event_attribute = event_attribute if event_attribute != OMIT
102
- @created = created
103
- @updated = updated
104
- @additional_properties = additional_properties
105
- @_field_set = {
106
- "id": id,
107
- "type": type,
108
- "points": points,
109
- "status": status,
110
- "achievementId": achievement_id,
111
- "metricId": metric_id,
112
- "metricThreshold": metric_threshold,
113
- "streakLengthThreshold": streak_length_threshold,
114
- "metricName": metric_name,
115
- "achievementName": achievement_name,
116
- "timeUnit": time_unit,
117
- "timeInterval": time_interval,
118
- "userAttributes": user_attributes,
119
- "eventAttribute": event_attribute,
120
- "created": created,
121
- "updated": updated
122
- }.reject do |_k, v|
123
- v == OMIT
124
- end
125
- end
126
-
127
- # Deserialize a JSON object to an instance of PointsTriggerResponse
128
- #
129
- # @param json_object [String]
130
- # @return [TrophyApiClient::PointsTriggerResponse]
131
- def self.from_json(json_object:)
132
- struct = JSON.parse(json_object, object_class: OpenStruct)
133
- parsed_json = JSON.parse(json_object)
134
- id = parsed_json["id"]
135
- type = parsed_json["type"]
136
- points = parsed_json["points"]
137
- status = parsed_json["status"]
138
- achievement_id = parsed_json["achievementId"]
139
- metric_id = parsed_json["metricId"]
140
- metric_threshold = parsed_json["metricThreshold"]
141
- streak_length_threshold = parsed_json["streakLengthThreshold"]
142
- metric_name = parsed_json["metricName"]
143
- achievement_name = parsed_json["achievementName"]
144
- time_unit = parsed_json["timeUnit"]
145
- time_interval = parsed_json["timeInterval"]
146
- user_attributes = parsed_json["userAttributes"]&.map do |item|
147
- item = item.to_json
148
- TrophyApiClient::PointsTriggerResponseUserAttributesItem.from_json(json_object: item)
149
- end
150
- if parsed_json["eventAttribute"].nil?
151
- event_attribute = nil
152
- else
153
- event_attribute = parsed_json["eventAttribute"].to_json
154
- event_attribute = TrophyApiClient::PointsTriggerResponseEventAttribute.from_json(json_object: event_attribute)
155
- end
156
- created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
157
- updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
158
- new(
159
- id: id,
160
- type: type,
161
- points: points,
162
- status: status,
163
- achievement_id: achievement_id,
164
- metric_id: metric_id,
165
- metric_threshold: metric_threshold,
166
- streak_length_threshold: streak_length_threshold,
167
- metric_name: metric_name,
168
- achievement_name: achievement_name,
169
- time_unit: time_unit,
170
- time_interval: time_interval,
171
- user_attributes: user_attributes,
172
- event_attribute: event_attribute,
173
- created: created,
174
- updated: updated,
175
- additional_properties: struct
176
- )
177
- end
178
-
179
- # Serialize an instance of PointsTriggerResponse to a JSON object
180
- #
181
- # @return [String]
182
- def to_json(*_args)
183
- @_field_set&.to_json
184
- end
185
-
186
- # Leveraged for Union-type generation, validate_raw attempts to parse the given
187
- # hash and check each fields type against the current object's property
188
- # definitions.
189
- #
190
- # @param obj [Object]
191
- # @return [Void]
192
- def self.validate_raw(obj:)
193
- obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
194
- obj.type.is_a?(TrophyApiClient::PointsTriggerResponseType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
195
- obj.points.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
196
- obj.status.is_a?(TrophyApiClient::PointsTriggerResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
197
- obj.achievement_id&.is_a?(String) != false || raise("Passed value for field obj.achievement_id is not the expected type, validation failed.")
198
- obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
199
- obj.metric_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.metric_threshold is not the expected type, validation failed.")
200
- obj.streak_length_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length_threshold is not the expected type, validation failed.")
201
- obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
202
- obj.achievement_name&.is_a?(String) != false || raise("Passed value for field obj.achievement_name is not the expected type, validation failed.")
203
- obj.time_unit&.is_a?(TrophyApiClient::PointsTriggerResponseTimeUnit) != false || raise("Passed value for field obj.time_unit is not the expected type, validation failed.")
204
- obj.time_interval&.is_a?(Integer) != false || raise("Passed value for field obj.time_interval is not the expected type, validation failed.")
205
- obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
206
- obj.event_attribute.nil? || TrophyApiClient::PointsTriggerResponseEventAttribute.validate_raw(obj: obj.event_attribute)
207
- obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
208
- obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
209
- end
210
- end
211
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TrophyApiClient
4
- # The time unit of the trigger, if the trigger is a time interval.
5
- class PointsTriggerResponseTimeUnit
6
- HOUR = "hour"
7
- DAY = "day"
8
- end
9
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TrophyApiClient
4
- # The type of trigger.
5
- class PointsTriggerResponseType
6
- METRIC = "metric"
7
- ACHIEVEMENT = "achievement"
8
- STREAK = "streak"
9
- TIME = "time"
10
- USER_CREATION = "user_creation"
11
- end
12
- end