trophy_api_client 1.0.30 → 1.0.32

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c25a821fcf1f05012a279bf8ad031328a32bf4e485600e4b6f1db1484de8daa8
4
- data.tar.gz: b2b975f8d431ec31f8ddec8bb2f73803dee6a45ebcbb4b92103ea904b7f5ae6b
3
+ metadata.gz: 2e8eb5e832f3fed9bedb450cff8e7b9871c1a0abc5c05acfc83afd154a92c9a3
4
+ data.tar.gz: 9b7e52702a6d4b009e995c06b5e6cf46bd663c9dc03380047827cf765cc49f6c
5
5
  SHA512:
6
- metadata.gz: 33c5da328d9511d8a1f0231d1697ebf671b9463b426fcf575a9be4037f5963f5a23347e358e38ef12a05fbc9da9a6c27f2ad36b134a07d07887605ae8d44c86a
7
- data.tar.gz: 01dbb928522b7d992d4788e3112f058455a143f870215824a2c1336cb165ace1bb5a5469ec4cbfade09c31cc49987931119156b05efb1ad2c9ebeb8b97339a0a
6
+ metadata.gz: a0bd2b1d3ee672308e7bcdca87092c30ec5173b1ef0c31219968aa9c20e53a93857cb76b0d1da3a9fe9ce05fb58c0bbc3304df5f4e263a59aad85aaf7e167ccd
7
+ data.tar.gz: 42d1f56df6f7c37ba0d06a85a211b434b5215f14c8bbf869f6d2dc21644bd3e21abed4e986b343d2a4a35ef7ebec5ceaa732168f74c8d1f660bc8a340e2b517f
data/lib/gemconfig.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  module Gemconfig
5
- VERSION = "1.0.30"
5
+ VERSION = "1.0.32"
6
6
  AUTHORS = ["Trophy Labs, Inc"].freeze
7
7
  EMAIL = ""
8
8
  SUMMARY = "Ruby library for the Trophy API."
@@ -20,6 +20,9 @@ module TrophyApiClient
20
20
 
21
21
  # Get all achievements and their completion stats.
22
22
  #
23
+ # @param user_attributes [String] Optional colon-delimited user attributes in the format
24
+ # attribute:value,attribute:value. Only achievements accessible to a user with the
25
+ # provided attributes will be returned.
23
26
  # @param request_options [TrophyApiClient::RequestOptions]
24
27
  # @return [Array<TrophyApiClient::AchievementWithStatsResponse>]
25
28
  # @example
@@ -28,8 +31,8 @@ module TrophyApiClient
28
31
  # environment: TrophyApiClient::Environment::PRODUCTION,
29
32
  # api_key: "YOUR_API_KEY"
30
33
  # )
31
- # api.achievements.all
32
- def all(request_options: nil)
34
+ # api.achievements.all(user_attributes: "plan-type:premium,region:us-east")
35
+ def all(user_attributes: nil, request_options: nil)
33
36
  response = @request_client.conn.get do |req|
34
37
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
35
38
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
@@ -38,9 +41,10 @@ module TrophyApiClient
38
41
  **@request_client.get_headers,
39
42
  **(request_options&.additional_headers || {})
40
43
  }.compact
41
- unless request_options.nil? || request_options&.additional_query_parameters.nil?
42
- req.params = { **(request_options&.additional_query_parameters || {}) }.compact
43
- end
44
+ req.params = {
45
+ **(request_options&.additional_query_parameters || {}),
46
+ "userAttributes": user_attributes
47
+ }.compact
44
48
  unless request_options.nil? || request_options&.additional_body_parameters.nil?
45
49
  req.body = { **(request_options&.additional_body_parameters || {}) }.compact
46
50
  end
@@ -72,7 +76,7 @@ module TrophyApiClient
72
76
  # environment: TrophyApiClient::Environment::PRODUCTION,
73
77
  # api_key: "YOUR_API_KEY"
74
78
  # )
75
- # api.achievements.complete(key: "finish-onboarding", user: { email: "user@example.com", name: "User", tz: "Europe/London", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" }, id: "user-id" })
79
+ # api.achievements.complete(key: "finish-onboarding", user: { email: "user@example.com", tz: "Europe/London", id: "user-id" })
76
80
  def complete(key:, user:, request_options: nil)
77
81
  response = @request_client.conn.post do |req|
78
82
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -105,6 +109,9 @@ module TrophyApiClient
105
109
 
106
110
  # Get all achievements and their completion stats.
107
111
  #
112
+ # @param user_attributes [String] Optional colon-delimited user attributes in the format
113
+ # attribute:value,attribute:value. Only achievements accessible to a user with the
114
+ # provided attributes will be returned.
108
115
  # @param request_options [TrophyApiClient::RequestOptions]
109
116
  # @return [Array<TrophyApiClient::AchievementWithStatsResponse>]
110
117
  # @example
@@ -113,8 +120,8 @@ module TrophyApiClient
113
120
  # environment: TrophyApiClient::Environment::PRODUCTION,
114
121
  # api_key: "YOUR_API_KEY"
115
122
  # )
116
- # api.achievements.all
117
- def all(request_options: nil)
123
+ # api.achievements.all(user_attributes: "plan-type:premium,region:us-east")
124
+ def all(user_attributes: nil, request_options: nil)
118
125
  Async do
119
126
  response = @request_client.conn.get do |req|
120
127
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -124,9 +131,10 @@ module TrophyApiClient
124
131
  **@request_client.get_headers,
125
132
  **(request_options&.additional_headers || {})
126
133
  }.compact
