trophy_api_client 1.5.0 → 1.7.0
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/admin/attributes/client.rb +368 -0
- data/lib/trophy_api_client/admin/client.rb +21 -0
- data/lib/trophy_api_client/admin/leaderboards/client.rb +371 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +366 -0
- data/lib/trophy_api_client/types/admin_attribute.rb +81 -0
- data/lib/trophy_api_client/types/admin_attribute_type.rb +9 -0
- data/lib/trophy_api_client/types/admin_leaderboard.rb +171 -0
- data/lib/trophy_api_client/types/admin_leaderboard_rank_by.rb +10 -0
- data/lib/trophy_api_client/types/admin_leaderboard_run_unit.rb +10 -0
- data/lib/trophy_api_client/types/admin_leaderboard_status.rb +11 -0
- data/lib/trophy_api_client/types/create_attribute_request_item.rb +76 -0
- data/lib/trophy_api_client/types/create_attribute_request_item_type.rb +9 -0
- data/lib/trophy_api_client/types/create_attributes_request.rb +7 -0
- data/lib/trophy_api_client/types/create_attributes_response.rb +74 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item.rb +171 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_rank_by.rb +10 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_run_unit.rb +11 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_status.rb +13 -0
- data/lib/trophy_api_client/types/create_leaderboards_request.rb +7 -0
- data/lib/trophy_api_client/types/create_leaderboards_response.rb +74 -0
- data/lib/trophy_api_client/types/create_metric_request_item.rb +87 -0
- data/lib/trophy_api_client/types/create_metric_request_item_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/create_metrics_request.rb +7 -0
- data/lib/trophy_api_client/types/create_metrics_response.rb +74 -0
- data/lib/trophy_api_client/types/created_metric.rb +88 -0
- data/lib/trophy_api_client/types/created_metric_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/delete_attributes_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_metrics_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_points_boosts_response.rb +2 -2
- data/lib/trophy_api_client/types/list_attributes_response.rb +7 -0
- data/lib/trophy_api_client/types/list_leaderboards_response.rb +7 -0
- data/lib/trophy_api_client/types/list_metrics_response.rb +7 -0
- data/lib/trophy_api_client/types/metric_response.rb +2 -17
- data/lib/trophy_api_client/types/update_attribute_request_item.rb +69 -0
- data/lib/trophy_api_client/types/update_attributes_request.rb +7 -0
- data/lib/trophy_api_client/types/update_attributes_response.rb +75 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item.rb +179 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_rank_by.rb +11 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_run_unit.rb +9 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_status.rb +12 -0
- data/lib/trophy_api_client/types/update_leaderboards_request.rb +7 -0
- data/lib/trophy_api_client/types/update_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/update_metric_request_item.rb +86 -0
- data/lib/trophy_api_client/types/update_metric_request_item_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/update_metrics_request.rb +7 -0
- data/lib/trophy_api_client/types/update_metrics_response.rb +75 -0
- data/lib/trophy_api_client/users/client.rb +2 -2
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +51 -12
- metadata +45 -3
- data/lib/trophy_api_client/types/metric_status.rb +0 -9
- data/lib/trophy_api_client/types/notification_type.rb +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bca4f0a4b33b4764665874e1091b268c9a30d496bc684bbe5d0a6278e4c94c32
|
|
4
|
+
data.tar.gz: b7ed5377499eced710ba24c76946f5c4502ca4973a3dba684c369dc0a92479ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f72261a738ecae4692446dc9dbe37fa205dc3ce177fcabd9847dc1f6af1613d7c19cf5be5d99b3cd24b0558450f06098e39fa6415f15046785a6226f2590f0bb
|
|
7
|
+
data.tar.gz: d8feb721e3fa1b4ee49635d3d7f330cc93f3fdf8692792d947eb3dd0131cf8876985d84b01d17da5e050d773f6224ef4310786e55533e17480cc0fb8affa8718
|
data/lib/gemconfig.rb
CHANGED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../../../requests"
|
|
4
|
+
require_relative "../../types/list_attributes_response"
|
|
5
|
+
require "json"
|
|
6
|
+
require_relative "../../types/create_attributes_request"
|
|
7
|
+
require_relative "../../types/create_attributes_response"
|
|
8
|
+
require_relative "../../types/delete_attributes_response"
|
|
9
|
+
require_relative "../../types/update_attributes_request"
|
|
10
|
+
require_relative "../../types/update_attributes_response"
|
|
11
|
+
require_relative "../../types/admin_attribute"
|
|
12
|
+
require "async"
|
|
13
|
+
|
|
14
|
+
module TrophyApiClient
|
|
15
|
+
module Admin
|
|
16
|
+
class AttributesClient
|
|
17
|
+
# @return [TrophyApiClient::RequestClient]
|
|
18
|
+
attr_reader :request_client
|
|
19
|
+
|
|
20
|
+
# @param request_client [TrophyApiClient::RequestClient]
|
|
21
|
+
# @return [TrophyApiClient::Admin::AttributesClient]
|
|
22
|
+
def initialize(request_client:)
|
|
23
|
+
@request_client = request_client
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# List attributes.
|
|
27
|
+
#
|
|
28
|
+
# @param limit [Integer] Number of records to return.
|
|
29
|
+
# @param skip [Integer] Number of records to skip from the start of the list.
|
|
30
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
31
|
+
# @return [TrophyApiClient::LIST_ATTRIBUTES_RESPONSE]
|
|
32
|
+
# @example
|
|
33
|
+
# api = TrophyApiClient::Client.new(
|
|
34
|
+
# base_url: "https://api.example.com",
|
|
35
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
36
|
+
# api_key: "YOUR_API_KEY"
|
|
37
|
+
# )
|
|
38
|
+
# api.admin.attributes.list(limit: 1, skip: 1)
|
|
39
|
+
def list(limit: nil, skip: nil, request_options: nil)
|
|
40
|
+
response = @request_client.conn.get do |req|
|
|
41
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
42
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
43
|
+
req.headers = {
|
|
44
|
+
**(req.headers || {}),
|
|
45
|
+
**@request_client.get_headers,
|
|
46
|
+
**(request_options&.additional_headers || {})
|
|
47
|
+
}.compact
|
|
48
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit, "skip": skip }.compact
|
|
49
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
50
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
51
|
+
end
|
|
52
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes"
|
|
53
|
+
end
|
|
54
|
+
parsed_json = JSON.parse(response.body)
|
|
55
|
+
parsed_json&.map do |item|
|
|
56
|
+
item = item.to_json
|
|
57
|
+
TrophyApiClient::AdminAttribute.from_json(json_object: item)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Create attributes.
|
|
62
|
+
#
|
|
63
|
+
# @param request [TrophyApiClient::CREATE_ATTRIBUTES_REQUEST]
|
|
64
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
65
|
+
# @return [TrophyApiClient::CreateAttributesResponse]
|
|
66
|
+
# @example
|
|
67
|
+
# api = TrophyApiClient::Client.new(
|
|
68
|
+
# base_url: "https://api.example.com",
|
|
69
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
70
|
+
# api_key: "YOUR_API_KEY"
|
|
71
|
+
# )
|
|
72
|
+
# api.admin.attributes.create(request: [{ name: "Plan", key: "plan", type: USER }, { name: "Device", key: "device", type: EVENT }])
|
|
73
|
+
def create(request:, request_options: nil)
|
|
74
|
+
response = @request_client.conn.post do |req|
|
|
75
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
76
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
77
|
+
req.headers = {
|
|
78
|
+
**(req.headers || {}),
|
|
79
|
+
**@request_client.get_headers,
|
|
80
|
+
**(request_options&.additional_headers || {})
|
|
81
|
+
}.compact
|
|
82
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
83
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
84
|
+
end
|
|
85
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
86
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes"
|
|
87
|
+
end
|
|
88
|
+
TrophyApiClient::CreateAttributesResponse.from_json(json_object: response.body)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Delete attributes by ID.
|
|
92
|
+
#
|
|
93
|
+
# @param ids [String] Attribute IDs to delete. Repeat the query param or provide a comma-separated
|
|
94
|
+
# list.
|
|
95
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
96
|
+
# @return [TrophyApiClient::DeleteAttributesResponse]
|
|
97
|
+
# @example
|
|
98
|
+
# api = TrophyApiClient::Client.new(
|
|
99
|
+
# base_url: "https://api.example.com",
|
|
100
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
101
|
+
# api_key: "YOUR_API_KEY"
|
|
102
|
+
# )
|
|
103
|
+
# api.admin.attributes.delete
|
|
104
|
+
def delete(ids: nil, request_options: nil)
|
|
105
|
+
response = @request_client.conn.delete do |req|
|
|
106
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
107
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
108
|
+
req.headers = {
|
|
109
|
+
**(req.headers || {}),
|
|
110
|
+
**@request_client.get_headers,
|
|
111
|
+
**(request_options&.additional_headers || {})
|
|
112
|
+
}.compact
|
|
113
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "ids": ids }.compact
|
|
114
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
115
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
116
|
+
end
|
|
117
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes"
|
|
118
|
+
end
|
|
119
|
+
TrophyApiClient::DeleteAttributesResponse.from_json(json_object: response.body)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Update attributes by ID.
|
|
123
|
+
#
|
|
124
|
+
# @param request [TrophyApiClient::UPDATE_ATTRIBUTES_REQUEST]
|
|
125
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
126
|
+
# @return [TrophyApiClient::UpdateAttributesResponse]
|
|
127
|
+
# @example
|
|
128
|
+
# api = TrophyApiClient::Client.new(
|
|
129
|
+
# base_url: "https://api.example.com",
|
|
130
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
131
|
+
# api_key: "YOUR_API_KEY"
|
|
132
|
+
# )
|
|
133
|
+
# api.admin.attributes.update(request: [{ id: "550e8400-e29b-41d4-a716-446655440000", name: "Subscription Plan" }])
|
|
134
|
+
def update(request:, request_options: nil)
|
|
135
|
+
response = @request_client.conn.patch do |req|
|
|
136
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
137
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
138
|
+
req.headers = {
|
|
139
|
+
**(req.headers || {}),
|
|
140
|
+
**@request_client.get_headers,
|
|
141
|
+
**(request_options&.additional_headers || {})
|
|
142
|
+
}.compact
|
|
143
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
144
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
145
|
+
end
|
|
146
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
147
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes"
|
|
148
|
+
end
|
|
149
|
+
TrophyApiClient::UpdateAttributesResponse.from_json(json_object: response.body)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Get an attribute by ID.
|
|
153
|
+
#
|
|
154
|
+
# @param id [String] The UUID of the attribute to retrieve.
|
|
155
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
156
|
+
# @return [TrophyApiClient::AdminAttribute]
|
|
157
|
+
# @example
|
|
158
|
+
# api = TrophyApiClient::Client.new(
|
|
159
|
+
# base_url: "https://api.example.com",
|
|
160
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
161
|
+
# api_key: "YOUR_API_KEY"
|
|
162
|
+
# )
|
|
163
|
+
# api.admin.attributes.get(id: "550e8400-e29b-41d4-a716-446655440000")
|
|
164
|
+
def get(id:, request_options: nil)
|
|
165
|
+
response = @request_client.conn.get do |req|
|
|
166
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
167
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
168
|
+
req.headers = {
|
|
169
|
+
**(req.headers || {}),
|
|
170
|
+
**@request_client.get_headers,
|
|
171
|
+
**(request_options&.additional_headers || {})
|
|
172
|
+
}.compact
|
|
173
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
174
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
175
|
+
end
|
|
176
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
177
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
178
|
+
end
|
|
179
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes/#{id}"
|
|
180
|
+
end
|
|
181
|
+
TrophyApiClient::AdminAttribute.from_json(json_object: response.body)
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
class AsyncAttributesClient
|
|
186
|
+
# @return [TrophyApiClient::AsyncRequestClient]
|
|
187
|
+
attr_reader :request_client
|
|
188
|
+
|
|
189
|
+
# @param request_client [TrophyApiClient::AsyncRequestClient]
|
|
190
|
+
# @return [TrophyApiClient::Admin::AsyncAttributesClient]
|
|
191
|
+
def initialize(request_client:)
|
|
192
|
+
@request_client = request_client
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# List attributes.
|
|
196
|
+
#
|
|
197
|
+
# @param limit [Integer] Number of records to return.
|
|
198
|
+
# @param skip [Integer] Number of records to skip from the start of the list.
|
|
199
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
200
|
+
# @return [TrophyApiClient::LIST_ATTRIBUTES_RESPONSE]
|
|
201
|
+
# @example
|
|
202
|
+
# api = TrophyApiClient::Client.new(
|
|
203
|
+
# base_url: "https://api.example.com",
|
|
204
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
205
|
+
# api_key: "YOUR_API_KEY"
|
|
206
|
+
# )
|
|
207
|
+
# api.admin.attributes.list(limit: 1, skip: 1)
|
|
208
|
+
def list(limit: nil, skip: nil, request_options: nil)
|
|
209
|
+
Async do
|
|
210
|
+
response = @request_client.conn.get do |req|
|
|
211
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
212
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
213
|
+
req.headers = {
|
|
214
|
+
**(req.headers || {}),
|
|
215
|
+
**@request_client.get_headers,
|
|
216
|
+
**(request_options&.additional_headers || {})
|
|
217
|
+
}.compact
|
|
218
|
+
req.params = {
|
|
219
|
+
**(request_options&.additional_query_parameters || {}),
|
|
220
|
+
"limit": limit,
|
|
221
|
+
"skip": skip
|
|
222
|
+
}.compact
|
|
223
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
224
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
225
|
+
end
|
|
226
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes"
|
|
227
|
+
end
|
|
228
|
+
parsed_json = JSON.parse(response.body)
|
|
229
|
+
parsed_json&.map do |item|
|
|
230
|
+
item = item.to_json
|
|
231
|
+
TrophyApiClient::AdminAttribute.from_json(json_object: item)
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Create attributes.
|
|
237
|
+
#
|
|
238
|
+
# @param request [TrophyApiClient::CREATE_ATTRIBUTES_REQUEST]
|
|
239
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
240
|
+
# @return [TrophyApiClient::CreateAttributesResponse]
|
|
241
|
+
# @example
|
|
242
|
+
# api = TrophyApiClient::Client.new(
|
|
243
|
+
# base_url: "https://api.example.com",
|
|
244
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
245
|
+
# api_key: "YOUR_API_KEY"
|
|
246
|
+
# )
|
|
247
|
+
# api.admin.attributes.create(request: [{ name: "Plan", key: "plan", type: USER }, { name: "Device", key: "device", type: EVENT }])
|
|
248
|
+
def create(request:, request_options: nil)
|
|
249
|
+
Async do
|
|
250
|
+
response = @request_client.conn.post do |req|
|
|
251
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
252
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
253
|
+
req.headers = {
|
|
254
|
+
**(req.headers || {}),
|
|
255
|
+
**@request_client.get_headers,
|
|
256
|
+
**(request_options&.additional_headers || {})
|
|
257
|
+
}.compact
|
|
258
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
259
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
260
|
+
end
|
|
261
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
262
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes"
|
|
263
|
+
end
|
|
264
|
+
TrophyApiClient::CreateAttributesResponse.from_json(json_object: response.body)
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Delete attributes by ID.
|
|
269
|
+
#
|
|
270
|
+
# @param ids [String] Attribute IDs to delete. Repeat the query param or provide a comma-separated
|
|
271
|
+
# list.
|
|
272
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
273
|
+
# @return [TrophyApiClient::DeleteAttributesResponse]
|
|
274
|
+
# @example
|
|
275
|
+
# api = TrophyApiClient::Client.new(
|
|
276
|
+
# base_url: "https://api.example.com",
|
|
277
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
278
|
+
# api_key: "YOUR_API_KEY"
|
|
279
|
+
# )
|
|
280
|
+
# api.admin.attributes.delete
|
|
281
|
+
def delete(ids: nil, request_options: nil)
|
|
282
|
+
Async do
|
|
283
|
+
response = @request_client.conn.delete do |req|
|
|
284
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
285
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
286
|
+
req.headers = {
|
|
287
|
+
**(req.headers || {}),
|
|
288
|
+
**@request_client.get_headers,
|
|
289
|
+
**(request_options&.additional_headers || {})
|
|
290
|
+
}.compact
|
|
291
|
+
req.params = { **(request_options&.additional_query_parameters || {}), "ids": ids }.compact
|
|
292
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
293
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
294
|
+
end
|
|
295
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes"
|
|
296
|
+
end
|
|
297
|
+
TrophyApiClient::DeleteAttributesResponse.from_json(json_object: response.body)
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# Update attributes by ID.
|
|
302
|
+
#
|
|
303
|
+
# @param request [TrophyApiClient::UPDATE_ATTRIBUTES_REQUEST]
|
|
304
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
305
|
+
# @return [TrophyApiClient::UpdateAttributesResponse]
|
|
306
|
+
# @example
|
|
307
|
+
# api = TrophyApiClient::Client.new(
|
|
308
|
+
# base_url: "https://api.example.com",
|
|
309
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
310
|
+
# api_key: "YOUR_API_KEY"
|
|
311
|
+
# )
|
|
312
|
+
# api.admin.attributes.update(request: [{ id: "550e8400-e29b-41d4-a716-446655440000", name: "Subscription Plan" }])
|
|
313
|
+
def update(request:, request_options: nil)
|
|
314
|
+
Async do
|
|
315
|
+
response = @request_client.conn.patch do |req|
|
|
316
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
317
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
318
|
+
req.headers = {
|
|
319
|
+
**(req.headers || {}),
|
|
320
|
+
**@request_client.get_headers,
|
|
321
|
+
**(request_options&.additional_headers || {})
|
|
322
|
+
}.compact
|
|
323
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
324
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
325
|
+
end
|
|
326
|
+
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
327
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes"
|
|
328
|
+
end
|
|
329
|
+
TrophyApiClient::UpdateAttributesResponse.from_json(json_object: response.body)
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# Get an attribute by ID.
|
|
334
|
+
#
|
|
335
|
+
# @param id [String] The UUID of the attribute to retrieve.
|
|
336
|
+
# @param request_options [TrophyApiClient::RequestOptions]
|
|
337
|
+
# @return [TrophyApiClient::AdminAttribute]
|
|
338
|
+
# @example
|
|
339
|
+
# api = TrophyApiClient::Client.new(
|
|
340
|
+
# base_url: "https://api.example.com",
|
|
341
|
+
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
342
|
+
# api_key: "YOUR_API_KEY"
|
|
343
|
+
# )
|
|
344
|
+
# api.admin.attributes.get(id: "550e8400-e29b-41d4-a716-446655440000")
|
|
345
|
+
def get(id:, request_options: nil)
|
|
346
|
+
Async do
|
|
347
|
+
response = @request_client.conn.get do |req|
|
|
348
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
349
|
+
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
350
|
+
req.headers = {
|
|
351
|
+
**(req.headers || {}),
|
|
352
|
+
**@request_client.get_headers,
|
|
353
|
+
**(request_options&.additional_headers || {})
|
|
354
|
+
}.compact
|
|
355
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
356
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
357
|
+
end
|
|
358
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
359
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
360
|
+
end
|
|
361
|
+
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/attributes/#{id}"
|
|
362
|
+
end
|
|
363
|
+
TrophyApiClient::AdminAttribute.from_json(json_object: response.body)
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
end
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../../requests"
|
|
4
|
+
require_relative "attributes/client"
|
|
5
|
+
require_relative "metrics/client"
|
|
6
|
+
require_relative "leaderboards/client"
|
|
4
7
|
require_relative "streaks/client"
|
|
5
8
|
require_relative "points/client"
|
|
6
9
|
|
|
7
10
|
module TrophyApiClient
|
|
8
11
|
module Admin
|
|
9
12
|
class Client
|
|
13
|
+
# @return [TrophyApiClient::Admin::AttributesClient]
|
|
14
|
+
attr_reader :attributes
|
|
15
|
+
# @return [TrophyApiClient::Admin::MetricsClient]
|
|
16
|
+
attr_reader :metrics
|
|
17
|
+
# @return [TrophyApiClient::Admin::LeaderboardsClient]
|
|
18
|
+
attr_reader :leaderboards
|
|
10
19
|
# @return [TrophyApiClient::Admin::StreaksClient]
|
|
11
20
|
attr_reader :streaks
|
|
12
21
|
# @return [TrophyApiClient::Admin::Points::Client]
|
|
@@ -15,12 +24,21 @@ module TrophyApiClient
|
|
|
15
24
|
# @param request_client [TrophyApiClient::RequestClient]
|
|
16
25
|
# @return [TrophyApiClient::Admin::Client]
|
|
17
26
|
def initialize(request_client:)
|
|
27
|
+
@attributes = TrophyApiClient::Admin::AttributesClient.new(request_client: request_client)
|
|
28
|
+
@metrics = TrophyApiClient::Admin::MetricsClient.new(request_client: request_client)
|
|
29
|
+
@leaderboards = TrophyApiClient::Admin::LeaderboardsClient.new(request_client: request_client)
|
|
18
30
|
@streaks = TrophyApiClient::Admin::StreaksClient.new(request_client: request_client)
|
|
19
31
|
@admin = TrophyApiClient::Admin::Points::Client.new(request_client: request_client)
|
|
20
32
|
end
|
|
21
33
|
end
|
|
22
34
|
|
|
23
35
|
class AsyncClient
|
|
36
|
+
# @return [TrophyApiClient::Admin::AsyncAttributesClient]
|
|
37
|
+
attr_reader :attributes
|
|
38
|
+
# @return [TrophyApiClient::Admin::AsyncMetricsClient]
|
|
39
|
+
attr_reader :metrics
|
|
40
|
+
# @return [TrophyApiClient::Admin::AsyncLeaderboardsClient]
|
|
41
|
+
attr_reader :leaderboards
|
|
24
42
|
# @return [TrophyApiClient::Admin::AsyncStreaksClient]
|
|
25
43
|
attr_reader :streaks
|
|
26
44
|
# @return [TrophyApiClient::Admin::Points::AsyncClient]
|
|
@@ -29,6 +47,9 @@ module TrophyApiClient
|
|
|
29
47
|
# @param request_client [TrophyApiClient::AsyncRequestClient]
|
|
30
48
|
# @return [TrophyApiClient::Admin::AsyncClient]
|
|
31
49
|
def initialize(request_client:)
|
|
50
|
+
@attributes = TrophyApiClient::Admin::AsyncAttributesClient.new(request_client: request_client)
|
|
51
|
+
@metrics = TrophyApiClient::Admin::AsyncMetricsClient.new(request_client: request_client)
|
|
52
|
+
@leaderboards = TrophyApiClient::Admin::AsyncLeaderboardsClient.new(request_client: request_client)
|
|
32
53
|
@streaks = TrophyApiClient::Admin::AsyncStreaksClient.new(request_client: request_client)
|
|
33
54
|
@admin = TrophyApiClient::Admin::Points::AsyncClient.new(request_client: request_client)
|
|
34
55
|
end
|