trophy_api_client 1.8.0 → 1.10.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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/requests.rb +34 -8
  4. data/lib/trophy_api_client/achievements/client.rb +4 -0
  5. data/lib/trophy_api_client/admin/attributes/client.rb +10 -0
  6. data/lib/trophy_api_client/admin/client.rb +7 -0
  7. data/lib/trophy_api_client/admin/leaderboards/client.rb +10 -0
  8. data/lib/trophy_api_client/admin/metrics/client.rb +10 -0
  9. data/lib/trophy_api_client/admin/points/boosts/client.rb +10 -0
  10. data/lib/trophy_api_client/admin/points/levels/client.rb +10 -0
  11. data/lib/trophy_api_client/admin/points/systems/client.rb +10 -0
  12. data/lib/trophy_api_client/admin/points/triggers/client.rb +10 -0
  13. data/lib/trophy_api_client/admin/streaks/client.rb +2 -0
  14. data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -0
  15. data/lib/trophy_api_client/admin/tenants/client.rb +376 -0
  16. data/lib/trophy_api_client/leaderboards/client.rb +4 -0
  17. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +4 -4
  18. data/lib/trophy_api_client/metrics/client.rb +2 -0
  19. data/lib/trophy_api_client/points/client.rb +10 -0
  20. data/lib/trophy_api_client/streaks/client.rb +4 -0
  21. data/lib/trophy_api_client/types/admin_leaderboard.rb +4 -4
  22. data/lib/trophy_api_client/types/admin_points_boost.rb +2 -2
  23. data/lib/trophy_api_client/types/admin_tenant.rb +103 -0
  24. data/lib/trophy_api_client/types/admin_tenant_status.rb +9 -0
  25. data/lib/trophy_api_client/types/create_tenant_request_item.rb +66 -0
  26. data/lib/trophy_api_client/types/create_tenants_request.rb +7 -0
  27. data/lib/trophy_api_client/types/create_tenants_response.rb +74 -0
  28. data/lib/trophy_api_client/types/delete_tenants_response.rb +74 -0
  29. data/lib/trophy_api_client/types/leaderboard_response.rb +4 -4
  30. data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +4 -4
  31. data/lib/trophy_api_client/types/list_tenants_response.rb +7 -0
  32. data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +4 -4
  33. data/lib/trophy_api_client/types/update_tenant_request_item.rb +75 -0
  34. data/lib/trophy_api_client/types/update_tenants_request.rb +7 -0
  35. data/lib/trophy_api_client/types/update_tenants_response.rb +74 -0
  36. data/lib/trophy_api_client/types/user_leaderboard_response.rb +4 -4
  37. data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +4 -4
  38. data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +4 -4
  39. data/lib/trophy_api_client/users/client.rb +32 -0
  40. data/lib/trophy_api_client/version.rb +1 -1
  41. data/lib/trophy_api_client.rb +12 -4
  42. data/lib/types_export.rb +10 -0
  43. metadata +13 -2
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module TrophyApiClient
7
+ # A tenant to update.
8
+ class UpdateTenantRequestItem
9
+ # @return [String] The UUID of the tenant to update.
10
+ attr_reader :id
11
+ # @return [String] New external customer ID.
12
+ attr_reader :customer_id
13
+ # @return [String] New display name for the tenant.
14
+ attr_reader :name
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param id [String] The UUID of the tenant to update.
24
+ # @param customer_id [String] New external customer ID.
25
+ # @param name [String] New display name for the tenant.
26
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
+ # @return [TrophyApiClient::UpdateTenantRequestItem]
28
+ def initialize(id:, customer_id: OMIT, name: OMIT, additional_properties: nil)
29
+ @id = id
30
+ @customer_id = customer_id if customer_id != OMIT
31
+ @name = name if name != OMIT
32
+ @additional_properties = additional_properties
33
+ @_field_set = { "id": id, "customerId": customer_id, "name": name }.reject do |_k, v|
34
+ v == OMIT
35
+ end
36
+ end
37
+
38
+ # Deserialize a JSON object to an instance of UpdateTenantRequestItem
39
+ #
40
+ # @param json_object [String]
41
+ # @return [TrophyApiClient::UpdateTenantRequestItem]
42
+ def self.from_json(json_object:)
43
+ struct = JSON.parse(json_object, object_class: OpenStruct)
44
+ parsed_json = JSON.parse(json_object)
45
+ id = parsed_json["id"]
46
+ customer_id = parsed_json["customerId"]
47
+ name = parsed_json["name"]
48
+ new(
49
+ id: id,
50
+ customer_id: customer_id,
51
+ name: name,
52
+ additional_properties: struct
53
+ )
54
+ end
55
+
56
+ # Serialize an instance of UpdateTenantRequestItem to a JSON object
57
+ #
58
+ # @return [String]
59
+ def to_json(*_args)
60
+ @_field_set&.to_json
61
+ end
62
+
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
71
+ obj.customer_id&.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
72
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "update_tenant_request_item"
4
+
5
+ module TrophyApiClient
6
+ UPDATE_TENANTS_REQUEST = Array
7
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_tenant"
4
+ require_relative "admin_issue"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module TrophyApiClient
9
+ # Response containing updated tenants and any issues.
10
+ class UpdateTenantsResponse
11
+ # @return [Array<TrophyApiClient::AdminTenant>] Array of successfully updated tenants.
12
+ attr_reader :updated
13
+ # @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during update.
14
+ attr_reader :issues
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param updated [Array<TrophyApiClient::AdminTenant>] Array of successfully updated tenants.
24
+ # @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during update.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [TrophyApiClient::UpdateTenantsResponse]
27
+ def initialize(updated:, issues:, additional_properties: nil)
28
+ @updated = updated
29
+ @issues = issues
30
+ @additional_properties = additional_properties
31
+ @_field_set = { "updated": updated, "issues": issues }
32
+ end
33
+
34
+ # Deserialize a JSON object to an instance of UpdateTenantsResponse
35
+ #
36
+ # @param json_object [String]
37
+ # @return [TrophyApiClient::UpdateTenantsResponse]
38
+ def self.from_json(json_object:)
39
+ struct = JSON.parse(json_object, object_class: OpenStruct)
40
+ parsed_json = JSON.parse(json_object)
41
+ updated = parsed_json["updated"]&.map do |item|
42
+ item = item.to_json
43
+ TrophyApiClient::AdminTenant.from_json(json_object: item)
44
+ end
45
+ issues = parsed_json["issues"]&.map do |item|
46
+ item = item.to_json
47
+ TrophyApiClient::AdminIssue.from_json(json_object: item)
48
+ end
49
+ new(
50
+ updated: updated,
51
+ issues: issues,
52
+ additional_properties: struct
53
+ )
54
+ end
55
+
56
+ # Serialize an instance of UpdateTenantsResponse to a JSON object
57
+ #
58
+ # @return [String]
59
+ def to_json(*_args)
60
+ @_field_set&.to_json
61
+ end
62
+
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.updated.is_a?(Array) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
71
+ obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
72
+ end
73
+ end
74
+ end
@@ -82,8 +82,8 @@ module TrophyApiClient
82
82
  # type. Null for one-time leaderboards.