127
- unless request_options.nil? || request_options&.additional_query_parameters.nil?
128
- req.params = { **(request_options&.additional_query_parameters || {}) }.compact
129
- end
134
+ req.params = {
135
+ **(request_options&.additional_query_parameters || {}),
136
+ "userAttributes": user_attributes
137
+ }.compact
130
138
  unless request_options.nil? || request_options&.additional_body_parameters.nil?
131
139
  req.body = { **(request_options&.additional_body_parameters || {}) }.compact
132
140
  end
@@ -159,7 +167,7 @@ module TrophyApiClient
159
167
  # environment: TrophyApiClient::Environment::PRODUCTION,
160
168
  # api_key: "YOUR_API_KEY"
161
169
  # )
162
- # api.achievements.complete(key: "finish-onboarding", user: { email: "user@example.com", name: "User", tz: "Europe/London", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" }, id: "user-id" })
170
+ # api.achievements.complete(key: "finish-onboarding", user: { email: "user@example.com", tz: "Europe/London", id: "user-id" })
163
171
  def complete(key:, user:, request_options: nil)
164
172
  Async do
165
173
  response = @request_client.conn.post do |req|
@@ -56,11 +56,15 @@ module TrophyApiClient
56
56
  #
57
57
  # @param key [String] Unique key of the leaderboard as set when created.
58
58
  # @param offset [Integer] Number of rankings to skip for pagination.
59
- # @param limit [Integer] Maximum number of rankings to return.
59
+ # @param limit [Integer] Maximum number of rankings to return. Cannot be greater than the size of the
60
+ # leaderboard.
60
61
  # @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
61
62
  # run.
62
63
  # @param user_id [String] When provided, offset is relative to this user's position on the leaderboard. If
63
64
  # the user is not found in the leaderboard, returns empty rankings array.
65
+ # @param user_attributes [String] Attribute key and value to filter the rankings by, separated by a colon. For
66
+ # example, `city:London`. This parameter is required, and only valid for
67
+ # leaderboards with a breakdown attribute.
64
68
  # @param request_options [TrophyApiClient::RequestOptions]
65
69
  # @return [TrophyApiClient::LeaderboardResponseWithRankings]
66
70
  # @example
@@ -74,9 +78,10 @@ module TrophyApiClient
74
78
  # offset: 1,
75
79
  # limit: 1,
76
80
  # run: "2025-01-15",
77
- # user_id: "user-123"
81
+ # user_id: "user-123",
82
+ # user_attributes: "city:London"
78
83
  # )
79
- def get(key:, offset: nil, limit: nil, run: nil, user_id: nil, request_options: nil)
84
+ def get(key:, offset: nil, limit: nil, run: nil, user_id: nil, user_attributes: nil, request_options: nil)
80
85
  response = @request_client.conn.get do |req|
81
86
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
82
87
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
@@ -90,7 +95,8 @@ module TrophyApiClient
90
95
  "offset": offset,
91
96
  "limit": limit,
92
97
  "run": run,
93
- "userId": user_id
98
+ "userId": user_id,
99
+ "userAttributes": user_attributes
94
100
  }.compact
95
101
  unless request_options.nil? || request_options&.additional_body_parameters.nil?
96
102
  req.body = { **(request_options&.additional_body_parameters || {}) }.compact
@@ -152,11 +158,15 @@ module TrophyApiClient
152
158
  #
153
159
  # @param key [String] Unique key of the leaderboard as set when created.
154
160
  # @param offset [Integer] Number of rankings to skip for pagination.
155
- # @param limit [Integer] Maximum number of rankings to return.
161
+ # @param limit [Integer] Maximum number of rankings to return. Cannot be greater than the size of the
162
+ # leaderboard.
156
163
  # @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
157
164
  # run.
158
165
  # @param user_id [String] When provided, offset is relative to this user's position on the leaderboard. If
159
166
  # the user is not found in the leaderboard, returns empty rankings array.
167
+ # @param user_attributes [String] Attribute key and value to filter the rankings by, separated by a colon. For
168
+ # example, `city:London`. This parameter is required, and only valid for
169
+ # leaderboards with a breakdown attribute.
160
170
  # @param request_options [TrophyApiClient::RequestOptions]
161
171
  # @return [TrophyApiClient::LeaderboardResponseWithRankings]
162
172
  # @example
@@ -170,9 +180,10 @@ module TrophyApiClient
170
180
  # offset: 1,
171
181
  # limit: 1,
172
182
  # run: "2025-01-15",
173
- # user_id: "user-123"
183
+ # user_id: "user-123",
184
+ # user_attributes: "city:London"
174
185
  # )
175
- def get(key:, offset: nil, limit: nil, run: nil, user_id: nil, request_options: nil)
186
+ def get(key:, offset: nil, limit: nil, run: nil, user_id: nil, user_attributes: nil, request_options: nil)
176
187
  Async do
177
188
  response = @request_client.conn.get do |req|
178
189
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -187,7 +198,8 @@ module TrophyApiClient
187
198
  "offset": offset,
188
199
  "limit": limit,
189
200
  "run": run,
190
- "userId": user_id
201
+ "userId": user_id,
202
+ "userAttributes": user_attributes
191
203
  }.compact
192
204
  unless request_options.nil? || request_options&.additional_body_parameters.nil?
193
205
  req.body = { **(request_options&.additional_body_parameters || {}) }.compact
@@ -19,6 +19,8 @@ module TrophyApiClient
19
19
  attr_reader :key
20
20
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
21
21
  attr_reader :rank_by
22
+ # @return [String] The key of the attribute to break down this leaderboard by.
23
+ attr_reader :breakdown_attribute
22
24
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
23
25
  attr_reader :metric_key
24
26
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -55,6 +57,7 @@ module TrophyApiClient
55
57
  # @param name [String] The user-facing name of the leaderboard.
