trophy_api_client 1.0.29 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- 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
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative "points_trigger_response_type"
|
4
4
|
require_relative "points_trigger_response_status"
|
5
|
+
require_relative "points_trigger_response_time_unit"
|
5
6
|
require_relative "points_trigger_response_user_attributes_item"
|
6
7
|
require_relative "points_trigger_response_event_attribute"
|
7
8
|
require "date"
|
@@ -14,7 +15,7 @@ module TrophyApiClient
|
|
14
15
|
attr_reader :id
|
15
16
|
# @return [TrophyApiClient::PointsTriggerResponseType] The type of trigger.
|
16
17
|
attr_reader :type
|
17
|
-
# @return [
|
18
|
+
# @return [Integer] The points awarded by this trigger.
|
18
19
|
attr_reader :points
|
19
20
|
# @return [TrophyApiClient::PointsTriggerResponseStatus] The status of the trigger.
|
20
21
|
attr_reader :status
|
@@ -24,10 +25,10 @@ module TrophyApiClient
|
|
24
25
|
# @return [String] The unique ID of the metric associated with this trigger, if the trigger is a
|
25
26
|
# metric.
|
26
27
|
attr_reader :metric_id
|
27
|
-
# @return [
|
28
|
+
# @return [Integer] The amount that a user must increase the metric to earn the points, if the
|
28
29
|
# trigger is a metric.
|
29
30
|
attr_reader :metric_threshold
|
30
|
-
# @return [
|
31
|
+
# @return [Integer] The number of consecutive streak periods that a user must complete to earn the
|
31
32
|
# points, if the trigger is a streak.
|
32
33
|
attr_reader :streak_length_threshold
|
33
34
|
# @return [String] The name of the metric associated with this trigger, if the trigger is a metric.
|
@@ -35,6 +36,10 @@ module TrophyApiClient
|
|
35
36
|
# @return [String] The name of the achievement associated with this trigger, if the trigger is an
|
36
37
|
# achievement.
|
37
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
|
38
43
|
# @return [Array<TrophyApiClient::PointsTriggerResponseUserAttributesItem>] User attribute filters that must be met for this trigger to activate. Only
|
39
44
|
# present if the trigger has user attribute filters configured.
|
40
45
|
attr_reader :user_attributes
|
@@ -55,19 +60,21 @@ module TrophyApiClient
|
|
55
60
|
|
56
61
|
# @param id [String] The unique ID of the trigger.
|
57
62
|
# @param type [TrophyApiClient::PointsTriggerResponseType] The type of trigger.
|
58
|
-
# @param points [
|
63
|
+
# @param points [Integer] The points awarded by this trigger.
|
59
64
|
# @param status [TrophyApiClient::PointsTriggerResponseStatus] The status of the trigger.
|
60
65
|
# @param achievement_id [String] The unique ID of the achievement associated with this trigger, if the trigger is
|
61
66
|
# an achievement.
|
62
67
|
# @param metric_id [String] The unique ID of the metric associated with this trigger, if the trigger is a
|
63
68
|
# metric.
|
64
|
-
# @param metric_threshold [
|
69
|
+
# @param metric_threshold [Integer] The amount that a user must increase the metric to earn the points, if the
|
65
70
|
# trigger is a metric.
|
66
|
-
# @param streak_length_threshold [
|
71
|
+
# @param streak_length_threshold [Integer] The number of consecutive streak periods that a user must complete to earn the
|
67
72
|
# points, if the trigger is a streak.
|
68
73
|
# @param metric_name [String] The name of the metric associated with this trigger, if the trigger is a metric.
|
69
74
|
# @param achievement_name [String] The name of the achievement associated with this trigger, if the trigger is an
|
70
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.
|
71
78
|
# @param user_attributes [Array<TrophyApiClient::PointsTriggerResponseUserAttributesItem>] User attribute filters that must be met for this trigger to activate. Only
|
72
79
|
# present if the trigger has user attribute filters configured.
|
73
80
|
# @param event_attribute [TrophyApiClient::PointsTriggerResponseEventAttribute] Event attribute filter that must be met for this trigger to activate. Only
|
@@ -76,22 +83,24 @@ module TrophyApiClient
|
|
76
83
|
# @param updated [DateTime] The date and time the trigger was last updated, in ISO 8601 format.
|
77
84
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
78
85
|
# @return [TrophyApiClient::PointsTriggerResponse]
|
79
|
-
def initialize(id
|
80
|
-
|
81
|
-
@id = id
|
82
|
-
@type = type
|
83
|
-
@points = points
|
84
|
-
@status = status
|
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
|
85
92
|
@achievement_id = achievement_id if achievement_id != OMIT
|
86
93
|
@metric_id = metric_id if metric_id != OMIT
|
87
94
|
@metric_threshold = metric_threshold if metric_threshold != OMIT
|
88
95
|
@streak_length_threshold = streak_length_threshold if streak_length_threshold != OMIT
|
89
96
|
@metric_name = metric_name if metric_name != OMIT
|
90
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
|
91
100
|
@user_attributes = user_attributes if user_attributes != OMIT
|
92
101
|
@event_attribute = event_attribute if event_attribute != OMIT
|
93
|
-
@created = created
|
94
|
-
@updated = updated
|
102
|
+
@created = created
|
103
|
+
@updated = updated
|
95
104
|
@additional_properties = additional_properties
|
96
105
|
@_field_set = {
|
97
106
|
"id": id,
|
@@ -104,6 +113,8 @@ module TrophyApiClient
|
|
104
113
|
"streakLengthThreshold": streak_length_threshold,
|
105
114
|
"metricName": metric_name,
|
106
115
|
"achievementName": achievement_name,
|
116
|
+
"timeUnit": time_unit,
|
117
|
+
"timeInterval": time_interval,
|
107
118
|
"userAttributes": user_attributes,
|
108
119
|
"eventAttribute": event_attribute,
|
109
120
|
"created": created,
|
@@ -130,6 +141,8 @@ module TrophyApiClient
|
|
130
141
|
streak_length_threshold = parsed_json["streakLengthThreshold"]
|
131
142
|
metric_name = parsed_json["metricName"]
|
132
143
|
achievement_name = parsed_json["achievementName"]
|
144
|
+
time_unit = parsed_json["timeUnit"]
|
145
|
+
time_interval = parsed_json["timeInterval"]
|
133
146
|
user_attributes = parsed_json["userAttributes"]&.map do |item|
|
134
147
|
item = item.to_json
|
135
148
|
TrophyApiClient::PointsTriggerResponseUserAttributesItem.from_json(json_object: item)
|
@@ -153,6 +166,8 @@ module TrophyApiClient
|
|
153
166
|
streak_length_threshold: streak_length_threshold,
|
154
167
|
metric_name: metric_name,
|
155
168
|
achievement_name: achievement_name,
|
169
|
+
time_unit: time_unit,
|
170
|
+
time_interval: time_interval,
|
156
171
|
user_attributes: user_attributes,
|
157
172
|
event_attribute: event_attribute,
|
158
173
|
created: created,
|
@@ -175,20 +190,22 @@ module TrophyApiClient
|
|
175
190
|
# @param obj [Object]
|
176
191
|
# @return [Void]
|
177
192
|
def self.validate_raw(obj:)
|
178
|
-
obj.id
|
179
|
-
obj.type
|
180
|
-
obj.points
|
181
|
-
obj.status
|
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.")
|
182
197
|
obj.achievement_id&.is_a?(String) != false || raise("Passed value for field obj.achievement_id is not the expected type, validation failed.")
|
183
198
|
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
184
|
-
obj.metric_threshold&.is_a?(
|
185
|
-
obj.streak_length_threshold&.is_a?(
|
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.")
|
186
201
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
187
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.")
|
188
205
|
obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
189
206
|
obj.event_attribute.nil? || TrophyApiClient::PointsTriggerResponseEventAttribute.validate_raw(obj: obj.event_attribute)
|
190
|
-
obj.created
|
191
|
-
obj.updated
|
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.")
|
192
209
|
end
|
193
210
|
end
|
194
211
|
end
|
@@ -38,14 +38,14 @@ module TrophyApiClient
|
|
38
38
|
# up in the Trophy dashboard.
|
39
39
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
40
40
|
# @return [TrophyApiClient::UpdatedUser]
|
41
|
-
def initialize(email
|
41
|
+
def initialize(email:, name:, device_tokens:, subscribe_to_emails:, attributes:, tz: OMIT,
|
42
42
|
additional_properties: nil)
|
43
|
-
@email = email
|
44
|
-
@name = name
|
43
|
+
@email = email
|
44
|
+
@name = name
|
45
45
|
@tz = tz if tz != OMIT
|
46
|
-
@device_tokens = device_tokens
|
47
|
-
@subscribe_to_emails = subscribe_to_emails
|
48
|
-
@attributes = attributes
|
46
|
+
@device_tokens = device_tokens
|
47
|
+
@subscribe_to_emails = subscribe_to_emails
|
48
|
+
@attributes = attributes
|
49
49
|
@additional_properties = additional_properties
|
50
50
|
@_field_set = {
|
51
51
|
"email": email,
|
@@ -97,12 +97,12 @@ module TrophyApiClient
|
|
97
97
|
# @param obj [Object]
|
98
98
|
# @return [Void]
|
99
99
|
def self.validate_raw(obj:)
|
100
|
-
obj.email
|
101
|
-
obj.name
|
100
|
+
obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
|
101
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
102
102
|
obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
|
103
|
-
obj.device_tokens
|
104
|
-
obj.subscribe_to_emails
|
105
|
-
obj.attributes
|
103
|
+
obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
|
104
|
+
obj.subscribe_to_emails.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
|
105
|
+
obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
@@ -41,15 +41,15 @@ module TrophyApiClient
|
|
41
41
|
# up in the Trophy dashboard.
|
42
42
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
43
43
|
# @return [TrophyApiClient::UpsertedUser]
|
44
|
-
def initialize(id:, email
|
45
|
-
|
44
|
+
def initialize(id:, email:, name:, device_tokens:, subscribe_to_emails:, attributes:, tz: OMIT,
|
45
|
+
additional_properties: nil)
|
46
46
|
@id = id
|
47
|
-
@email = email
|
48
|
-
@name = name
|
47
|
+
@email = email
|
48
|
+
@name = name
|
49
49
|
@tz = tz if tz != OMIT
|
50
|
-
@device_tokens = device_tokens
|
51
|
-
@subscribe_to_emails = subscribe_to_emails
|
52
|
-
@attributes = attributes
|
50
|
+
@device_tokens = device_tokens
|
51
|
+
@subscribe_to_emails = subscribe_to_emails
|
52
|
+
@attributes = attributes
|
53
53
|
@additional_properties = additional_properties
|
54
54
|
@_field_set = {
|
55
55
|
"id": id,
|
@@ -105,12 +105,12 @@ module TrophyApiClient
|
|
105
105
|
# @return [Void]
|
106
106
|
def self.validate_raw(obj:)
|
107
107
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
108
|
-
obj.email
|
109
|
-
obj.name
|
108
|
+
obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
|
109
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
110
110
|
obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
|
111
|
-
obj.device_tokens
|
112
|
-
obj.subscribe_to_emails
|
113
|
-
obj.attributes
|
111
|
+
obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
|
112
|
+
obj.subscribe_to_emails.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
|
113
|
+
obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -53,18 +53,18 @@ module TrophyApiClient
|
|
53
53
|
# up in the Trophy dashboard.
|
54
54
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
55
55
|
# @return [TrophyApiClient::User]
|
56
|
-
def initialize(
|
57
|
-
|
58
|
-
@control = control
|
59
|
-
@created = created
|
60
|
-
@updated = updated
|
56
|
+
def initialize(control:, created:, updated:, id:, email:, name:, device_tokens:, subscribe_to_emails:, attributes:,
|
57
|
+
tz: OMIT, additional_properties: nil)
|
58
|
+
@control = control
|
59
|
+
@created = created
|
60
|
+
@updated = updated
|
61
61
|
@id = id
|
62
|
-
@email = email
|
63
|
-
@name = name
|
62
|
+
@email = email
|
63
|
+
@name = name
|
64
64
|
@tz = tz if tz != OMIT
|
65
|
-
@device_tokens = device_tokens
|
66
|
-
@subscribe_to_emails = subscribe_to_emails
|
67
|
-
@attributes = attributes
|
65
|
+
@device_tokens = device_tokens
|
66
|
+
@subscribe_to_emails = subscribe_to_emails
|
67
|
+
@attributes = attributes
|
68
68
|
@additional_properties = additional_properties
|
69
69
|
@_field_set = {
|
70
70
|
"control": control,
|
@@ -128,16 +128,16 @@ module TrophyApiClient
|
|
128
128
|
# @param obj [Object]
|
129
129
|
# @return [Void]
|
130
130
|
def self.validate_raw(obj:)
|
131
|
-
obj.control
|
132
|
-
obj.created
|
133
|
-
obj.updated
|
131
|
+
obj.control.is_a?(Boolean) != false || raise("Passed value for field obj.control is not the expected type, validation failed.")
|
132
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
133
|
+
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
134
134
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
135
|
-
obj.email
|
136
|
-
obj.name
|
135
|
+
obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
|
136
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
137
137
|
obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
|
138
|
-
obj.device_tokens
|
139
|
-
obj.subscribe_to_emails
|
140
|
-
obj.attributes
|
138
|
+
obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
|
139
|
+
obj.subscribe_to_emails.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
|
140
|
+
obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "leaderboard_event"
|
4
|
-
require_relative "leaderboard_response_status"
|
5
3
|
require_relative "leaderboard_response_rank_by"
|
4
|
+
require_relative "leaderboard_response_run_unit"
|
6
5
|
require "ostruct"
|
7
6
|
require "json"
|
8
7
|
|
@@ -15,16 +14,12 @@ module TrophyApiClient
|
|
15
14
|
# @return [Integer] The user's current value in this leaderboard. Null if the user is not on the
|
16
15
|
# leaderboard.
|
17
16
|
attr_reader :value
|
18
|
-
# @return [Array<TrophyApiClient::LeaderboardEvent>] An array of events showing the user's rank and value changes over time.
|
19
|
-
attr_reader :history
|
20
17
|
# @return [String] The unique ID of the leaderboard.
|
21
18
|
attr_reader :id
|
22
19
|
# @return [String] The user-facing name of the leaderboard.
|
23
20
|
attr_reader :name
|
24
21
|
# @return [String] The unique key used to reference the leaderboard in APIs.
|
25
22
|
attr_reader :key
|
26
|
-
# @return [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
|
27
|
-
attr_reader :status
|
28
23
|
# @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
|
29
24
|
attr_reader :rank_by
|
30
25
|
# @return [String] The key of the metric to rank by, if rankBy is 'metric'.
|
@@ -44,7 +39,7 @@ module TrophyApiClient
|
|
44
39
|
attr_reader :end_
|
45
40
|
# @return [Integer] The maximum number of participants in the leaderboard.
|
46
41
|
attr_reader :max_participants
|
47
|
-
# @return [
|
42
|
+
# @return [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
|
48
43
|
# leaderboards.
|
49
44
|
attr_reader :run_unit
|
50
45
|
# @return [Integer] The interval between repetitions, relative to the start date and repetition
|
@@ -62,11 +57,9 @@ module TrophyApiClient
|
|
62
57
|
# leaderboard.
|
63
58
|
# @param value [Integer] The user's current value in this leaderboard. Null if the user is not on the
|
64
59
|
# leaderboard.
|
65
|
-
# @param history [Array<TrophyApiClient::LeaderboardEvent>] An array of events showing the user's rank and value changes over time.
|
66
60
|
# @param id [String] The unique ID of the leaderboard.
|
67
61
|
# @param name [String] The user-facing name of the leaderboard.
|
68
62
|
# @param key [String] The unique key used to reference the leaderboard in APIs.
|
69
|
-
# @param status [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
|
70
63
|
# @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
|
71
64
|
# @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
|
72
65
|
# @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
|
@@ -77,27 +70,25 @@ module TrophyApiClient
|
|
77
70
|
# @param end_ [String] The end date of the leaderboard in YYYY-MM-DD format, or null if it runs
|
78
71
|
# forever.
|
79
72
|
# @param max_participants [Integer] The maximum number of participants in the leaderboard.
|
80
|
-
# @param run_unit [
|
73
|
+
# @param run_unit [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
|
81
74
|
# leaderboards.
|
82
75
|
# @param run_interval [Integer] The interval between repetitions, relative to the start date and repetition
|
83
76
|
# type.
|
84
77
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
85
78
|
# @return [TrophyApiClient::UserLeaderboardResponse]
|
86
|
-
def initialize(
|
87
|
-
|
79
|
+
def initialize(id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, rank: OMIT, value: OMIT, metric_key: OMIT, metric_name: OMIT,
|
80
|
+
points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
|
88
81
|
@rank = rank if rank != OMIT
|
89
82
|
@value = value if value != OMIT
|
90
|
-
@history = history
|
91
83
|
@id = id
|
92
84
|
@name = name
|
93
85
|
@key = key
|
94
|
-
@status = status if status != OMIT
|
95
86
|
@rank_by = rank_by
|
96
87
|
@metric_key = metric_key if metric_key != OMIT
|
97
88
|
@metric_name = metric_name if metric_name != OMIT
|
98
89
|
@points_system_key = points_system_key if points_system_key != OMIT
|
99
90
|
@points_system_name = points_system_name if points_system_name != OMIT
|
100
|
-
@description = description
|
91
|
+
@description = description
|
101
92
|
@start = start
|
102
93
|
@end_ = end_ if end_ != OMIT
|
103
94
|
@max_participants = max_participants
|
@@ -107,11 +98,9 @@ module TrophyApiClient
|
|
107
98
|
@_field_set = {
|
108
99
|
"rank": rank,
|
109
100
|
"value": value,
|
110
|
-
"history": history,
|
111
101
|
"id": id,
|
112
102
|
"name": name,
|
113
103
|
"key": key,
|
114
|
-
"status": status,
|
115
104
|
"rankBy": rank_by,
|
116
105
|
"metricKey": metric_key,
|
117
106
|
"metricName": metric_name,
|
@@ -137,14 +126,9 @@ module TrophyApiClient
|
|
137
126
|
parsed_json = JSON.parse(json_object)
|
138
127
|
rank = parsed_json["rank"]
|
139
128
|
value = parsed_json["value"]
|
140
|
-
history = parsed_json["history"]&.map do |item|
|
141
|
-
item = item.to_json
|
142
|
-
TrophyApiClient::LeaderboardEvent.from_json(json_object: item)
|
143
|
-
end
|
144
129
|
id = parsed_json["id"]
|
145
130
|
name = parsed_json["name"]
|
146
131
|
key = parsed_json["key"]
|
147
|
-
status = parsed_json["status"]
|
148
132
|
rank_by = parsed_json["rankBy"]
|
149
133
|
metric_key = parsed_json["metricKey"]
|
150
134
|
metric_name = parsed_json["metricName"]
|
@@ -159,11 +143,9 @@ module TrophyApiClient
|
|
159
143
|
new(
|
160
144
|
rank: rank,
|
161
145
|
value: value,
|
162
|
-
history: history,
|
163
146
|
id: id,
|
164
147
|
name: name,
|
165
148
|
key: key,
|
166
|
-
status: status,
|
167
149
|
rank_by: rank_by,
|
168
150
|
metric_key: metric_key,
|
169
151
|
metric_name: metric_name,
|
@@ -195,21 +177,19 @@ module TrophyApiClient
|
|
195
177
|
def self.validate_raw(obj:)
|
196
178
|
obj.rank&.is_a?(Integer) != false || raise("Passed value for field obj.rank is not the expected type, validation failed.")
|
197
179
|
obj.value&.is_a?(Integer) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
198
|
-
obj.history.is_a?(Array) != false || raise("Passed value for field obj.history is not the expected type, validation failed.")
|
199
180
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
200
181
|
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
201
182
|
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
202
|
-
obj.status&.is_a?(TrophyApiClient::LeaderboardResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
203
183
|
obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
|
204
184
|
obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
|
205
185
|
obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
|
206
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.")
|
207
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.")
|
208
|
-
obj.description
|
188
|
+
obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
209
189
|
obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
210
190
|
obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
211
191
|
obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
|
212
|
-
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.")
|
213
193
|
obj.run_interval.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
|
214
194
|
end
|
215
195
|
end
|