trophy_api_client 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/environment.rb +1 -1
- data/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/achievements/client.rb +2 -2
- data/lib/trophy_api_client/leaderboards/client.rb +9 -5
- data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +186 -0
- data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item_status.rb +12 -0
- data/lib/trophy_api_client/metrics/client.rb +2 -2
- data/lib/trophy_api_client/streaks/client.rb +2 -2
- data/lib/trophy_api_client/types/achievement_completion_response.rb +9 -11
- data/lib/trophy_api_client/types/achievement_completion_response_achievement.rb +171 -0
- data/lib/trophy_api_client/types/achievement_response.rb +5 -19
- data/lib/trophy_api_client/types/achievement_with_stats_response.rb +9 -23
- data/lib/trophy_api_client/types/bulk_streak_response_item.rb +4 -6
- data/lib/trophy_api_client/types/completed_achievement_response.rb +7 -21
- data/lib/trophy_api_client/types/event_response.rb +10 -10
- data/lib/trophy_api_client/types/get_user_points_response.rb +21 -4
- data/lib/trophy_api_client/types/leaderboard_response.rb +8 -16
- data/lib/trophy_api_client/types/leaderboard_response_run_unit.rb +11 -0
- data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +17 -16
- data/lib/trophy_api_client/types/{leaderboard_response_status.rb → leaderboard_response_with_rankings_status.rb} +1 -1
- data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +11 -19
- data/lib/trophy_api_client/types/metric_event_points_response.rb +24 -8
- data/lib/trophy_api_client/types/metric_event_streak_response.rb +4 -4
- data/lib/trophy_api_client/types/points_award.rb +6 -6
- data/lib/trophy_api_client/types/points_range.rb +14 -16
- data/lib/trophy_api_client/types/points_system_response.rb +10 -1
- data/lib/trophy_api_client/types/points_trigger.rb +30 -11
- data/lib/trophy_api_client/types/points_trigger_response.rb +39 -22
- data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/points_trigger_response_type.rb +2 -0
- data/lib/trophy_api_client/types/points_trigger_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/points_trigger_type.rb +2 -0
- data/lib/trophy_api_client/types/updated_user.rb +11 -11
- data/lib/trophy_api_client/types/upserted_user.rb +12 -12
- data/lib/trophy_api_client/types/user.rb +18 -18
- data/lib/trophy_api_client/types/user_leaderboard_response.rb +8 -28
- data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +208 -0
- data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +212 -0
- data/lib/trophy_api_client/types/webhooks_achievement_completed_payload.rb +84 -0
- data/lib/trophy_api_client/types/webhooks_leaderboard_changed_payload.rb +71 -0
- data/lib/trophy_api_client/types/webhooks_leaderboard_finished_payload.rb +71 -0
- data/lib/trophy_api_client/types/webhooks_leaderboard_rank_changed_payload.rb +85 -0
- data/lib/trophy_api_client/types/webhooks_leaderboard_started_payload.rb +71 -0
- data/lib/trophy_api_client/types/webhooks_points_changed_payload.rb +84 -0
- data/lib/trophy_api_client/types/webhooks_streak_extended_payload.rb +84 -0
- data/lib/trophy_api_client/types/webhooks_streak_freeze_consumed_payload.rb +85 -0
- data/lib/trophy_api_client/types/webhooks_streak_freeze_earned_payload.rb +85 -0
- data/lib/trophy_api_client/types/webhooks_streak_lost_payload.rb +78 -0
- data/lib/trophy_api_client/types/webhooks_streak_started_payload.rb +84 -0
- data/lib/trophy_api_client/users/client.rb +25 -17
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +20 -1
- metadata +21 -2
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "leaderboard_response_with_rankings_status"
|
|
3
4
|
require_relative "leaderboard_ranking"
|
|
4
|
-
require_relative "leaderboard_response_status"
|
|
5
5
|
require_relative "leaderboard_response_rank_by"
|
|
6
|
+
require_relative "leaderboard_response_run_unit"
|
|
6
7
|
require "ostruct"
|
|
7
8
|
require "json"
|
|
8
9
|
|
|
9
10
|
module TrophyApiClient
|
|
10
11
|
class LeaderboardResponseWithRankings
|
|
12
|
+
# @return [TrophyApiClient::LeaderboardResponseWithRankingsStatus] The status of the leaderboard.
|
|
13
|
+
attr_reader :status
|
|
11
14
|
# @return [Array<TrophyApiClient::LeaderboardRanking>] Array of user rankings for the leaderboard.
|
|
12
15
|
attr_reader :rankings
|
|
13
16
|
# @return [String] The unique ID of the leaderboard.
|
|
@@ -16,8 +19,6 @@ module TrophyApiClient
|
|
|
16
19
|
attr_reader :name
|
|
17
20
|
# @return [String] The unique key used to reference the leaderboard in APIs.
|
|
18
21
|
attr_reader :key
|
|
19
|
-
# @return [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
|
|
20
|
-
attr_reader :status
|
|
21
22
|
# @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
|
|
22
23
|
attr_reader :rank_by
|
|
23
24
|
# @return [String] The key of the metric to rank by, if rankBy is 'metric'.
|
|
@@ -37,7 +38,7 @@ module TrophyApiClient
|
|
|
37
38
|
attr_reader :end_
|
|
38
39
|
# @return [Integer] The maximum number of participants in the leaderboard.
|
|
39
40
|
attr_reader :max_participants
|
|
40
|
-
# @return [
|
|
41
|
+
# @return [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
|
|
41
42
|
# leaderboards.
|
|
42
43
|
attr_reader :run_unit
|
|
43
44
|
# @return [Integer] The interval between repetitions, relative to the start date and repetition
|
|
@@ -51,11 +52,11 @@ module TrophyApiClient
|
|
|
51
52
|
|
|
52
53
|
OMIT = Object.new
|
|
53
54
|
|
|
55
|
+
# @param status [TrophyApiClient::LeaderboardResponseWithRankingsStatus] The status of the leaderboard.
|
|
54
56
|
# @param rankings [Array<TrophyApiClient::LeaderboardRanking>] Array of user rankings for the leaderboard.
|
|
55
57
|
# @param id [String] The unique ID of the leaderboard.
|
|
56
58
|
# @param name [String] The user-facing name of the leaderboard.
|
|
57
59
|
# @param key [String] The unique key used to reference the leaderboard in APIs.
|
|
58
|
-
# @param status [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
|
|
59
60
|
# @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
|
|
60
61
|
# @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
|
|
61
62
|
# @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
|
|
@@ -66,25 +67,25 @@ module TrophyApiClient
|
|
|
66
67
|
# @param end_ [String] The end date of the leaderboard in YYYY-MM-DD format, or null if it runs
|
|
67
68
|
# forever.
|
|
68
69
|
# @param max_participants [Integer] The maximum number of participants in the leaderboard.
|
|
69
|
-
# @param run_unit [
|
|
70
|
+
# @param run_unit [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
|
|
70
71
|
# leaderboards.
|
|
71
72
|
# @param run_interval [Integer] The interval between repetitions, relative to the start date and repetition
|
|
72
73
|
# type.
|
|
73
74
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
74
75
|
# @return [TrophyApiClient::LeaderboardResponseWithRankings]
|
|
75
|
-
def initialize(rankings:, id:, name:, key:, rank_by:, start:, max_participants:, run_interval:,
|
|
76
|
-
points_system_key: OMIT, points_system_name: OMIT,
|
|
76
|
+
def initialize(status:, rankings:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, metric_key: OMIT, metric_name: OMIT,
|
|
77
|
+
points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
|
|
78
|
+
@status = status
|
|
77
79
|
@rankings = rankings
|
|
78
80
|
@id = id
|
|
79
81
|
@name = name
|
|
80
82
|
@key = key
|
|
81
|
-
@status = status if status != OMIT
|
|
82
83
|
@rank_by = rank_by
|
|
83
84
|
@metric_key = metric_key if metric_key != OMIT
|
|
84
85
|
@metric_name = metric_name if metric_name != OMIT
|
|
85
86
|
@points_system_key = points_system_key if points_system_key != OMIT
|
|
86
87
|
@points_system_name = points_system_name if points_system_name != OMIT
|
|
87
|
-
@description = description
|
|
88
|
+
@description = description
|
|
88
89
|
@start = start
|
|
89
90
|
@end_ = end_ if end_ != OMIT
|
|
90
91
|
@max_participants = max_participants
|
|
@@ -92,11 +93,11 @@ module TrophyApiClient
|
|
|
92
93
|
@run_interval = run_interval
|
|
93
94
|
@additional_properties = additional_properties
|
|
94
95
|
@_field_set = {
|
|
96
|
+
"status": status,
|
|
95
97
|
"rankings": rankings,
|
|
96
98
|
"id": id,
|
|
97
99
|
"name": name,
|
|
98
100
|
"key": key,
|
|
99
|
-
"status": status,
|
|
100
101
|
"rankBy": rank_by,
|
|
101
102
|
"metricKey": metric_key,
|
|
102
103
|
"metricName": metric_name,
|
|
@@ -120,6 +121,7 @@ module TrophyApiClient
|
|
|
120
121
|
def self.from_json(json_object:)
|
|
121
122
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
122
123
|
parsed_json = JSON.parse(json_object)
|
|
124
|
+
status = parsed_json["status"]
|
|
123
125
|
rankings = parsed_json["rankings"]&.map do |item|
|
|
124
126
|
item = item.to_json
|
|
125
127
|
TrophyApiClient::LeaderboardRanking.from_json(json_object: item)
|
|
@@ -127,7 +129,6 @@ module TrophyApiClient
|
|
|
127
129
|
id = parsed_json["id"]
|
|
128
130
|
name = parsed_json["name"]
|
|
129
131
|
key = parsed_json["key"]
|
|
130
|
-
status = parsed_json["status"]
|
|
131
132
|
rank_by = parsed_json["rankBy"]
|
|
132
133
|
metric_key = parsed_json["metricKey"]
|
|
133
134
|
metric_name = parsed_json["metricName"]
|
|
@@ -140,11 +141,11 @@ module TrophyApiClient
|
|
|
140
141
|
run_unit = parsed_json["runUnit"]
|
|
141
142
|
run_interval = parsed_json["runInterval"]
|
|
142
143
|
new(
|
|
144
|
+
status: status,
|
|
143
145
|
rankings: rankings,
|
|
144
146
|
id: id,
|
|
145
147
|
name: name,
|
|
146
148
|
key: key,
|
|
147
|
-
status: status,
|
|
148
149
|
rank_by: rank_by,
|
|
149
150
|
metric_key: metric_key,
|
|
150
151
|
metric_name: metric_name,
|
|
@@ -174,21 +175,21 @@ module TrophyApiClient
|
|
|
174
175
|
# @param obj [Object]
|
|
175
176
|
# @return [Void]
|
|
176
177
|
def self.validate_raw(obj:)
|
|
178
|
+
obj.status.is_a?(TrophyApiClient::LeaderboardResponseWithRankingsStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
177
179
|
obj.rankings.is_a?(Array) != false || raise("Passed value for field obj.rankings is not the expected type, validation failed.")
|
|
178
180
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
179
181
|
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
180
182
|
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
181
|
-
obj.status&.is_a?(TrophyApiClient::LeaderboardResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
182
183
|
obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
|
|
183
184
|
obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
|
|
184
185
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
185
186
|
obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
|
|
186
187
|
obj.points_system_name&.is_a?(String) != false || raise("Passed value for field obj.points_system_name is not the expected type, validation failed.")
|
|
187
|
-
obj.description
|
|
188
|
+
obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
188
189
|
obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
|
189
190
|
obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
|
190
191
|
obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
|
|
191
|
-
obj.run_unit&.is_a?(
|
|
192
|
+
obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
|
|
192
193
|
obj.run_interval.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
|
|
193
194
|
end
|
|
194
195
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "leaderboard_response_status"
|
|
4
3
|
require_relative "leaderboard_response_rank_by"
|
|
4
|
+
require_relative "leaderboard_response_run_unit"
|
|
5
5
|
require "ostruct"
|
|
6
6
|
require "json"
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ module TrophyApiClient
|
|
|
16
16
|
# @return [Integer] The user's rank in the leaderboard before the event, or null if the user was not
|
|
17
17
|
# on the leaderboard before the event.
|
|
18
18
|
attr_reader :previous_rank
|
|
19
|
-
# @return [
|
|
19
|
+
# @return [Integer] The minimum value required to enter the leaderboard according to its current
|
|
20
20
|
# rankings.
|
|
21
21
|
attr_reader :threshold
|
|
22
22
|
# @return [String] The unique ID of the leaderboard.
|
|
@@ -25,8 +25,6 @@ module TrophyApiClient
|
|
|
25
25
|
attr_reader :name
|
|
26
26
|
# @return [String] The unique key used to reference the leaderboard in APIs.
|
|
27
27
|
attr_reader :key
|
|
28
|
-
# @return [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
|
|
29
|
-
attr_reader :status
|
|
30
28
|
# @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
|
|
31
29
|
attr_reader :rank_by
|
|
32
30
|
# @return [String] The key of the metric to rank by, if rankBy is 'metric'.
|
|
@@ -43,7 +41,7 @@ module TrophyApiClient
|
|
|
43
41
|
attr_reader :start
|
|
44
42
|
# @return [Integer] The maximum number of participants in the leaderboard.
|
|
45
43
|
attr_reader :max_participants
|
|
46
|
-
# @return [
|
|
44
|
+
# @return [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
|
|
47
45
|
# leaderboards.
|
|
48
46
|
attr_reader :run_unit
|
|
49
47
|
# @return [Integer] The interval between repetitions, relative to the start date and repetition
|
|
@@ -63,12 +61,11 @@ module TrophyApiClient
|
|
|
63
61
|
# leaderboard.
|
|
64
62
|
# @param previous_rank [Integer] The user's rank in the leaderboard before the event, or null if the user was not
|
|
65
63
|
# on the leaderboard before the event.
|
|
66
|
-
# @param threshold [
|
|
64
|
+
# @param threshold [Integer] The minimum value required to enter the leaderboard according to its current
|
|
67
65
|
# rankings.
|
|
68
66
|
# @param id [String] The unique ID of the leaderboard.
|
|
69
67
|
# @param name [String] The user-facing name of the leaderboard.
|
|
70
68
|
# @param key [String] The unique key used to reference the leaderboard in APIs.
|
|
71
|
-
# @param status [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
|
|
72
69
|
# @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
|
|
73
70
|
# @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
|
|
74
71
|
# @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
|
|
@@ -77,14 +74,14 @@ module TrophyApiClient
|
|
|
77
74
|
# @param description [String] The user-facing description of the leaderboard.
|
|
78
75
|
# @param start [String] The start date of the leaderboard in YYYY-MM-DD format.
|
|
79
76
|
# @param max_participants [Integer] The maximum number of participants in the leaderboard.
|
|
80
|
-
# @param run_unit [
|
|
77
|
+
# @param run_unit [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
|
|
81
78
|
# leaderboards.
|
|
82
79
|
# @param run_interval [Integer] The interval between repetitions, relative to the start date and repetition
|
|
83
80
|
# type.
|
|
84
81
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
85
82
|
# @return [TrophyApiClient::MetricEventLeaderboardResponse]
|
|
86
|
-
def initialize(threshold:, id:, name:, key:, rank_by:, start:, max_participants:, run_interval:, end_: OMIT, rank: OMIT, previous_rank: OMIT,
|
|
87
|
-
metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT,
|
|
83
|
+
def initialize(threshold:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, end_: OMIT, rank: OMIT, previous_rank: OMIT,
|
|
84
|
+
metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, run_unit: OMIT, additional_properties: nil)
|
|
88
85
|
@end_ = end_ if end_ != OMIT
|
|
89
86
|
@rank = rank if rank != OMIT
|
|
90
87
|
@previous_rank = previous_rank if previous_rank != OMIT
|
|
@@ -92,13 +89,12 @@ module TrophyApiClient
|
|
|
92
89
|
@id = id
|
|
93
90
|
@name = name
|
|
94
91
|
@key = key
|
|
95
|
-
@status = status if status != OMIT
|
|
96
92
|
@rank_by = rank_by
|
|
97
93
|
@metric_key = metric_key if metric_key != OMIT
|
|
98
94
|
@metric_name = metric_name if metric_name != OMIT
|
|
99
95
|
@points_system_key = points_system_key if points_system_key != OMIT
|
|
100
96
|
@points_system_name = points_system_name if points_system_name != OMIT
|
|
101
|
-
@description = description
|
|
97
|
+
@description = description
|
|
102
98
|
@start = start
|
|
103
99
|
@max_participants = max_participants
|
|
104
100
|
@run_unit = run_unit if run_unit != OMIT
|
|
@@ -112,7 +108,6 @@ module TrophyApiClient
|
|
|
112
108
|
"id": id,
|
|
113
109
|
"name": name,
|
|
114
110
|
"key": key,
|
|
115
|
-
"status": status,
|
|
116
111
|
"rankBy": rank_by,
|
|
117
112
|
"metricKey": metric_key,
|
|
118
113
|
"metricName": metric_name,
|
|
@@ -142,7 +137,6 @@ module TrophyApiClient
|
|
|
142
137
|
id = parsed_json["id"]
|
|
143
138
|
name = parsed_json["name"]
|
|
144
139
|
key = parsed_json["key"]
|
|
145
|
-
status = parsed_json["status"]
|
|
146
140
|
rank_by = parsed_json["rankBy"]
|
|
147
141
|
metric_key = parsed_json["metricKey"]
|
|
148
142
|
metric_name = parsed_json["metricName"]
|
|
@@ -161,7 +155,6 @@ module TrophyApiClient
|
|
|
161
155
|
id: id,
|
|
162
156
|
name: name,
|
|
163
157
|
key: key,
|
|
164
|
-
status: status,
|
|
165
158
|
rank_by: rank_by,
|
|
166
159
|
metric_key: metric_key,
|
|
167
160
|
metric_name: metric_name,
|
|
@@ -193,20 +186,19 @@ module TrophyApiClient
|
|
|
193
186
|
obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
|
194
187
|
obj.rank&.is_a?(Integer) != false || raise("Passed value for field obj.rank is not the expected type, validation failed.")
|
|
195
188
|
obj.previous_rank&.is_a?(Integer) != false || raise("Passed value for field obj.previous_rank is not the expected type, validation failed.")
|
|
196
|
-
obj.threshold.is_a?(
|
|
189
|
+
obj.threshold.is_a?(Integer) != false || raise("Passed value for field obj.threshold is not the expected type, validation failed.")
|
|
197
190
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
198
191
|
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
199
192
|
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
200
|
-
obj.status&.is_a?(TrophyApiClient::LeaderboardResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
201
193
|
obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
|
|
202
194
|
obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
|
|
203
195
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
|
204
196
|
obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
|
|
205
197
|
obj.points_system_name&.is_a?(String) != false || raise("Passed value for field obj.points_system_name is not the expected type, validation failed.")
|
|
206
|
-
obj.description
|
|
198
|
+
obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
207
199
|
obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
|
208
200
|
obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
|
|
209
|
-
obj.run_unit&.is_a?(
|
|
201
|
+
obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
|
|
210
202
|
obj.run_interval.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
|
|
211
203
|
end
|
|
212
204
|
end
|
|
@@ -6,17 +6,21 @@ require "json"
|
|
|
6
6
|
|
|
7
7
|
module TrophyApiClient
|
|
8
8
|
class MetricEventPointsResponse
|
|
9
|
-
# @return [
|
|
9
|
+
# @return [Integer] The points added by this event.
|
|
10
10
|
attr_reader :added
|
|
11
11
|
# @return [String] The ID of the points system
|
|
12
12
|
attr_reader :id
|
|
13
|
+
# @return [String] The key of the points system
|
|
14
|
+
attr_reader :key
|
|
13
15
|
# @return [String] The name of the points system
|
|
14
16
|
attr_reader :name
|
|
15
17
|
# @return [String] The description of the points system
|
|
16
18
|
attr_reader :description
|
|
17
19
|
# @return [String] The URL of the badge image for the points system
|
|
18
20
|
attr_reader :badge_url
|
|
19
|
-
# @return [Float] The user
|
|
21
|
+
# @return [Float] The maximum number of points a user can be awarded in this points system
|
|
22
|
+
attr_reader :max_points
|
|
23
|
+
# @return [Integer] The user's total points
|
|
20
24
|
attr_reader :total
|
|
21
25
|
# @return [Array<TrophyApiClient::PointsAward>] Array of trigger awards that added points.
|
|
22
26
|
attr_reader :awards
|
|
@@ -28,31 +32,37 @@ module TrophyApiClient
|
|
|
28
32
|
|
|
29
33
|
OMIT = Object.new
|
|
30
34
|
|
|
31
|
-
# @param added [
|
|
35
|
+
# @param added [Integer] The points added by this event.
|
|
32
36
|
# @param id [String] The ID of the points system
|
|
37
|
+
# @param key [String] The key of the points system
|
|
33
38
|
# @param name [String] The name of the points system
|
|
34
39
|
# @param description [String] The description of the points system
|
|
35
40
|
# @param badge_url [String] The URL of the badge image for the points system
|
|
36
|
-
# @param
|
|
41
|
+
# @param max_points [Float] The maximum number of points a user can be awarded in this points system
|
|
42
|
+
# @param total [Integer] The user's total points
|
|
37
43
|
# @param awards [Array<TrophyApiClient::PointsAward>] Array of trigger awards that added points.
|
|
38
44
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
39
45
|
# @return [TrophyApiClient::MetricEventPointsResponse]
|
|
40
|
-
def initialize(id:, name:, total:, awards:,
|
|
46
|
+
def initialize(added:, id:, key:, name:, total:, awards:, description: OMIT, badge_url: OMIT, max_points: OMIT,
|
|
41
47
|
additional_properties: nil)
|
|
42
|
-
@added = added
|
|
48
|
+
@added = added
|
|
43
49
|
@id = id
|
|
50
|
+
@key = key
|
|
44
51
|
@name = name
|
|
45
52
|
@description = description if description != OMIT
|
|
46
53
|
@badge_url = badge_url if badge_url != OMIT
|
|
54
|
+
@max_points = max_points if max_points != OMIT
|
|
47
55
|
@total = total
|
|
48
56
|
@awards = awards
|
|
49
57
|
@additional_properties = additional_properties
|
|
50
58
|
@_field_set = {
|
|
51
59
|
"added": added,
|
|
52
60
|
"id": id,
|
|
61
|
+
"key": key,
|
|
53
62
|
"name": name,
|
|
54
63
|
"description": description,
|
|
55
64
|
"badgeUrl": badge_url,
|
|
65
|
+
"maxPoints": max_points,
|
|
56
66
|
"total": total,
|
|
57
67
|
"awards": awards
|
|
58
68
|
}.reject do |_k, v|
|
|
@@ -69,9 +79,11 @@ module TrophyApiClient
|
|
|
69
79
|
parsed_json = JSON.parse(json_object)
|
|
70
80
|
added = parsed_json["added"]
|
|
71
81
|
id = parsed_json["id"]
|
|
82
|
+
key = parsed_json["key"]
|
|
72
83
|
name = parsed_json["name"]
|
|
73
84
|
description = parsed_json["description"]
|
|
74
85
|
badge_url = parsed_json["badgeUrl"]
|
|
86
|
+
max_points = parsed_json["maxPoints"]
|
|
75
87
|
total = parsed_json["total"]
|
|
76
88
|
awards = parsed_json["awards"]&.map do |item|
|
|
77
89
|
item = item.to_json
|
|
@@ -80,9 +92,11 @@ module TrophyApiClient
|
|
|
80
92
|
new(
|
|
81
93
|
added: added,
|
|
82
94
|
id: id,
|
|
95
|
+
key: key,
|
|
83
96
|
name: name,
|
|
84
97
|
description: description,
|
|
85
98
|
badge_url: badge_url,
|
|
99
|
+
max_points: max_points,
|
|
86
100
|
total: total,
|
|
87
101
|
awards: awards,
|
|
88
102
|
additional_properties: struct
|
|
@@ -103,12 +117,14 @@ module TrophyApiClient
|
|
|
103
117
|
# @param obj [Object]
|
|
104
118
|
# @return [Void]
|
|
105
119
|
def self.validate_raw(obj:)
|
|
106
|
-
obj.added
|
|
120
|
+
obj.added.is_a?(Integer) != false || raise("Passed value for field obj.added is not the expected type, validation failed.")
|
|
107
121
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
122
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
108
123
|
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
109
124
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
110
125
|
obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
|
|
111
|
-
obj.
|
|
126
|
+
obj.max_points&.is_a?(Float) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
|
|
127
|
+
obj.total.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
|
|
112
128
|
obj.awards.is_a?(Array) != false || raise("Passed value for field obj.awards is not the expected type, validation failed.")
|
|
113
129
|
end
|
|
114
130
|
end
|
|
@@ -58,9 +58,9 @@ module TrophyApiClient
|
|
|
58
58
|
# the organization has enabled streak freeze auto-earn.
|
|
59
59
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
60
60
|
# @return [TrophyApiClient::MetricEventStreakResponse]
|
|
61
|
-
def initialize(length:, frequency:,
|
|
62
|
-
|
|
63
|
-
@extended = extended
|
|
61
|
+
def initialize(extended:, length:, frequency:, started: OMIT, period_start: OMIT, period_end: OMIT, expires: OMIT,
|
|
62
|
+
freezes: OMIT, max_freezes: OMIT, freeze_auto_earn_interval: OMIT, freeze_auto_earn_amount: OMIT, additional_properties: nil)
|
|
63
|
+
@extended = extended
|
|
64
64
|
@length = length
|
|
65
65
|
@frequency = frequency
|
|
66
66
|
@started = started if started != OMIT
|
|
@@ -137,7 +137,7 @@ module TrophyApiClient
|
|
|
137
137
|
# @param obj [Object]
|
|
138
138
|
# @return [Void]
|
|
139
139
|
def self.validate_raw(obj:)
|
|
140
|
-
obj.extended
|
|
140
|
+
obj.extended.is_a?(Boolean) != false || raise("Passed value for field obj.extended is not the expected type, validation failed.")
|
|
141
141
|
obj.length.is_a?(Integer) != false || raise("Passed value for field obj.length is not the expected type, validation failed.")
|
|
142
142
|
obj.frequency.is_a?(TrophyApiClient::StreakFrequency) != false || raise("Passed value for field obj.frequency is not the expected type, validation failed.")
|
|
143
143
|
obj.started&.is_a?(String) != false || raise("Passed value for field obj.started is not the expected type, validation failed.")
|
|
@@ -8,11 +8,11 @@ module TrophyApiClient
|
|
|
8
8
|
class PointsAward
|
|
9
9
|
# @return [String] The ID of the trigger award
|
|
10
10
|
attr_reader :id
|
|
11
|
-
# @return [
|
|
11
|
+
# @return [Integer] The points awarded by this trigger
|
|
12
12
|
attr_reader :awarded
|
|
13
13
|
# @return [String] The date these points were awarded, in ISO 8601 format.
|
|
14
14
|
attr_reader :date
|
|
15
|
-
# @return [
|
|
15
|
+
# @return [Integer] The user's total points after this award occurred.
|
|
16
16
|
attr_reader :total
|
|
17
17
|
# @return [TrophyApiClient::PointsTrigger]
|
|
18
18
|
attr_reader :trigger
|
|
@@ -25,9 +25,9 @@ module TrophyApiClient
|
|
|
25
25
|
OMIT = Object.new
|
|
26
26
|
|
|
27
27
|
# @param id [String] The ID of the trigger award
|
|
28
|
-
# @param awarded [
|
|
28
|
+
# @param awarded [Integer] The points awarded by this trigger
|
|
29
29
|
# @param date [String] The date these points were awarded, in ISO 8601 format.
|
|
30
|
-
# @param total [
|
|
30
|
+
# @param total [Integer] The user's total points after this award occurred.
|
|
31
31
|
# @param trigger [TrophyApiClient::PointsTrigger]
|
|
32
32
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
33
33
|
# @return [TrophyApiClient::PointsAward]
|
|
@@ -91,9 +91,9 @@ module TrophyApiClient
|
|
|
91
91
|
# @return [Void]
|
|
92
92
|
def self.validate_raw(obj:)
|
|
93
93
|
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
94
|
-
obj.awarded&.is_a?(
|
|
94
|
+
obj.awarded&.is_a?(Integer) != false || raise("Passed value for field obj.awarded is not the expected type, validation failed.")
|
|
95
95
|
obj.date&.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
|
|
96
|
-
obj.total&.is_a?(
|
|
96
|
+
obj.total&.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
|
|
97
97
|
obj.trigger.nil? || TrophyApiClient::PointsTrigger.validate_raw(obj: obj.trigger)
|
|
98
98
|
end
|
|
99
99
|
end
|
|
@@ -5,11 +5,11 @@ require "json"
|
|
|
5
5
|
|
|
6
6
|
module TrophyApiClient
|
|
7
7
|
class PointsRange
|
|
8
|
-
# @return [
|
|
8
|
+
# @return [Integer] The start of the points range. Inclusive.
|
|
9
9
|
attr_reader :from
|
|
10
|
-
# @return [
|
|
10
|
+
# @return [Integer] The end of the points range. Inclusive.
|
|
11
11
|
attr_reader :to
|
|
12
|
-
# @return [
|
|
12
|
+
# @return [Integer] The number of users in this points range.
|
|
13
13
|
attr_reader :users
|
|
14
14
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
15
15
|
attr_reader :additional_properties
|
|
@@ -19,19 +19,17 @@ module TrophyApiClient
|
|
|
19
19
|
|
|
20
20
|
OMIT = Object.new
|
|
21
21
|
|
|
22
|
-
# @param from [
|
|
23
|
-
# @param to [
|
|
24
|
-
# @param users [
|
|
22
|
+
# @param from [Integer] The start of the points range. Inclusive.
|
|
23
|
+
# @param to [Integer] The end of the points range. Inclusive.
|
|
24
|
+
# @param users [Integer] The number of users in this points range.
|
|
25
25
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
26
|
# @return [TrophyApiClient::PointsRange]
|
|
27
|
-
def initialize(from
|
|
28
|
-
@from = from
|
|
29
|
-
@to = to
|
|
30
|
-
@users = users
|
|
27
|
+
def initialize(from:, to:, users:, additional_properties: nil)
|
|
28
|
+
@from = from
|
|
29
|
+
@to = to
|
|
30
|
+
@users = users
|
|
31
31
|
@additional_properties = additional_properties
|
|
32
|
-
@_field_set = { "from": from, "to": to, "users": users }
|
|
33
|
-
v == OMIT
|
|
34
|
-
end
|
|
32
|
+
@_field_set = { "from": from, "to": to, "users": users }
|
|
35
33
|
end
|
|
36
34
|
|
|
37
35
|
# Deserialize a JSON object to an instance of PointsRange
|
|
@@ -66,9 +64,9 @@ module TrophyApiClient
|
|
|
66
64
|
# @param obj [Object]
|
|
67
65
|
# @return [Void]
|
|
68
66
|
def self.validate_raw(obj:)
|
|
69
|
-
obj.from
|
|
70
|
-
obj.to
|
|
71
|
-
obj.users
|
|
67
|
+
obj.from.is_a?(Integer) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
|
|
68
|
+
obj.to.is_a?(Integer) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
|
|
69
|
+
obj.users.is_a?(Integer) != false || raise("Passed value for field obj.users is not the expected type, validation failed.")
|
|
72
70
|
end
|
|
73
71
|
end
|
|
74
72
|
end
|
|
@@ -14,6 +14,8 @@ module TrophyApiClient
|
|
|
14
14
|
attr_reader :description
|
|
15
15
|
# @return [String] The URL of the badge image for the points system, if one has been uploaded.
|
|
16
16
|
attr_reader :badge_url
|
|
17
|
+
# @return [Float] The maximum number of points a user can be awarded in this points system
|
|
18
|
+
attr_reader :max_points
|
|
17
19
|
# @return [Array<TrophyApiClient::PointsTriggerResponse>] Array of active triggers for this points system.
|
|
18
20
|
attr_reader :triggers
|
|
19
21
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
@@ -28,14 +30,17 @@ module TrophyApiClient
|
|
|
28
30
|
# @param name [String] The name of the points system.
|
|
29
31
|
# @param description [String] The description of the points system.
|
|
30
32
|
# @param badge_url [String] The URL of the badge image for the points system, if one has been uploaded.
|
|
33
|
+
# @param max_points [Float] The maximum number of points a user can be awarded in this points system
|
|
31
34
|
# @param triggers [Array<TrophyApiClient::PointsTriggerResponse>] Array of active triggers for this points system.
|
|
32
35
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
33
36
|
# @return [TrophyApiClient::PointsSystemResponse]
|
|
34
|
-
def initialize(id:, name:, triggers:, description: OMIT, badge_url: OMIT,
|
|
37
|
+
def initialize(id:, name:, triggers:, description: OMIT, badge_url: OMIT, max_points: OMIT,
|
|
38
|
+
additional_properties: nil)
|
|
35
39
|
@id = id
|
|
36
40
|
@name = name
|
|
37
41
|
@description = description if description != OMIT
|
|
38
42
|
@badge_url = badge_url if badge_url != OMIT
|
|
43
|
+
@max_points = max_points if max_points != OMIT
|
|
39
44
|
@triggers = triggers
|
|
40
45
|
@additional_properties = additional_properties
|
|
41
46
|
@_field_set = {
|
|
@@ -43,6 +48,7 @@ module TrophyApiClient
|
|
|
43
48
|
"name": name,
|
|
44
49
|
"description": description,
|
|
45
50
|
"badgeUrl": badge_url,
|
|
51
|
+
"maxPoints": max_points,
|
|
46
52
|
"triggers": triggers
|
|
47
53
|
}.reject do |_k, v|
|
|
48
54
|
v == OMIT
|
|
@@ -60,6 +66,7 @@ module TrophyApiClient
|
|
|
60
66
|
name = parsed_json["name"]
|
|
61
67
|
description = parsed_json["description"]
|
|
62
68
|
badge_url = parsed_json["badgeUrl"]
|
|
69
|
+
max_points = parsed_json["maxPoints"]
|
|
63
70
|
triggers = parsed_json["triggers"]&.map do |item|
|
|
64
71
|
item = item.to_json
|
|
65
72
|
TrophyApiClient::PointsTriggerResponse.from_json(json_object: item)
|
|
@@ -69,6 +76,7 @@ module TrophyApiClient
|
|
|
69
76
|
name: name,
|
|
70
77
|
description: description,
|
|
71
78
|
badge_url: badge_url,
|
|
79
|
+
max_points: max_points,
|
|
72
80
|
triggers: triggers,
|
|
73
81
|
additional_properties: struct
|
|
74
82
|
)
|
|
@@ -92,6 +100,7 @@ module TrophyApiClient
|
|
|
92
100
|
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
93
101
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
94
102
|
obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
|
|
103
|
+
obj.max_points&.is_a?(Float) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
|
|
95
104
|
obj.triggers.is_a?(Array) != false || raise("Passed value for field obj.triggers is not the expected type, validation failed.")
|
|
96
105
|
end
|
|
97
106
|
end
|