83
83
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
84
84
  # @return [TrophyApiClient::UserLeaderboardResponse]
85
- def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, rank: OMIT,
86
- value: OMIT, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
85
+ def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:, rank: OMIT, value: OMIT,
86
+ breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, max_participants: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
87
87
  @rank = rank if rank != OMIT
88
88
  @value = value if value != OMIT
89
89
  @id = id
@@ -99,7 +99,7 @@ module TrophyApiClient
99
99
  @description = description if description != OMIT
100
100
  @start = start
101
101
  @end_ = end_ if end_ != OMIT
102
- @max_participants = max_participants
102
+ @max_participants = max_participants if max_participants != OMIT
103
103
  @run_unit = run_unit if run_unit != OMIT
104
104
  @run_interval = run_interval if run_interval != OMIT
105
105
  @additional_properties = additional_properties
@@ -204,7 +204,7 @@ module TrophyApiClient
204
204
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
205
205
  obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
206
206
  obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
207
- obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
207
+ obj.max_participants&.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
208
208
  obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
209
209
  obj.run_interval&.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
210
210
  end
@@ -86,8 +86,8 @@ module TrophyApiClient
86
86
  # type. Null for one-time leaderboards.
87
87
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
88
88
  # @return [TrophyApiClient::UserLeaderboardResponseWithHistory]
