trophy_api_client 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/leaderboards/client.rb +0 -77
- data/lib/trophy_api_client/users/client.rb +77 -0
- data/lib/trophy_api_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a95dbb430879c95ed350b8de2a77e74d126450896fcbb309ab33d1007c6a536
|
4
|
+
data.tar.gz: df4e465c4a22865fdb41228ab10c29ade0d17b394b14aa16c1337e8114a44898
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c29eb2612f426a3a4c5e8b071fd707043f336d5632228648e58f55ba7cf6aa2eaa5e0d912023bbe2500308282b6552ad47d5dd895af166ba69b8e857a24ebe43
|
7
|
+
data.tar.gz: a105c7f1fb858c9b3442acefd55a9d9a6e03dd7304b8a10f76453e8765883ea1a7e34da6dc57f815cd99cac20bf9e41965be210a9f4e4cc8b1efd9b595beb6b8
|
data/lib/gemconfig.rb
CHANGED
@@ -4,7 +4,6 @@ require_relative "../../requests"
|
|
4
4
|
require_relative "../types/leaderboard_response"
|
5
5
|
require "json"
|
6
6
|
require_relative "../types/leaderboard_response_with_rankings"
|
7
|
-
require_relative "../types/user_leaderboard_response"
|
8
7
|
require "async"
|
9
8
|
|
10
9
|
module TrophyApiClient
|
@@ -98,43 +97,6 @@ module TrophyApiClient
|
|
98
97
|
end
|
99
98
|
TrophyApiClient::LeaderboardResponseWithRankings.from_json(json_object: response.body)
|
100
99
|
end
|
101
|
-
|
102
|
-
# Get a user's rank, value, and history for a specific leaderboard.
|
103
|
-
#
|
104
|
-
# @param user_id [String] The user's ID in your database.
|
105
|
-
# @param key [String] Unique key of the leaderboard as set when created.
|
106
|
-
# @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
|
107
|
-
# run.
|
108
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
109
|
-
# @return [TrophyApiClient::UserLeaderboardResponse]
|
110
|
-
# @example
|
111
|
-
# api = TrophyApiClient::Client.new(
|
112
|
-
# base_url: "https://api.example.com",
|
113
|
-
# environment: TrophyApiClient::Environment::DEFAULT,
|
114
|
-
# api_key: "YOUR_API_KEY"
|
115
|
-
# )
|
116
|
-
# api.leaderboards.users_leaderboards(
|
117
|
-
# user_id: "user-123",
|
118
|
-
# key: "weekly-words",
|
119
|
-
# run: "2025-01-15"
|
120
|
-
# )
|
121
|
-
def users_leaderboards(user_id:, key:, run: nil, request_options: nil)
|
122
|
-
response = @request_client.conn.get do |req|
|
123
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
124
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
125
|
-
req.headers = {
|
126
|
-
**(req.headers || {}),
|
127
|
-
**@request_client.get_headers,
|
128
|
-
**(request_options&.additional_headers || {})
|
129
|
-
}.compact
|
130
|
-
req.params = { **(request_options&.additional_query_parameters || {}), "run": run }.compact
|
131
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
132
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
133
|
-
end
|
134
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{user_id}/leaderboards/#{key}"
|
135
|
-
end
|
136
|
-
TrophyApiClient::UserLeaderboardResponse.from_json(json_object: response.body)
|
137
|
-
end
|
138
100
|
end
|
139
101
|
|
140
102
|
class AsyncLeaderboardsClient
|
@@ -231,44 +193,5 @@ module TrophyApiClient
|
|
231
193
|
TrophyApiClient::LeaderboardResponseWithRankings.from_json(json_object: response.body)
|
232
194
|
end
|
233
195
|
end
|
234
|
-
|
235
|
-
# Get a user's rank, value, and history for a specific leaderboard.
|
236
|
-
#
|
237
|
-
# @param user_id [String] The user's ID in your database.
|
238
|
-
# @param key [String] Unique key of the leaderboard as set when created.
|
239
|
-
# @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
|
240
|
-
# run.
|
241
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
242
|
-
# @return [TrophyApiClient::UserLeaderboardResponse]
|
243
|
-
# @example
|
244
|
-
# api = TrophyApiClient::Client.new(
|
245
|
-
# base_url: "https://api.example.com",
|
246
|
-
# environment: TrophyApiClient::Environment::DEFAULT,
|
247
|
-
# api_key: "YOUR_API_KEY"
|
248
|
-
# )
|
249
|
-
# api.leaderboards.users_leaderboards(
|
250
|
-
# user_id: "user-123",
|
251
|
-
# key: "weekly-words",
|
252
|
-
# run: "2025-01-15"
|
253
|
-
# )
|
254
|
-
def users_leaderboards(user_id:, key:, run: nil, request_options: nil)
|
255
|
-
Async do
|
256
|
-
response = @request_client.conn.get do |req|
|
257
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
258
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
259
|
-
req.headers = {
|
260
|
-
**(req.headers || {}),
|
261
|
-
**@request_client.get_headers,
|
262
|
-
**(request_options&.additional_headers || {})
|
263
|
-
}.compact
|
264
|
-
req.params = { **(request_options&.additional_query_parameters || {}), "run": run }.compact
|
265
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
266
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
267
|
-
end
|
268
|
-
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{user_id}/leaderboards/#{key}"
|
269
|
-
end
|
270
|
-
TrophyApiClient::UserLeaderboardResponse.from_json(json_object: response.body)
|
271
|
-
end
|
272
|
-
end
|
273
196
|
end
|
274
197
|
end
|
@@ -13,6 +13,7 @@ require_relative "../types/streak_response"
|
|
13
13
|
require_relative "../types/get_user_points_response"
|
14
14
|
require_relative "types/users_points_event_summary_request_aggregation"
|
15
15
|
require_relative "types/users_points_event_summary_response_item"
|
16
|
+
require_relative "../types/user_leaderboard_response"
|
16
17
|
require "async"
|
17
18
|
|
18
19
|
module TrophyApiClient
|
@@ -447,6 +448,43 @@ module TrophyApiClient
|
|
447
448
|
TrophyApiClient::Users::UsersPointsEventSummaryResponseItem.from_json(json_object: item)
|
448
449
|
end
|
449
450
|
end
|
451
|
+
|
452
|
+
# Get a user's rank, value, and history for a specific leaderboard.
|
453
|
+
#
|
454
|
+
# @param id [String] The user's ID in your database.
|
455
|
+
# @param key [String] Unique key of the leaderboard as set when created.
|
456
|
+
# @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
|
457
|
+
# run.
|
458
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
459
|
+
# @return [TrophyApiClient::UserLeaderboardResponse]
|
460
|
+
# @example
|
461
|
+
# api = TrophyApiClient::Client.new(
|
462
|
+
# base_url: "https://api.example.com",
|
463
|
+
# environment: TrophyApiClient::Environment::DEFAULT,
|
464
|
+
# api_key: "YOUR_API_KEY"
|
465
|
+
# )
|
466
|
+
# api.users.leaderboard(
|
467
|
+
# id: "user-123",
|
468
|
+
# key: "weekly-words",
|
469
|
+
# run: "2025-01-15"
|
470
|
+
# )
|
471
|
+
def leaderboard(id:, key:, run: nil, request_options: nil)
|
472
|
+
response = @request_client.conn.get do |req|
|
473
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
474
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
475
|
+
req.headers = {
|
476
|
+
**(req.headers || {}),
|
477
|
+
**@request_client.get_headers,
|
478
|
+
**(request_options&.additional_headers || {})
|
479
|
+
}.compact
|
480
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "run": run }.compact
|
481
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
482
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
483
|
+
end
|
484
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/leaderboards/#{key}"
|
485
|
+
end
|
486
|
+
TrophyApiClient::UserLeaderboardResponse.from_json(json_object: response.body)
|
487
|
+
end
|
450
488
|
end
|
451
489
|
|
452
490
|
class AsyncUsersClient
|
@@ -902,5 +940,44 @@ module TrophyApiClient
|
|
902
940
|
end
|
903
941
|
end
|
904
942
|
end
|
943
|
+
|
944
|
+
# Get a user's rank, value, and history for a specific leaderboard.
|
945
|
+
#
|
946
|
+
# @param id [String] The user's ID in your database.
|
947
|
+
# @param key [String] Unique key of the leaderboard as set when created.
|
948
|
+
# @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
|
949
|
+
# run.
|
950
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
951
|
+
# @return [TrophyApiClient::UserLeaderboardResponse]
|
952
|
+
# @example
|
953
|
+
# api = TrophyApiClient::Client.new(
|
954
|
+
# base_url: "https://api.example.com",
|
955
|
+
# environment: TrophyApiClient::Environment::DEFAULT,
|
956
|
+
# api_key: "YOUR_API_KEY"
|
957
|
+
# )
|
958
|
+
# api.users.leaderboard(
|
959
|
+
# id: "user-123",
|
960
|
+
# key: "weekly-words",
|
961
|
+
# run: "2025-01-15"
|
962
|
+
# )
|
963
|
+
def leaderboard(id:, key:, run: nil, request_options: nil)
|
964
|
+
Async do
|
965
|
+
response = @request_client.conn.get do |req|
|
966
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
967
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
968
|
+
req.headers = {
|
969
|
+
**(req.headers || {}),
|
970
|
+
**@request_client.get_headers,
|
971
|
+
**(request_options&.additional_headers || {})
|
972
|
+
}.compact
|
973
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "run": run }.compact
|
974
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
975
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
976
|
+
end
|
977
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/users/#{id}/leaderboards/#{key}"
|
978
|
+
end
|
979
|
+
TrophyApiClient::UserLeaderboardResponse.from_json(json_object: response.body)
|
980
|
+
end
|
981
|
+
end
|
905
982
|
end
|
906
983
|
end
|