trophy_api_client 1.1.2 → 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.
- checksums.yaml +4 -4
- data/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +12 -4
- data/lib/trophy_api_client/points/client.rb +152 -0
- data/lib/trophy_api_client/types/achievement_response.rb +23 -11
- data/lib/trophy_api_client/types/achievement_response_event_attribute.rb +2 -2
- data/lib/trophy_api_client/types/achievement_response_event_attributes_item.rb +66 -0
- data/lib/trophy_api_client/types/achievement_with_stats_response.rb +23 -11
- data/lib/trophy_api_client/types/get_user_points_response.rb +38 -22
- data/lib/trophy_api_client/types/leaderboard_response.rb +12 -4
- data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +12 -4
- data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +30 -8
- data/lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb +67 -0
- data/lib/trophy_api_client/types/metric_event_points_response.rb +47 -31
- data/lib/trophy_api_client/types/points_level.rb +103 -0
- data/lib/trophy_api_client/types/points_level_summary_response.rb +7 -0
- data/lib/trophy_api_client/types/points_level_summary_response_item.rb +71 -0
- data/lib/trophy_api_client/types/points_response.rb +103 -0
- data/lib/trophy_api_client/types/points_system_response.rb +4 -4
- data/lib/trophy_api_client/types/points_trigger.rb +101 -9
- data/lib/trophy_api_client/types/{points_trigger_response_event_attribute.rb → points_trigger_event_attribute.rb} +7 -7
- data/lib/trophy_api_client/types/points_trigger_event_attributes_item.rb +65 -0
- data/lib/trophy_api_client/types/{points_trigger_response_status.rb → points_trigger_status.rb} +2 -1
- data/lib/trophy_api_client/types/{points_trigger_response_user_attributes_item.rb → points_trigger_user_attributes_item.rb} +7 -9
- data/lib/trophy_api_client/types/streak_response.rb +4 -2
- data/lib/trophy_api_client/types/user_achievement_response.rb +23 -11
- data/lib/trophy_api_client/types/user_achievement_with_stats_response.rb +23 -11
- data/lib/trophy_api_client/types/user_leaderboard_response.rb +12 -4
- data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +12 -4
- data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +11 -3
- data/lib/trophy_api_client/types/webhooks_points_level_changed_payload.rb +117 -0
- data/lib/trophy_api_client/types/webhooks_points_level_changed_payload_points.rb +114 -0
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +12 -6
- metadata +14 -8
- data/lib/trophy_api_client/types/points_trigger_response.rb +0 -211
- data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +0 -9
- data/lib/trophy_api_client/types/points_trigger_response_type.rb +0 -12
|
@@ -4,10 +4,10 @@ require "ostruct"
|
|
|
4
4
|
require "json"
|
|
5
5
|
|
|
6
6
|
module TrophyApiClient
|
|
7
|
-
class
|
|
7
|
+
class PointsTriggerUserAttributesItem
|
|
8
8
|
# @return [String] The key of the user attribute.
|
|
9
9
|
attr_reader :key
|
|
10
|
-
# @return [String] The value of the user attribute.
|
|
10
|
+
# @return [String] The required value of the user attribute.
|
|
11
11
|
attr_reader :value
|
|
12
12
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
13
13
|
attr_reader :additional_properties
|
|
@@ -18,9 +18,9 @@ module TrophyApiClient
|
|
|
18
18
|
OMIT = Object.new
|
|
19
19
|
|
|
20
20
|
# @param key [String] The key of the user attribute.
|
|
21
|
-
# @param value [String] The value of the user attribute.
|
|
21
|
+
# @param value [String] The required value of the user attribute.
|
|
22
22
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
23
|
-
# @return [TrophyApiClient::
|
|
23
|
+
# @return [TrophyApiClient::PointsTriggerUserAttributesItem]
|
|
24
24
|
def initialize(key:, value:, additional_properties: nil)
|
|
25
25
|
@key = key
|
|
26
26
|
@value = value
|
|
@@ -28,11 +28,10 @@ module TrophyApiClient
|
|
|
28
28
|
@_field_set = { "key": key, "value": value }
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# Deserialize a JSON object to an instance of
|
|
32
|
-
# PointsTriggerResponseUserAttributesItem
|
|
31
|
+
# Deserialize a JSON object to an instance of PointsTriggerUserAttributesItem
|
|
33
32
|
#
|
|
34
33
|
# @param json_object [String]
|
|
35
|
-
# @return [TrophyApiClient::
|
|
34
|
+
# @return [TrophyApiClient::PointsTriggerUserAttributesItem]
|
|
36
35
|
def self.from_json(json_object:)
|
|
37
36
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
38
37
|
parsed_json = JSON.parse(json_object)
|
|
@@ -45,8 +44,7 @@ module TrophyApiClient
|
|
|
45
44
|
)
|
|
46
45
|
end
|
|
47
46
|
|
|
48
|
-
# Serialize an instance of
|
|
49
|
-
# object
|
|
47
|
+
# Serialize an instance of PointsTriggerUserAttributesItem to a JSON object
|
|
50
48
|
#
|
|
51
49
|
# @return [String]
|
|
52
50
|
def to_json(*_args)
|
|
@@ -11,7 +11,8 @@ module TrophyApiClient
|
|
|
11
11
|
# @return [Array<TrophyApiClient::StreakResponseStreakHistoryItem>] A list of the user's past streak periods up through the current period. Each
|
|
12
12
|
# period includes the start and end dates and the length of the streak.
|
|
13
13
|
attr_reader :streak_history
|
|
14
|
-
# @return [Integer] The user's rank across all users. Null if the user has no active
|
|
14
|
+
# @return [Integer] Deprecated. The user's rank across all users. Null if the user has no active
|
|
15
|
+
# streak.
|
|
15
16
|
attr_reader :rank
|
|
16
17
|
# @return [Integer] The length of the user's current streak.
|
|
17
18
|
attr_reader :length
|
|
@@ -47,7 +48,8 @@ module TrophyApiClient
|
|
|
47
48
|
|
|
48
49
|
# @param streak_history [Array<TrophyApiClient::StreakResponseStreakHistoryItem>] A list of the user's past streak periods up through the current period. Each
|
|
49
50
|
# period includes the start and end dates and the length of the streak.
|
|
50
|
-
# @param rank [Integer] The user's rank across all users. Null if the user has no active
|
|
51
|
+
# @param rank [Integer] Deprecated. The user's rank across all users. Null if the user has no active
|
|
52
|
+
# streak.
|
|
51
53
|
# @param length [Integer] The length of the user's current streak.
|
|
52
54
|
# @param frequency [TrophyApiClient::StreakFrequency] The frequency of the streak.
|
|
53
55
|
# @param started [String] The date the streak started.
|
|
@@ -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
|
|
|
@@ -41,11 +42,13 @@ module TrophyApiClient
|
|
|
41
42
|
# trigger = 'metric')
|
|
42
43
|
attr_reader :metric_name
|
|
43
44
|
# @return [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
|
|
44
|
-
# Only present if the achievement has user attribute filters configured.
|
|
45
45
|
attr_reader :user_attributes
|
|
46
|
-
# @return [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be
|
|
47
|
-
# Only present if the achievement has an event filter configured.
|
|
46
|
+
# @return [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
|
|
47
|
+
# completed. Only present if the achievement has an event filter configured.
|
|
48
48
|
attr_reader :event_attribute
|
|
49
|
+
# @return [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
|
|
50
|
+
# Omitted for non-metric achievements.
|
|
51
|
+
attr_reader :event_attributes
|
|
49
52
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
50
53
|
attr_reader :additional_properties
|
|
51
54
|
# @return [Object]
|
|
@@ -74,13 +77,14 @@ module TrophyApiClient
|
|
|
74
77
|
# @param metric_name [String] The name of the metric associated with this achievement (only applicable if
|
|
75
78
|
# trigger = 'metric')
|
|
76
79
|
# @param user_attributes [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
+
# @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Deprecated. Event attribute filter that must be met for this achievement to be
|
|
81
|
+
# completed. Only present if the achievement has an event filter configured.
|
|
82
|
+
# @param event_attributes [Array<TrophyApiClient::AchievementResponseEventAttributesItem>] Event attribute filters that must be met for this achievement to be completed.
|
|
83
|
+
# Omitted for non-metric achievements.
|
|
80
84
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
81
85
|
# @return [TrophyApiClient::UserAchievementResponse]
|
|
82
|
-
def initialize(id:, name:, trigger:, achieved_at: OMIT, description: OMIT, badge_url: OMIT, key: OMIT,
|
|
83
|
-
streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT,
|
|
86
|
+
def initialize(id:, name:, trigger:, user_attributes:, achieved_at: OMIT, description: OMIT, badge_url: OMIT, key: OMIT,
|
|
87
|
+
streak_length: OMIT, achievement_ids: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, event_attribute: OMIT, event_attributes: OMIT, additional_properties: nil)
|
|
84
88
|
@achieved_at = achieved_at if achieved_at != OMIT
|
|
85
89
|
@id = id
|
|
86
90
|
@name = name
|
|
@@ -93,8 +97,9 @@ module TrophyApiClient
|
|
|
93
97
|
@metric_id = metric_id if metric_id != OMIT
|
|
94
98
|
@metric_value = metric_value if metric_value != OMIT
|
|
95
99
|
@metric_name = metric_name if metric_name != OMIT
|
|
96
|
-
@user_attributes = user_attributes
|
|
100
|
+
@user_attributes = user_attributes
|
|
97
101
|
@event_attribute = event_attribute if event_attribute != OMIT
|
|
102
|
+
@event_attributes = event_attributes if event_attributes != OMIT
|
|
98
103
|
@additional_properties = additional_properties
|
|
99
104
|
@_field_set = {
|
|
100
105
|
"achievedAt": achieved_at,
|
|
@@ -110,7 +115,8 @@ module TrophyApiClient
|
|
|
110
115
|
"metricValue": metric_value,
|
|
111
116
|
"metricName": metric_name,
|
|
112
117
|
"userAttributes": user_attributes,
|
|
113
|
-
"eventAttribute": event_attribute
|
|
118
|
+
"eventAttribute": event_attribute,
|
|
119
|
+
"eventAttributes": event_attributes
|
|
114
120
|
}.reject do |_k, v|
|
|
115
121
|
v == OMIT
|
|
116
122
|
end
|
|
@@ -145,6 +151,10 @@ module TrophyApiClient
|
|
|
145
151
|
event_attribute = parsed_json["eventAttribute"].to_json
|
|
146
152
|
event_attribute = TrophyApiClient::AchievementResponseEventAttribute.from_json(json_object: event_attribute)
|
|
147
153
|
end
|
|
154
|
+
event_attributes = parsed_json["eventAttributes"]&.map do |item|
|
|
155
|
+
item = item.to_json
|
|
156
|
+
TrophyApiClient::AchievementResponseEventAttributesItem.from_json(json_object: item)
|
|
157
|
+
end
|
|
148
158
|
new(
|
|
149
159
|
achieved_at: achieved_at,
|
|
150
160
|
id: id,
|
|
@@ -160,6 +170,7 @@ module TrophyApiClient
|
|
|
160
170
|
metric_name: metric_name,
|
|
161
171
|
user_attributes: user_attributes,
|
|
162
172
|
event_attribute: event_attribute,
|
|
173
|
+
event_attributes: event_attributes,
|
|
163
174
|
additional_properties: struct
|
|
164
175
|
)
|
|
165
176
|
end
|
|
@@ -190,8 +201,9 @@ module TrophyApiClient
|
|
|
190
201
|
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
191
202
|
obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
|
|
192
203
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
193
|
-
obj.user_attributes
|
|
204
|
+
obj.user_attributes.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
|
194
205
|
obj.event_attribute.nil? || TrophyApiClient::AchievementResponseEventAttribute.validate_raw(obj: obj.event_attribute)
|
|
206
|
+
obj.event_attributes&.is_a?(Array) != false || raise("Passed value for field obj.event_attributes is not the expected type, validation failed.")
|
|
195
207
|
end
|
|
196
208
|
end
|
|
197
209
|
end
|
|
@@ -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
|
|
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
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
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,
|
|
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
|
|
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
|
|
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,
|
|
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,
|
|
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.")
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "user"
|
|
4
|
+
require_relative "webhooks_points_level_changed_payload_points"
|
|
5
|
+
require_relative "points_level"
|
|
6
|
+
require "ostruct"
|
|
7
|
+
require "json"
|
|
8
|
+
|
|
9
|
+
module TrophyApiClient
|
|
10
|
+
class WebhooksPointsLevelChangedPayload
|
|
11
|
+
# @return [String] The webhook event type.
|
|
12
|
+
attr_reader :type
|
|
13
|
+
# @return [TrophyApiClient::User] The user whose level changed.
|
|
14
|
+
attr_reader :user
|
|
15
|
+
# @return [TrophyApiClient::WebhooksPointsLevelChangedPayloadPoints] The points system in which the level changed.
|
|
16
|
+
attr_reader :points
|
|
17
|
+
# @return [TrophyApiClient::PointsLevel] The user's previous level, or null if the user had no level.
|
|
18
|
+
attr_reader :previous_level
|
|
19
|
+
# @return [TrophyApiClient::PointsLevel] The user's new level, or null if the user no longer has a level.
|
|
20
|
+
attr_reader :new_level
|
|
21
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
22
|
+
attr_reader :additional_properties
|
|
23
|
+
# @return [Object]
|
|
24
|
+
attr_reader :_field_set
|
|
25
|
+
protected :_field_set
|
|
26
|
+
|
|
27
|
+
OMIT = Object.new
|
|
28
|
+
|
|
29
|
+
# @param type [String] The webhook event type.
|
|
30
|
+
# @param user [TrophyApiClient::User] The user whose level changed.
|
|
31
|
+
# @param points [TrophyApiClient::WebhooksPointsLevelChangedPayloadPoints] The points system in which the level changed.
|
|
32
|
+
# @param previous_level [TrophyApiClient::PointsLevel] The user's previous level, or null if the user had no level.
|
|
33
|
+
# @param new_level [TrophyApiClient::PointsLevel] The user's new level, or null if the user no longer has a level.
|
|
34
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
35
|
+
# @return [TrophyApiClient::WebhooksPointsLevelChangedPayload]
|
|
36
|
+
def initialize(type:, user:, points:, previous_level: OMIT, new_level: OMIT, additional_properties: nil)
|
|
37
|
+
@type = type
|
|
38
|
+
@user = user
|
|
39
|
+
@points = points
|
|
40
|
+
@previous_level = previous_level if previous_level != OMIT
|
|
41
|
+
@new_level = new_level if new_level != OMIT
|
|
42
|
+
@additional_properties = additional_properties
|
|
43
|
+
@_field_set = {
|
|
44
|
+
"type": type,
|
|
45
|
+
"user": user,
|
|
46
|
+
"points": points,
|
|
47
|
+
"previousLevel": previous_level,
|
|
48
|
+
"newLevel": new_level
|
|
49
|
+
}.reject do |_k, v|
|
|
50
|
+
v == OMIT
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Deserialize a JSON object to an instance of WebhooksPointsLevelChangedPayload
|
|
55
|
+
#
|
|
56
|
+
# @param json_object [String]
|
|
57
|
+
# @return [TrophyApiClient::WebhooksPointsLevelChangedPayload]
|
|
58
|
+
def self.from_json(json_object:)
|
|
59
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
60
|
+
parsed_json = JSON.parse(json_object)
|
|
61
|
+
type = parsed_json["type"]
|
|
62
|
+
if parsed_json["user"].nil?
|
|
63
|
+
user = nil
|
|
64
|
+
else
|
|
65
|
+
user = parsed_json["user"].to_json
|
|
66
|
+
user = TrophyApiClient::User.from_json(json_object: user)
|
|
67
|
+
end
|
|
68
|
+
if parsed_json["points"].nil?
|
|
69
|
+
points = nil
|
|
70
|
+
else
|
|
71
|
+
points = parsed_json["points"].to_json
|
|
72
|
+
points = TrophyApiClient::WebhooksPointsLevelChangedPayloadPoints.from_json(json_object: points)
|
|
73
|
+
end
|
|
74
|
+
if parsed_json["previousLevel"].nil?
|
|
75
|
+
previous_level = nil
|
|
76
|
+
else
|
|
77
|
+
previous_level = parsed_json["previousLevel"].to_json
|
|
78
|
+
previous_level = TrophyApiClient::PointsLevel.from_json(json_object: previous_level)
|
|
79
|
+
end
|
|
80
|
+
if parsed_json["newLevel"].nil?
|
|
81
|
+
new_level = nil
|
|
82
|
+
else
|
|
83
|
+
new_level = parsed_json["newLevel"].to_json
|
|
84
|
+
new_level = TrophyApiClient::PointsLevel.from_json(json_object: new_level)
|
|
85
|
+
end
|
|
86
|
+
new(
|
|
87
|
+
type: type,
|
|
88
|
+
user: user,
|
|
89
|
+
points: points,
|
|
90
|
+
previous_level: previous_level,
|
|
91
|
+
new_level: new_level,
|
|
92
|
+
additional_properties: struct
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Serialize an instance of WebhooksPointsLevelChangedPayload to a JSON object
|
|
97
|
+
#
|
|
98
|
+
# @return [String]
|
|
99
|
+
def to_json(*_args)
|
|
100
|
+
@_field_set&.to_json
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
104
|
+
# hash and check each fields type against the current object's property
|
|
105
|
+
# definitions.
|
|
106
|
+
#
|
|
107
|
+
# @param obj [Object]
|
|
108
|
+
# @return [Void]
|
|
109
|
+
def self.validate_raw(obj:)
|
|
110
|
+
obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
111
|
+
TrophyApiClient::User.validate_raw(obj: obj.user)
|
|
112
|
+
TrophyApiClient::WebhooksPointsLevelChangedPayloadPoints.validate_raw(obj: obj.points)
|
|
113
|
+
obj.previous_level.nil? || TrophyApiClient::PointsLevel.validate_raw(obj: obj.previous_level)
|
|
114
|
+
obj.new_level.nil? || TrophyApiClient::PointsLevel.validate_raw(obj: obj.new_level)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|