89
- def initialize(history:, id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, rank: OMIT,
90
- value: OMIT, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
89
+ def initialize(history:, id:, name:, key:, rank_by:, breakdown_attributes:, start:, rank: OMIT, value: OMIT,
90
+ breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, max_participants: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
91
91
  @history = history
92
92
  @rank = rank if rank != OMIT
93
93
  @value = value if value != OMIT
@@ -104,7 +104,7 @@ module TrophyApiClient
104
104
  @description = description if description != OMIT
105
105
  @start = start
106
106
  @end_ = end_ if end_ != OMIT
107
- @max_participants = max_participants
107
+ @max_participants = max_participants if max_participants != OMIT
108
108
  @run_unit = run_unit if run_unit != OMIT
109
109
  @run_interval = run_interval if run_interval != OMIT
110
110
  @additional_properties = additional_properties
@@ -216,7 +216,7 @@ module TrophyApiClient
216
216
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
217
217
  obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
218
218
  obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
219
- obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
219
+ obj.max_participants&.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
220
220
  obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
221
221
  obj.run_interval&.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
222
222
  end
@@ -88,8 +88,8 @@ module TrophyApiClient
88
88
  # type. Null for one-time leaderboards.
89
89
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
90
90
  # @return [TrophyApiClient::WebhookUserLeaderboardResponse]
91
- def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:, max_participants:, previous_rank: OMIT, previous_value: OMIT, rank: OMIT, value: OMIT,
92
- breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
91
+ def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:, previous_rank: OMIT, previous_value: OMIT, rank: OMIT, value: OMIT,
92
+ breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, max_participants: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
93
93
  @previous_rank = previous_rank if previous_rank != OMIT
94
94
  @previous_value = previous_value if previous_value != OMIT
95
95
  @rank = rank if rank != OMIT
@@ -107,7 +107,7 @@ module TrophyApiClient
107
107
  @description = description if description != OMIT
108
108
  @start = start
109
109
  @end_ = end_ if end_ != OMIT
110
- @max_participants = max_participants
110
+ @max_participants = max_participants if max_participants != OMIT
111
111
  @run_unit = run_unit if run_unit != OMIT
112
112
  @run_interval = run_interval if run_interval != OMIT
113
113
  @additional_properties = additional_properties
@@ -220,7 +220,7 @@ module TrophyApiClient
220
220
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
221
221
  obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
222
222
  obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
223
- obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
223
+ obj.max_participants&.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
224
224
  obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
225
225
  obj.run_interval&.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
226
226
  end
@@ -54,6 +54,7 @@ module TrophyApiClient
54
54
  response = @request_client.conn.post do |req|
55
55
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
56
56
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
57
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
57
58
  req.headers = {
58
59
  **(req.headers || {}),
59
60
  **@request_client.get_headers,
@@ -84,6 +85,7 @@ module TrophyApiClient
84
85
  response = @request_client.conn.get do |req|
85
86
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
86
87
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
88
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
87
89
  req.headers = {
88
90
  **(req.headers || {}),
89
91
  **@request_client.get_headers,
@@ -123,6 +125,7 @@ module TrophyApiClient
123
125
  response = @request_client.conn.put do |req|
124
126
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
125
127
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
128
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
126
129
  req.headers = {
127
130
  **(req.headers || {}),
128
131
  **@request_client.get_headers,
@@ -160,6 +163,7 @@ module TrophyApiClient
160
163
  response = @request_client.conn.patch do |req|
161
164
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
162
165
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
166
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
163
167
  req.headers = {
164
168
  **(req.headers || {}),
165
169
  **@request_client.get_headers,
@@ -190,6 +194,7 @@ module TrophyApiClient
190
194
  response = @request_client.conn.get do |req|
191
195
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
192
196
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
197
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
193
198
  req.headers = {
194
199
  **(req.headers || {}),
195
200
  **@request_client.get_headers,
@@ -227,6 +232,7 @@ module TrophyApiClient
227
232
  response = @request_client.conn.patch do |req|
228
233
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
229
234
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
235
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
230
236
  req.headers = {
231
237
  **(req.headers || {}),
232
238
  **@request_client.get_headers,
@@ -257,6 +263,7 @@ module TrophyApiClient
257
263
  response = @request_client.conn.get do |req|
258
264
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
259
265
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
266
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
260
267
  req.headers = {
261
268
  **(req.headers || {}),
262
269
  **@request_client.get_headers,
@@ -294,6 +301,7 @@ module TrophyApiClient
294
301
  response = @request_client.conn.get do |req|
295
302
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
296
303
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
304
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
297
305
  req.headers = {
298
306
  **(req.headers || {}),
299
307
  **@request_client.get_headers,
@@ -339,6 +347,7 @@ module TrophyApiClient
339
347
  response = @request_client.conn.get do |req|
340
348
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
341
349
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
350
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
342
351
  req.headers = {
343
352
  **(req.headers || {}),
344
353
  **@request_client.get_headers,
@@ -382,6 +391,7 @@ module TrophyApiClient
382
391
  response = @request_client.conn.get do |req|
383
392
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
384
393
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
394
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
385
395
  req.headers = {
386
396
  **(req.headers || {}),
387
397
  **@request_client.get_headers,
@@ -422,6 +432,7 @@ module TrophyApiClient
422
432
  response = @request_client.conn.get do |req|
423
433
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
424
434
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
435
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
425
436
  req.headers = {
426
437
  **(req.headers || {}),
427
438
  **@request_client.get_headers,
@@ -461,6 +472,7 @@ module TrophyApiClient
461
472
  response = @request_client.conn.get do |req|
462
473
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
463
474
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
475
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
464
476
  req.headers = {
465
477
  **(req.headers || {}),
466
478
  **@request_client.get_headers,
@@ -494,6 +506,7 @@ module TrophyApiClient
494
506
  response = @request_client.conn.get do |req|
495
507
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
496
508
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
509
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
497
510
  req.headers = {
498
511
  **(req.headers || {}),
499
512
  **@request_client.get_headers,
@@ -544,6 +557,7 @@ module TrophyApiClient
544
557
  response = @request_client.conn.get do |req|
545
558
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
546
559
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
560
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
547
561
  req.headers = {
548
562
  **(req.headers || {}),
549
563
  **@request_client.get_headers,
@@ -593,6 +607,7 @@ module TrophyApiClient
593
607
  response = @request_client.conn.get do |req|
594
608
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
595
609
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
610
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
596
611
  req.headers = {
597
612
  **(req.headers || {}),
598
613
  **@request_client.get_headers,
@@ -630,6 +645,7 @@ module TrophyApiClient
630
645
  response = @request_client.conn.get do |req|
631
646
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
632
647
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
648
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
633
649
  req.headers = {
634
650
  **(req.headers || {}),
635
651
  **@request_client.get_headers,
@@ -679,6 +695,7 @@ module TrophyApiClient
679
695
  response = @request_client.conn.post do |req|
680
696
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
681
697
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
698
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
682
699
  req.headers = {
683
700
  **(req.headers || {}),
684
701
  **@request_client.get_headers,
@@ -711,6 +728,7 @@ module TrophyApiClient
711
728
  response = @request_client.conn.get do |req|
712
729
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
713
730
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
731
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
714
732
  req.headers = {
715
733
  **(req.headers || {}),
716
734
  **@request_client.get_headers,
@@ -752,6 +770,7 @@ module TrophyApiClient
752
770
  response = @request_client.conn.put do |req|
753
771
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
754
772
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
773
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
755
774
  req.headers = {
756
775
  **(req.headers || {}),
757
776
  **@request_client.get_headers,
@@ -791,6 +810,7 @@ module TrophyApiClient
791
810
  response = @request_client.conn.patch do |req|
792
811
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
793
812
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
813
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
794
814
  req.headers = {
795
815
  **(req.headers || {}),
796
816
  **@request_client.get_headers,
@@ -823,6 +843,7 @@ module TrophyApiClient
823
843
  response = @request_client.conn.get do |req|
824
844
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
825
845
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
846
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
826
847
  req.headers = {
827
848
  **(req.headers || {}),
828
849
  **@request_client.get_headers,
@@ -863,6 +884,7 @@ module TrophyApiClient
863
884
  response = @request_client.conn.patch do |req|
864
885
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
865
886
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
887
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
866
888
  req.headers = {
867
889
  **(req.headers || {}),
868
890
  **@request_client.get_headers,
@@ -896,6 +918,7 @@ module TrophyApiClient
896
918
  response = @request_client.conn.get do |req|
897
919
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
898
920
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
921
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
899
922
  req.headers = {
900
923
  **(req.headers || {}),
901
924
  **@request_client.get_headers,
@@ -935,6 +958,7 @@ module TrophyApiClient
935
958
  response = @request_client.conn.get do |req|
936
959
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
937
960
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
961
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
938
962
  req.headers = {
939
963
  **(req.headers || {}),
940
964
  **@request_client.get_headers,
@@ -982,6 +1006,7 @@ module TrophyApiClient
982
1006
  response = @request_client.conn.get do |req|
983
1007
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
984
1008
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
1009
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
985
1010
  req.headers = {
986
1011
  **(req.headers || {}),
987
1012
  **@request_client.get_headers,
@@ -1027,6 +1052,7 @@ module TrophyApiClient
1027
1052
  response = @request_client.conn.get do |req|
1028
1053
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
1029
1054
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
1055
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
1030
1056
  req.headers = {
1031
1057
  **(req.headers || {}),
1032
1058
  **@request_client.get_headers,
@@ -1069,6 +1095,7 @@ module TrophyApiClient
1069
1095
  response = @request_client.conn.get do |req|
1070
1096
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
1071
1097
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
1098
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
1072
1099
  req.headers = {
1073
1100
  **(req.headers || {}),
1074
1101
  **@request_client.get_headers,
@@ -1110,6 +1137,7 @@ module TrophyApiClient
1110
1137
  response = @request_client.conn.get do |req|
1111
1138
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
1112
1139
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
1140
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
1113
1141
  req.headers = {
1114
1142
  **(req.headers || {}),
1115
1143
  **@request_client.get_headers,
@@ -1145,6 +1173,7 @@ module TrophyApiClient
1145
1173
  response = @request_client.conn.get do |req|
1146
1174
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
1147
1175
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
1176
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
1148
1177
  req.headers = {
1149
1178
  **(req.headers || {}),
1150
1179
  **@request_client.get_headers,
@@ -1197,6 +1226,7 @@ module TrophyApiClient
1197
1226
  response = @request_client.conn.get do |req|
1198
1227
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
1199
1228
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
1229
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
1200
1230
  req.headers = {
1201
1231
  **(req.headers || {}),
1202
1232
  **@request_client.get_headers,
@@ -1248,6 +1278,7 @@ module TrophyApiClient
1248
1278
  response = @request_client.conn.get do |req|
1249
1279
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
1250
1280
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
1281
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
1251
1282
  req.headers = {
1252
1283
  **(req.headers || {}),
1253
1284
  **@request_client.get_headers,
@@ -1287,6 +1318,7 @@ module TrophyApiClient
1287
1318
  response = @request_client.conn.get do |req|
1288
1319
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
1289
1320
  req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
1321
+ req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
1290
1322
  req.headers = {
1291
1323
  **(req.headers || {}),
1292
1324
  **@request_client.get_headers,
@@ -1,3 +1,3 @@
1
1
  module MyGem
2
- VERSION = "1.8.0"
2
+ VERSION = "1.10.0"
3
3
  end
@@ -33,15 +33,19 @@ module TrophyApiClient
33
33
  # @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
34
34
  # @param timeout_in_seconds [Long]
35
35
  # @param api_key [String]
36
+ # @param tenant_id [String] The tenant identifier for multi-tenant organisations. Required when the
37
+ # organisation has multi-tenancy enabled. The value should be your internal ID for
38
+ # the tenant. Ignored for single-tenant organisations.
36
39
  # @return [TrophyApiClient::Client]
37
40
  def initialize(api_key:, base_url: nil, environment: TrophyApiClient::Environment::PRODUCTION, max_retries: nil,
38
- timeout_in_seconds: nil)
41
+ timeout_in_seconds: nil, tenant_id: nil)
39
42
  @request_client = TrophyApiClient::RequestClient.new(
40
43
  base_url: base_url,
41
44
  environment: environment,
42
45
  max_retries: max_retries,
43
46
  timeout_in_seconds: timeout_in_seconds,
44
- api_key: api_key
47
+ api_key: api_key,
48
+ tenant_id: tenant_id
45
49
  )
46
50
  @achievements = TrophyApiClient::AchievementsClient.new(request_client: @request_client)
47
51
  @metrics = TrophyApiClient::MetricsClient.new(request_client: @request_client)
@@ -74,15 +78,19 @@ module TrophyApiClient
74
78
  # @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
75
79
  # @param timeout_in_seconds [Long]
76
80
  # @param api_key [String]
81
+ # @param tenant_id [String] The tenant identifier for multi-tenant organisations. Required when the
82
+ # organisation has multi-tenancy enabled. The value should be your internal ID for
83
+ # the tenant. Ignored for single-tenant organisations.
77
84
  # @return [TrophyApiClient::AsyncClient]
78
85
  def initialize(api_key:, base_url: nil, environment: TrophyApiClient::Environment::PRODUCTION, max_retries: nil,
79
- timeout_in_seconds: nil)
86
+ timeout_in_seconds: nil, tenant_id: nil)
80
87
  @async_request_client = TrophyApiClient::AsyncRequestClient.new(
81
88
  base_url: base_url,
82
89
  environment: environment,
83
90
  max_retries: max_retries,
84
91
  timeout_in_seconds: timeout_in_seconds,
85
- api_key: api_key
92
+ api_key: api_key,
93
+ tenant_id: tenant_id
86
94
  )
87
95
  @achievements = TrophyApiClient::AsyncAchievementsClient.new(request_client: @async_request_client)
88
96
  @metrics = TrophyApiClient::AsyncMetricsClient.new(request_client: @async_request_client)
data/lib/types_export.rb CHANGED
@@ -208,3 +208,13 @@ require_relative "trophy_api_client/types/update_points_systems_request"
208
208
  require_relative "trophy_api_client/types/update_points_system_request_item_badge"
209
209
  require_relative "trophy_api_client/types/update_points_systems_response"
210
210
  require_relative "trophy_api_client/types/delete_points_systems_response"
211
+ require_relative "trophy_api_client/types/admin_tenant_status"
212
+ require_relative "trophy_api_client/types/admin_tenant"
213
+ require_relative "trophy_api_client/types/list_tenants_response"
214
+ require_relative "trophy_api_client/types/create_tenant_request_item"
215
+ require_relative "trophy_api_client/types/create_tenants_request"
216
+ require_relative "trophy_api_client/types/create_tenants_response"
217
+ require_relative "trophy_api_client/types/update_tenant_request_item"
218
+ require_relative "trophy_api_client/types/update_tenants_request"
219
+ require_relative "trophy_api_client/types/update_tenants_response"
220
+ require_relative "trophy_api_client/types/delete_tenants_response"
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.8.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trophy Labs, Inc
@@ -113,6 +113,7 @@ files:
113
113
  - lib/trophy_api_client/admin/streaks/freezes/client.rb
114
114
  - lib/trophy_api_client/admin/streaks/freezes/types/create_streak_freezes_request_freezes_item.rb
115
115
  - lib/trophy_api_client/admin/streaks/types/restore_streaks_request_users_item.rb
116
+ - lib/trophy_api_client/admin/tenants/client.rb
116
117
  - lib/trophy_api_client/leaderboards/client.rb
117
118
  - lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb
118
119
  - lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item_status.rb
@@ -150,6 +151,8 @@ files:
150
151
  - lib/trophy_api_client/types/admin_points_trigger_time_unit.rb
151
152
  - lib/trophy_api_client/types/admin_points_trigger_type.rb
152
153
  - lib/trophy_api_client/types/admin_points_trigger_user_attributes_item.rb
154
+ - lib/trophy_api_client/types/admin_tenant.rb
155
+ - lib/trophy_api_client/types/admin_tenant_status.rb
153
156
  - lib/trophy_api_client/types/base_streak_response.rb
154
157
  - lib/trophy_api_client/types/bulk_streak_response.rb
155
158
  - lib/trophy_api_client/types/bulk_streak_response_item.rb
@@ -189,6 +192,9 @@ files:
189
192
  - lib/trophy_api_client/types/create_points_triggers_request.rb
190
193
  - lib/trophy_api_client/types/create_points_triggers_response.rb
191
194
  - lib/trophy_api_client/types/create_streak_freezes_response.rb
195
+ - lib/trophy_api_client/types/create_tenant_request_item.rb
196
+ - lib/trophy_api_client/types/create_tenants_request.rb
197
+ - lib/trophy_api_client/types/create_tenants_response.rb
192
198
  - lib/trophy_api_client/types/created_admin_points_system.rb
193
199
  - lib/trophy_api_client/types/created_metric.rb
194
200
  - lib/trophy_api_client/types/created_metric_unit_type.rb
@@ -199,6 +205,7 @@ files:
199
205
  - lib/trophy_api_client/types/delete_points_levels_response.rb
200
206
  - lib/trophy_api_client/types/delete_points_systems_response.rb
201
207
  - lib/trophy_api_client/types/delete_points_triggers_response.rb
208
+ - lib/trophy_api_client/types/delete_tenants_response.rb
202
209
  - lib/trophy_api_client/types/deleted_resource.rb
203
210
  - lib/trophy_api_client/types/error_body.rb
204
211
  - lib/trophy_api_client/types/event_response.rb
@@ -217,6 +224,7 @@ files:
217
224
  - lib/trophy_api_client/types/list_points_levels_response.rb
218
225
  - lib/trophy_api_client/types/list_points_systems_response.rb
219
226
  - lib/trophy_api_client/types/list_points_triggers_response.rb
227
+ - lib/trophy_api_client/types/list_tenants_response.rb
220
228
  - lib/trophy_api_client/types/metric_event_leaderboard_response.rb
221
229
  - lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb
222
230
  - lib/trophy_api_client/types/metric_event_points_response.rb
@@ -284,6 +292,9 @@ files:
284
292
  - lib/trophy_api_client/types/update_points_system_request_item_badge.rb
285
293
  - lib/trophy_api_client/types/update_points_systems_request.rb
286
294
  - lib/trophy_api_client/types/update_points_systems_response.rb
295
+ - lib/trophy_api_client/types/update_tenant_request_item.rb
296
+ - lib/trophy_api_client/types/update_tenants_request.rb
297
+ - lib/trophy_api_client/types/update_tenants_response.rb
287
298
  - lib/trophy_api_client/types/updated_user.rb
288
299
  - lib/trophy_api_client/types/upserted_user.rb
289
300
  - lib/trophy_api_client/types/user.rb
@@ -346,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
346
357
  - !ruby/object:Gem::Version
347
358
  version: '0'
348
359
  requirements: []
349
- rubygems_version: 4.0.6
360
+ rubygems_version: 4.0.10
350
361
  specification_version: 4
351
362
  summary: Ruby library for the Trophy API.
352
363
  test_files: []