56
58
  # @param key [String] The unique key used to reference the leaderboard in APIs.
57
59
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
60
+ # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
58
61
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
59
62
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
60
63
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -70,13 +73,14 @@ module TrophyApiClient
70
73
  # type.
71
74
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
72
75
  # @return [TrophyApiClient::Leaderboards::LeaderboardsAllResponseItem]
73
- def initialize(status:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT,
74
- points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
76
+ def initialize(status:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, breakdown_attribute: OMIT, metric_key: OMIT,
77
+ metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
75
78
  @status = status
76
79
  @id = id
77
80
  @name = name
78
81
  @key = key
79
82
  @rank_by = rank_by
83
+ @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
80
84
  @metric_key = metric_key if metric_key != OMIT
81
85
  @metric_name = metric_name if metric_name != OMIT
82
86
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -94,6 +98,7 @@ module TrophyApiClient
94
98
  "name": name,
95
99
  "key": key,
96
100
  "rankBy": rank_by,
101
+ "breakdownAttribute": breakdown_attribute,
97
102
  "metricKey": metric_key,
98
103
  "metricName": metric_name,
99
104
  "pointsSystemKey": points_system_key,
@@ -121,6 +126,7 @@ module TrophyApiClient
121
126
  name = parsed_json["name"]
122
127
  key = parsed_json["key"]
123
128
  rank_by = parsed_json["rankBy"]
129
+ breakdown_attribute = parsed_json["breakdownAttribute"]
124
130
  metric_key = parsed_json["metricKey"]
125
131
  metric_name = parsed_json["metricName"]
126
132
  points_system_key = parsed_json["pointsSystemKey"]
@@ -137,6 +143,7 @@ module TrophyApiClient
137
143
  name: name,
138
144
  key: key,
139
145
  rank_by: rank_by,
146
+ breakdown_attribute: breakdown_attribute,
140
147
  metric_key: metric_key,
141
148
  metric_name: metric_name,
142
149
  points_system_key: points_system_key,
@@ -170,6 +177,7 @@ module TrophyApiClient
170
177
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
171
178
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
172
179
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
180
+ obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
173
181
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
174
182
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
175
183
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -42,7 +42,7 @@ module TrophyApiClient
42
42
  # api.metrics.event(
43
43
  # idempotency_key: "e4296e4b-8493-4bd1-9c30-5a1a9ac4d78f",
44
44
  # key: "words-written",
45
- # user: { email: "user@example.com", name: "User", tz: "Europe/London", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" }, id: "18" },
45
+ # user: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" }, id: "18" },
46
46
  # value: 750,
47
47
  # attributes: { "category": "writing", "source": "mobile-app" }
48
48
  # )
@@ -107,7 +107,7 @@ module TrophyApiClient
107
107
  # api.metrics.event(
108
108
  # idempotency_key: "e4296e4b-8493-4bd1-9c30-5a1a9ac4d78f",
109
109
  # key: "words-written",
110
- # user: { email: "user@example.com", name: "User", tz: "Europe/London", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" }, id: "18" },
110
+ # user: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" }, id: "18" },
111
111
  # value: 750,
112
112
  # attributes: { "category": "writing", "source": "mobile-app" }
113
113
  # )
@@ -21,8 +21,8 @@ module TrophyApiClient
21
21
  #
22
22
  # @param key [String] Key of the points system.
23
23
  # @param user_attributes [String] Optional colon-delimited user attribute filters in the format
24
- # attributeKey:value,attributeKey:value. Only users matching ALL specified
25
- # attributes will be included in the points breakdown.
24
+ # attribute:value,attribute:value. Only users matching ALL specified attributes
25
+ # will be included in the points breakdown.
26
26
  # @param request_options [TrophyApiClient::RequestOptions]
27
27
  # @return [TrophyApiClient::POINTS_SUMMARY_RESPONSE]
28
28
  # @example
@@ -104,8 +104,8 @@ module TrophyApiClient
104
104
  #
105
105
  # @param key [String] Key of the points system.
106
106
  # @param user_attributes [String] Optional colon-delimited user attribute filters in the format
107
- # attributeKey:value,attributeKey:value. Only users matching ALL specified
108
- # attributes will be included in the points breakdown.
107
+ # attribute:value,attribute:value. Only users matching ALL specified attributes
108
+ # will be included in the points breakdown.
109
109
  # @param request_options [TrophyApiClient::RequestOptions]
110
110
  # @return [TrophyApiClient::POINTS_SUMMARY_RESPONSE]
111
111
  # @example
@@ -16,6 +16,8 @@ module TrophyApiClient
16
16
  attr_reader :key
17
17
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
18
18
  attr_reader :rank_by
19
+ # @return [String] The key of the attribute to break down this leaderboard by.
20
+ attr_reader :breakdown_attribute
19
21
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
20
22
  attr_reader :metric_key
21
23
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -51,6 +53,7 @@ module TrophyApiClient
51
53
  # @param name [String] The user-facing name of the leaderboard.
52
54
  # @param key [String] The unique key used to reference the leaderboard in APIs.
53
55
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
56
+ # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
54
57
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
55
58
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
56
59
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -66,12 +69,13 @@ module TrophyApiClient
66
69
  # type.
67
70
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
68
71
  # @return [TrophyApiClient::LeaderboardResponse]
69
- def initialize(id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT,
70
- points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
72
+ def initialize(id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT,
73
+ points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
71
74
  @id = id
72
75
  @name = name
73
76
  @key = key
74
77
  @rank_by = rank_by
78
+ @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
75
79
  @metric_key = metric_key if metric_key != OMIT
76
80
  @metric_name = metric_name if metric_name != OMIT
77
81
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -88,6 +92,7 @@ module TrophyApiClient
88
92
  "name": name,
89
93
  "key": key,
90
94
  "rankBy": rank_by,
95
+ "breakdownAttribute": breakdown_attribute,
91
96
  "metricKey": metric_key,
92
97
  "metricName": metric_name,
93
98
  "pointsSystemKey": points_system_key,
@@ -114,6 +119,7 @@ module TrophyApiClient
114
119
  name = parsed_json["name"]
115
120
  key = parsed_json["key"]
116
121
  rank_by = parsed_json["rankBy"]
122
+ breakdown_attribute = parsed_json["breakdownAttribute"]
117
123
  metric_key = parsed_json["metricKey"]
118
124
  metric_name = parsed_json["metricName"]
119
125
  points_system_key = parsed_json["pointsSystemKey"]
@@ -129,6 +135,7 @@ module TrophyApiClient
129
135
  name: name,
130
136
  key: key,
131
137
  rank_by: rank_by,
138
+ breakdown_attribute: breakdown_attribute,
132
139
  metric_key: metric_key,
133
140
  metric_name: metric_name,
134
141
  points_system_key: points_system_key,
@@ -161,6 +168,7 @@ module TrophyApiClient
161
168
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
162
169
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
163
170
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
171
+ obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
164
172
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
165
173
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
166
174
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -21,6 +21,8 @@ module TrophyApiClient
21
21
  attr_reader :key
22
22
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
23
23
  attr_reader :rank_by
24
+ # @return [String] The key of the attribute to break down this leaderboard by.
25
+ attr_reader :breakdown_attribute
24
26
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
25
27
  attr_reader :metric_key
26
28
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -58,6 +60,7 @@ module TrophyApiClient
58
60
  # @param name [String] The user-facing name of the leaderboard.
59
61
  # @param key [String] The unique key used to reference the leaderboard in APIs.
60
62
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
63
+ # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
61
64
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
62
65
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
63
66
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -73,14 +76,15 @@ module TrophyApiClient
73
76
  # type.
74
77
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
75
78
  # @return [TrophyApiClient::LeaderboardResponseWithRankings]
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)
79
+ def initialize(status:, rankings:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, breakdown_attribute: OMIT, metric_key: OMIT,
80
+ metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
78
81
  @status = status
79
82
  @rankings = rankings
80
83
  @id = id
81
84
  @name = name
82
85
  @key = key
83
86
  @rank_by = rank_by
87
+ @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
84
88
  @metric_key = metric_key if metric_key != OMIT
85
89
  @metric_name = metric_name if metric_name != OMIT
86
90
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -99,6 +103,7 @@ module TrophyApiClient
99
103
  "name": name,
100
104
  "key": key,
101
105
  "rankBy": rank_by,
106
+ "breakdownAttribute": breakdown_attribute,
102
107
  "metricKey": metric_key,
103
108
  "metricName": metric_name,
104
109
  "pointsSystemKey": points_system_key,
@@ -130,6 +135,7 @@ module TrophyApiClient
130
135
  name = parsed_json["name"]
131
136
  key = parsed_json["key"]
132
137
  rank_by = parsed_json["rankBy"]
138
+ breakdown_attribute = parsed_json["breakdownAttribute"]
133
139
  metric_key = parsed_json["metricKey"]
134
140
  metric_name = parsed_json["metricName"]
135
141
  points_system_key = parsed_json["pointsSystemKey"]
@@ -147,6 +153,7 @@ module TrophyApiClient
147
153
  name: name,
148
154
  key: key,
149
155
  rank_by: rank_by,
156
+ breakdown_attribute: breakdown_attribute,
150
157
  metric_key: metric_key,
151
158
  metric_name: metric_name,
152
159
  points_system_key: points_system_key,
@@ -181,6 +188,7 @@ module TrophyApiClient
181
188
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
182
189
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
183
190
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
191
+ obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
184
192
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
185
193
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
186
194
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -19,6 +19,9 @@ module TrophyApiClient
19
19
  # @return [Integer] The minimum value required to enter the leaderboard according to its current
20
20
  # rankings.
21
21
  attr_reader :threshold
22
+ # @return [String] For leaderboards with a breakdown attribute, the value of the attribute for the
23
+ # user.
24
+ attr_reader :breakdown_attribute_value
22
25
  # @return [String] The unique ID of the leaderboard.
23
26
  attr_reader :id
24
27
  # @return [String] The user-facing name of the leaderboard.
@@ -27,6 +30,8 @@ module TrophyApiClient
27
30
  attr_reader :key
28
31
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
29
32
  attr_reader :rank_by
33
+ # @return [String] The key of the attribute to break down this leaderboard by.
34
+ attr_reader :breakdown_attribute
30
35
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
31
36
  attr_reader :metric_key
32
37
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -63,10 +68,13 @@ module TrophyApiClient
63
68
  # on the leaderboard before the event.
64
69
  # @param threshold [Integer] The minimum value required to enter the leaderboard according to its current
65
70
  # rankings.
71
+ # @param breakdown_attribute_value [String] For leaderboards with a breakdown attribute, the value of the attribute for the
72
+ # user.
66
73
  # @param id [String] The unique ID of the leaderboard.
67
74
  # @param name [String] The user-facing name of the leaderboard.
68
75
  # @param key [String] The unique key used to reference the leaderboard in APIs.
69
76
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
77
+ # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
70
78
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
71
79
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
72
80
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -80,16 +88,18 @@ module TrophyApiClient
80
88
  # type.
81
89
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
82
90
  # @return [TrophyApiClient::MetricEventLeaderboardResponse]
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)
91
+ def initialize(threshold:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:,
92
+ end_: OMIT, rank: OMIT, previous_rank: OMIT, breakdown_attribute_value: OMIT, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, run_unit: OMIT, additional_properties: nil)
85
93
  @end_ = end_ if end_ != OMIT
86
94
  @rank = rank if rank != OMIT
87
95
  @previous_rank = previous_rank if previous_rank != OMIT
88
96
  @threshold = threshold
97
+ @breakdown_attribute_value = breakdown_attribute_value if breakdown_attribute_value != OMIT
89
98
  @id = id
90
99
  @name = name
91
100
  @key = key
92
101
  @rank_by = rank_by
102
+ @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
93
103
  @metric_key = metric_key if metric_key != OMIT
94
104
  @metric_name = metric_name if metric_name != OMIT
95
105
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -105,10 +115,12 @@ module TrophyApiClient
105
115
  "rank": rank,
106
116
  "previousRank": previous_rank,
107
117
  "threshold": threshold,
118
+ "breakdownAttributeValue": breakdown_attribute_value,
108
119
  "id": id,
109
120
  "name": name,
110
121
  "key": key,
111
122
  "rankBy": rank_by,
123
+ "breakdownAttribute": breakdown_attribute,
112
124
  "metricKey": metric_key,
113
125
  "metricName": metric_name,
114
126
  "pointsSystemKey": points_system_key,
@@ -134,10 +146,12 @@ module TrophyApiClient
134
146
  rank = parsed_json["rank"]
135
147
  previous_rank = parsed_json["previousRank"]
136
148
  threshold = parsed_json["threshold"]
149
+ breakdown_attribute_value = parsed_json["breakdownAttributeValue"]
137
150
  id = parsed_json["id"]
138
151
  name = parsed_json["name"]
139
152
  key = parsed_json["key"]
140
153
  rank_by = parsed_json["rankBy"]
154
+ breakdown_attribute = parsed_json["breakdownAttribute"]
141
155
  metric_key = parsed_json["metricKey"]
142
156
  metric_name = parsed_json["metricName"]
143
157
  points_system_key = parsed_json["pointsSystemKey"]
@@ -152,10 +166,12 @@ module TrophyApiClient
152
166
  rank: rank,
153
167
  previous_rank: previous_rank,
154
168
  threshold: threshold,
169
+ breakdown_attribute_value: breakdown_attribute_value,
155
170
  id: id,
156
171
  name: name,
157
172
  key: key,
158
173
  rank_by: rank_by,
174
+ breakdown_attribute: breakdown_attribute,
159
175
  metric_key: metric_key,
160
176
  metric_name: metric_name,
161
177
  points_system_key: points_system_key,
@@ -187,10 +203,12 @@ module TrophyApiClient
187
203
  obj.rank&.is_a?(Integer) != false || raise("Passed value for field obj.rank is not the expected type, validation failed.")
188
204
  obj.previous_rank&.is_a?(Integer) != false || raise("Passed value for field obj.previous_rank is not the expected type, validation failed.")
189
205
  obj.threshold.is_a?(Integer) != false || raise("Passed value for field obj.threshold is not the expected type, validation failed.")
206
+ obj.breakdown_attribute_value&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute_value is not the expected type, validation failed.")
190
207
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
191
208
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
192
209
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
193
210
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
211
+ obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
194
212
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
195
213
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
196
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.")
@@ -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:, name:, device_tokens:, subscribe_to_emails:, attributes:, tz: OMIT,
41
+ def initialize(email: OMIT, name: OMIT, tz: OMIT, device_tokens: OMIT, subscribe_to_emails: OMIT, attributes: OMIT,
42
42
  additional_properties: nil)
43
- @email = email
44
- @name = name
43
+ @email = email if email != OMIT
44
+ @name = name if name != OMIT
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 if device_tokens != OMIT
47
+ @subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
48
+ @attributes = attributes if attributes != OMIT
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.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.")
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.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.")
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:, name:, device_tokens:, subscribe_to_emails:, attributes:, tz: OMIT,
45
- additional_properties: nil)
44
+ def initialize(id:, email: OMIT, name: OMIT, tz: OMIT, device_tokens: OMIT, subscribe_to_emails: OMIT,
45
+ attributes: OMIT, additional_properties: nil)
46
46
  @id = id
47
- @email = email
48
- @name = name
47
+ @email = email if email != OMIT
48
+ @name = name if name != OMIT
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 if device_tokens != OMIT
51
+ @subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
52
+ @attributes = attributes if attributes != OMIT
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.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.")
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.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.")
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
@@ -7,29 +7,28 @@ require "json"
7
7
  module TrophyApiClient
8
8
  # A user of your application.
9
9
  class User
10
- # @return [Boolean] Whether the user is in the control group, meaning they do not receive emails or
11
- # other communications from Trophy.
12
- attr_reader :control
13
- # @return [DateTime] The date and time the user was created, in ISO 8601 format.
14
- attr_reader :created
15
- # @return [DateTime] The date and time the user was last updated, in ISO 8601 format.
16
- attr_reader :updated
17
10
  # @return [String] The ID of the user in your database. Must be a string.
18
11
  attr_reader :id
19
- # @return [String] The user's email address. Required if subscribeToEmails is true.
12
+ # @return [String] The user's email address.
20
13
  attr_reader :email
21
- # @return [String] The name to refer to the user by in emails.
14
+ # @return [String] The name of the user.
22
15
  attr_reader :name
23
- # @return [String] The user's timezone (used for email scheduling).
16
+ # @return [String] The user's timezone.
24
17
  attr_reader :tz
25
- # @return [Array<String>] The user's device tokens, used for push notifications.
18
+ # @return [Array<String>] The user's device tokens.
26
19
  attr_reader :device_tokens
27
- # @return [Boolean] Whether the user should receive Trophy-powered emails. If false, Trophy will not
28
- # store the user's email address.
20
+ # @return [Boolean] Whether the user is opted into receiving Trophy-powered emails.
29
21
  attr_reader :subscribe_to_emails
30
22
  # @return [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
31
23
  # up in the Trophy dashboard.
32
24
  attr_reader :attributes
25
+ # @return [Boolean] Whether the user is in the control group, meaning they do not receive emails or
26
+ # other communications from Trophy.
27
+ attr_reader :control
28
+ # @return [DateTime] The date and time the user was created, in ISO 8601 format.
29
+ attr_reader :created
30
+ # @return [DateTime] The date and time the user was last updated, in ISO 8601 format.
31
+ attr_reader :updated
33
32
  # @return [OpenStruct] Additional properties unmapped to the current class definition
34
33
  attr_reader :additional_properties
35
34
  # @return [Object]
@@ -38,45 +37,44 @@ module TrophyApiClient
38
37
 
39
38
  OMIT = Object.new
40
39
 
40
+ # @param id [String] The ID of the user in your database. Must be a string.
41
+ # @param email [String] The user's email address.
42
+ # @param name [String] The name of the user.
43
+ # @param tz [String] The user's timezone.
44
+ # @param device_tokens [Array<String>] The user's device tokens.
45
+ # @param subscribe_to_emails [Boolean] Whether the user is opted into receiving Trophy-powered emails.
46
+ # @param attributes [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
47
+ # up in the Trophy dashboard.
41
48
  # @param control [Boolean] Whether the user is in the control group, meaning they do not receive emails or
42
49
  # other communications from Trophy.
43
50
  # @param created [DateTime] The date and time the user was created, in ISO 8601 format.
44
51
  # @param updated [DateTime] The date and time the user was last updated, in ISO 8601 format.
45
- # @param id [String] The ID of the user in your database. Must be a string.
46
- # @param email [String] The user's email address. Required if subscribeToEmails is true.
47
- # @param name [String] The name to refer to the user by in emails.
48
- # @param tz [String] The user's timezone (used for email scheduling).
49
- # @param device_tokens [Array<String>] The user's device tokens, used for push notifications.
50
- # @param subscribe_to_emails [Boolean] Whether the user should receive Trophy-powered emails. If false, Trophy will not
51
- # store the user's email address.
52
- # @param attributes [Hash{String => String}] User attributes as key-value pairs. Keys must match existing user attributes set
53
- # up in the Trophy dashboard.
54
52
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
55
53
  # @return [TrophyApiClient::User]
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
54
+ def initialize(id:, device_tokens:, subscribe_to_emails:, attributes:, control:, created:, updated:, email: OMIT,
55
+ name: OMIT, tz: OMIT, additional_properties: nil)
61
56
  @id = id
62
- @email = email
63
- @name = name
57
+ @email = email if email != OMIT
58
+ @name = name if name != OMIT
64
59
  @tz = tz if tz != OMIT
65
60
  @device_tokens = device_tokens
66
61
  @subscribe_to_emails = subscribe_to_emails
67
62
  @attributes = attributes
63
+ @control = control
64
+ @created = created
65
+ @updated = updated
68
66
  @additional_properties = additional_properties
69
67
  @_field_set = {
70
- "control": control,
71
- "created": created,
72
- "updated": updated,
73
68
  "id": id,
74
69
  "email": email,
75
70
  "name": name,
76
71
  "tz": tz,
77
72
  "deviceTokens": device_tokens,
78
73
  "subscribeToEmails": subscribe_to_emails,
79
- "attributes": attributes
74
+ "attributes": attributes,
75
+ "control": control,
76
+ "created": created,
77
+ "updated": updated
80
78
  }.reject do |_k, v|
81
79
  v == OMIT
82
80
  end
@@ -89,9 +87,6 @@ module TrophyApiClient
89
87
  def self.from_json(json_object:)
90
88
  struct = JSON.parse(json_object, object_class: OpenStruct)
91
89
  parsed_json = JSON.parse(json_object)
92
- control = parsed_json["control"]
93
- created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
94
- updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
95
90
  id = parsed_json["id"]
96
91
  email = parsed_json["email"]
97
92
  name = parsed_json["name"]
@@ -99,10 +94,10 @@ module TrophyApiClient
99
94
  device_tokens = parsed_json["deviceTokens"]
100
95
  subscribe_to_emails = parsed_json["subscribeToEmails"]
101
96
  attributes = parsed_json["attributes"]
97
+ control = parsed_json["control"]
98
+ created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
99
+ updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
102
100
  new(
103
- control: control,
104
- created: created,
105
- updated: updated,
106
101
  id: id,
107
102
  email: email,
108
103
  name: name,
@@ -110,6 +105,9 @@ module TrophyApiClient
110
105
  device_tokens: device_tokens,
111
106
  subscribe_to_emails: subscribe_to_emails,
112
107
  attributes: attributes,
108
+ control: control,
109
+ created: created,
110
+ updated: updated,
113
111
  additional_properties: struct
114
112
  )
115
113
  end
@@ -128,16 +126,16 @@ module TrophyApiClient
128
126
  # @param obj [Object]
129
127
  # @return [Void]
130
128
  def self.validate_raw(obj:)
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
129
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
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.")
130
+ obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
131
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
137
132
  obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
138
133
  obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
139
134
  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
135
  obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
136
+ obj.control.is_a?(Boolean) != false || raise("Passed value for field obj.control is not the expected type, validation failed.")
137
+ obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
138
+ obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
141
139
  end
142
140
  end
143
141
  end
@@ -22,6 +22,8 @@ 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.
26
+ attr_reader :breakdown_attribute
25
27
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
26
28
  attr_reader :metric_key
27
29
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -61,6 +63,7 @@ module TrophyApiClient
61
63
  # @param name [String] The user-facing name of the leaderboard.
62
64
  # @param key [String] The unique key used to reference the leaderboard in APIs.
63
65
  # @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.
64
67
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
65
68
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
66
69
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -76,14 +79,15 @@ module TrophyApiClient
76
79
  # type.
77
80
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
78
81
  # @return [TrophyApiClient::UserLeaderboardResponse]
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)
82
+ def initialize(id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, rank: OMIT, value: OMIT, breakdown_attribute: OMIT, metric_key: OMIT,
83
+ metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
81
84
  @rank = rank if rank != OMIT
82
85
  @value = value if value != OMIT
83
86
  @id = id
84
87
  @name = name
85
88
  @key = key
86
89
  @rank_by = rank_by
90
+ @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
87
91
  @metric_key = metric_key if metric_key != OMIT
88
92
  @metric_name = metric_name if metric_name != OMIT
89
93
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -102,6 +106,7 @@ module TrophyApiClient
102
106
  "name": name,
103
107
  "key": key,
104
108
  "rankBy": rank_by,
109
+ "breakdownAttribute": breakdown_attribute,
105
110
  "metricKey": metric_key,
106
111
  "metricName": metric_name,
107
112
  "pointsSystemKey": points_system_key,
@@ -130,6 +135,7 @@ module TrophyApiClient
130
135
  name = parsed_json["name"]
131
136
  key = parsed_json["key"]
132
137
  rank_by = parsed_json["rankBy"]
138
+ breakdown_attribute = parsed_json["breakdownAttribute"]
133
139
  metric_key = parsed_json["metricKey"]
134
140
  metric_name = parsed_json["metricName"]
135
141
  points_system_key = parsed_json["pointsSystemKey"]
@@ -147,6 +153,7 @@ module TrophyApiClient
147
153
  name: name,
148
154
  key: key,
149
155
  rank_by: rank_by,
156
+ breakdown_attribute: breakdown_attribute,
150
157
  metric_key: metric_key,
151
158
  metric_name: metric_name,
152
159
  points_system_key: points_system_key,
@@ -181,6 +188,7 @@ module TrophyApiClient
181
188
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
182
189
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
183
190
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
191
+ obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
184
192
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
185
193
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
186
194
  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,6 +25,8 @@ 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.
29
+ attr_reader :breakdown_attribute
28
30
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
29
31
  attr_reader :metric_key
30
32
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -65,6 +67,7 @@ module TrophyApiClient
65
67
  # @param name [String] The user-facing name of the leaderboard.
66
68
  # @param key [String] The unique key used to reference the leaderboard in APIs.
67
69
  # @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.
68
71
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
69
72
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
70
73
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -80,8 +83,8 @@ module TrophyApiClient
80
83
  # type.
81
84
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
82
85
  # @return [TrophyApiClient::UserLeaderboardResponseWithHistory]
83
- def initialize(history:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, rank: OMIT, value: OMIT, metric_key: OMIT, metric_name: OMIT,
84
- points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
86
+ def initialize(history:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, rank: OMIT, value: OMIT, breakdown_attribute: OMIT,
87
+ metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
85
88
  @history = history
86
89
  @rank = rank if rank != OMIT
87
90
  @value = value if value != OMIT
@@ -89,6 +92,7 @@ module TrophyApiClient
89
92
  @name = name
90
93
  @key = key
91
94
  @rank_by = rank_by
95
+ @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
92
96
  @metric_key = metric_key if metric_key != OMIT
93
97
  @metric_name = metric_name if metric_name != OMIT
94
98
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -108,6 +112,7 @@ module TrophyApiClient
108
112
  "name": name,
109
113
  "key": key,
110
114
  "rankBy": rank_by,
115
+ "breakdownAttribute": breakdown_attribute,
111
116
  "metricKey": metric_key,
112
117
  "metricName": metric_name,
113
118
  "pointsSystemKey": points_system_key,
@@ -140,6 +145,7 @@ module TrophyApiClient
140
145
  name = parsed_json["name"]
141
146
  key = parsed_json["key"]
142
147
  rank_by = parsed_json["rankBy"]
148
+ breakdown_attribute = parsed_json["breakdownAttribute"]
143
149
  metric_key = parsed_json["metricKey"]
144
150
  metric_name = parsed_json["metricName"]
145
151
  points_system_key = parsed_json["pointsSystemKey"]
@@ -158,6 +164,7 @@ module TrophyApiClient
158
164
  name: name,
159
165
  key: key,
160
166
  rank_by: rank_by,
167
+ breakdown_attribute: breakdown_attribute,
161
168
  metric_key: metric_key,
162
169
  metric_name: metric_name,
163
170
  points_system_key: points_system_key,
@@ -193,6 +200,7 @@ module TrophyApiClient
193
200
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
194
201
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
195
202
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
203
+ obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
196
204
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
197
205
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
198
206
  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,6 +26,8 @@ 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.
30
+ attr_reader :breakdown_attribute
29
31
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
30
32
  attr_reader :metric_key
31
33
  # @return [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -67,6 +69,7 @@ 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.
72
+ # @param breakdown_attribute [String] The key of the attribute to break down this leaderboard by.
70
73
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
71
74
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
72
75
  # @param points_system_key [String] The key of the points system to rank by, if rankBy is 'points'.
@@ -83,7 +86,7 @@ module TrophyApiClient
83
86
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
84
87
  # @return [TrophyApiClient::WebhookUserLeaderboardResponse]
85
88
  def initialize(id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, previous_rank: OMIT, previous_value: OMIT, rank: OMIT, value: OMIT,
86
- metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
89
+ breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, end_: OMIT, run_unit: OMIT, additional_properties: nil)
87
90
  @previous_rank = previous_rank if previous_rank != OMIT
88
91
  @previous_value = previous_value if previous_value != OMIT
89
92
  @rank = rank if rank != OMIT
@@ -92,6 +95,7 @@ module TrophyApiClient
92
95
  @name = name
93
96
  @key = key
94
97
  @rank_by = rank_by
98
+ @breakdown_attribute = breakdown_attribute if breakdown_attribute != OMIT
95
99
  @metric_key = metric_key if metric_key != OMIT
96
100
  @metric_name = metric_name if metric_name != OMIT
97
101
  @points_system_key = points_system_key if points_system_key != OMIT
@@ -112,6 +116,7 @@ module TrophyApiClient
112
116
  "name": name,
113
117
  "key": key,
114
118
  "rankBy": rank_by,
119
+ "breakdownAttribute": breakdown_attribute,
115
120
  "metricKey": metric_key,
116
121
  "metricName": metric_name,
117
122
  "pointsSystemKey": points_system_key,
@@ -142,6 +147,7 @@ module TrophyApiClient
142
147
  name = parsed_json["name"]
143
148
  key = parsed_json["key"]
144
149
  rank_by = parsed_json["rankBy"]
150
+ breakdown_attribute = parsed_json["breakdownAttribute"]
145
151
  metric_key = parsed_json["metricKey"]
146
152
  metric_name = parsed_json["metricName"]
147
153
  points_system_key = parsed_json["pointsSystemKey"]
@@ -161,6 +167,7 @@ module TrophyApiClient
161
167
  name: name,
162
168
  key: key,
163
169
  rank_by: rank_by,
170
+ breakdown_attribute: breakdown_attribute,
164
171
  metric_key: metric_key,
165
172
  metric_name: metric_name,
166
173
  points_system_key: points_system_key,
@@ -197,6 +204,7 @@ module TrophyApiClient
197
204
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
198
205
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
199
206
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
207
+ obj.breakdown_attribute&.is_a?(String) != false || raise("Passed value for field obj.breakdown_attribute is not the expected type, validation failed.")
200
208
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
201
209
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
202
210
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
@@ -45,7 +45,7 @@ module TrophyApiClient
45
45
  # environment: TrophyApiClient::Environment::PRODUCTION,
46
46
  # api_key: "YOUR_API_KEY"
47
47
  # )
48
- # api.users.create(request: { email: "user@example.com", name: "User", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" }, id: "user-id" })
48
+ # api.users.create(request: { id: "user-id" })
49
49
  def create(request:, request_options: nil)
50
50
  response = @request_client.conn.post do |req|
51
51
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -114,7 +114,7 @@ module TrophyApiClient
114
114
  # environment: TrophyApiClient::Environment::PRODUCTION,
115
115
  # api_key: "YOUR_API_KEY"
116
116
  # )
117
- # api.users.identify(id: "id", request: { email: "user@example.com", name: "User", tz: "Europe/London", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" } })
117
+ # api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
118
118
  def identify(id:, request:, request_options: nil)
119
119
  response = @request_client.conn.put do |req|
120
120
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -151,7 +151,7 @@ module TrophyApiClient
151
151
  # environment: TrophyApiClient::Environment::PRODUCTION,
152
152
  # api_key: "YOUR_API_KEY"
153
153
  # )
154
- # api.users.update(id: "id", request: { email: "user@example.com", name: "User", tz: "Europe/London", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" } })
154
+ # api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
155
155
  def update(id:, request:, request_options: nil)
156
156
  response = @request_client.conn.patch do |req|
157
157
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -525,7 +525,7 @@ module TrophyApiClient
525
525
  # environment: TrophyApiClient::Environment::PRODUCTION,
526
526
  # api_key: "YOUR_API_KEY"
527
527
  # )
528
- # api.users.create(request: { email: "user@example.com", name: "User", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" }, id: "user-id" })
528
+ # api.users.create(request: { id: "user-id" })
529
529
  def create(request:, request_options: nil)
530
530
  Async do
531
531
  response = @request_client.conn.post do |req|
@@ -598,7 +598,7 @@ module TrophyApiClient
598
598
  # environment: TrophyApiClient::Environment::PRODUCTION,
599
599
  # api_key: "YOUR_API_KEY"
600
600
  # )
601
- # api.users.identify(id: "id", request: { email: "user@example.com", name: "User", tz: "Europe/London", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" } })
601
+ # api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
602
602
  def identify(id:, request:, request_options: nil)
603
603
  Async do
604
604
  response = @request_client.conn.put do |req|
@@ -637,7 +637,7 @@ module TrophyApiClient
637
637
  # environment: TrophyApiClient::Environment::PRODUCTION,
638
638
  # api_key: "YOUR_API_KEY"
639
639
  # )
640
- # api.users.update(id: "id", request: { email: "user@example.com", name: "User", tz: "Europe/London", device_tokens: ["token1", "token2"], subscribe_to_emails: true, attributes: { "department": "engineering", "role": "developer" } })
640
+ # api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
641
641
  def update(id:, request:, request_options: nil)
642
642
  Async do
643
643
  response = @request_client.conn.patch do |req|
@@ -1,3 +1,3 @@
1
1
  module MyGem
2
- VERSION = "1.0.30"
2
+ VERSION = "1.0.32"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trophy_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.30
4
+ version: 1.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trophy Labs, Inc