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.
- checksums.yaml +4 -4
- data/lib/gemconfig.rb +1 -1
- data/lib/requests.rb +34 -8
- data/lib/trophy_api_client/achievements/client.rb +4 -0
- data/lib/trophy_api_client/admin/attributes/client.rb +10 -0
- data/lib/trophy_api_client/admin/client.rb +7 -0
- data/lib/trophy_api_client/admin/leaderboards/client.rb +10 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +10 -0
- data/lib/trophy_api_client/admin/points/boosts/client.rb +10 -0
- data/lib/trophy_api_client/admin/points/levels/client.rb +10 -0
- data/lib/trophy_api_client/admin/points/systems/client.rb +10 -0
- data/lib/trophy_api_client/admin/points/triggers/client.rb +10 -0
- data/lib/trophy_api_client/admin/streaks/client.rb +2 -0
- data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -0
- data/lib/trophy_api_client/admin/tenants/client.rb +376 -0
- data/lib/trophy_api_client/leaderboards/client.rb +4 -0
- data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +4 -4
- data/lib/trophy_api_client/metrics/client.rb +2 -0
- data/lib/trophy_api_client/points/client.rb +10 -0
- data/lib/trophy_api_client/streaks/client.rb +4 -0
- data/lib/trophy_api_client/types/admin_leaderboard.rb +4 -4
- data/lib/trophy_api_client/types/admin_points_boost.rb +2 -2
- data/lib/trophy_api_client/types/admin_tenant.rb +103 -0
- data/lib/trophy_api_client/types/admin_tenant_status.rb +9 -0
- data/lib/trophy_api_client/types/create_tenant_request_item.rb +66 -0
- data/lib/trophy_api_client/types/create_tenants_request.rb +7 -0
- data/lib/trophy_api_client/types/create_tenants_response.rb +74 -0
- data/lib/trophy_api_client/types/delete_tenants_response.rb +74 -0
- data/lib/trophy_api_client/types/leaderboard_response.rb +4 -4
- data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +4 -4
- data/lib/trophy_api_client/types/list_tenants_response.rb +7 -0
- data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +4 -4
- data/lib/trophy_api_client/types/update_tenant_request_item.rb +75 -0
- data/lib/trophy_api_client/types/update_tenants_request.rb +7 -0
- data/lib/trophy_api_client/types/update_tenants_response.rb +74 -0
- data/lib/trophy_api_client/types/user_leaderboard_response.rb +4 -4
- data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +4 -4
- data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +4 -4
- data/lib/trophy_api_client/users/client.rb +32 -0
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/trophy_api_client.rb +12 -4
- data/lib/types_export.rb +10 -0
- metadata +13 -2
|
@@ -39,6 +39,7 @@ module TrophyApiClient
|
|
|
39
39
|
response = @request_client.conn.get do |req|
|
|
40
40
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
41
41
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
42
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
42
43
|
req.headers = {
|
|
43
44
|
**(req.headers || {}),
|
|
44
45
|
**@request_client.get_headers,
|
|
@@ -76,6 +77,7 @@ module TrophyApiClient
|
|
|
76
77
|
response = @request_client.conn.get do |req|
|
|
77
78
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
78
79
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
80
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
79
81
|
req.headers = {
|
|
80
82
|
**(req.headers || {}),
|
|
81
83
|
**@request_client.get_headers,
|
|
@@ -111,6 +113,7 @@ module TrophyApiClient
|
|
|
111
113
|
response = @request_client.conn.get do |req|
|
|
112
114
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
113
115
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
116
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
114
117
|
req.headers = {
|
|
115
118
|
**(req.headers || {}),
|
|
116
119
|
**@request_client.get_headers,
|
|
@@ -148,6 +151,7 @@ module TrophyApiClient
|
|
|
148
151
|
response = @request_client.conn.get do |req|
|
|
149
152
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
150
153
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
154
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
151
155
|
req.headers = {
|
|
152
156
|
**(req.headers || {}),
|
|
153
157
|
**@request_client.get_headers,
|
|
@@ -184,6 +188,7 @@ module TrophyApiClient
|
|
|
184
188
|
response = @request_client.conn.get do |req|
|
|
185
189
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
186
190
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
191
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
187
192
|
req.headers = {
|
|
188
193
|
**(req.headers || {}),
|
|
189
194
|
**@request_client.get_headers,
|
|
@@ -236,6 +241,7 @@ module TrophyApiClient
|
|
|
236
241
|
response = @request_client.conn.get do |req|
|
|
237
242
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
238
243
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
244
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
239
245
|
req.headers = {
|
|
240
246
|
**(req.headers || {}),
|
|
241
247
|
**@request_client.get_headers,
|
|
@@ -275,6 +281,7 @@ module TrophyApiClient
|
|
|
275
281
|
response = @request_client.conn.get do |req|
|
|
276
282
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
277
283
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
284
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
278
285
|
req.headers = {
|
|
279
286
|
**(req.headers || {}),
|
|
280
287
|
**@request_client.get_headers,
|
|
@@ -312,6 +319,7 @@ module TrophyApiClient
|
|
|
312
319
|
response = @request_client.conn.get do |req|
|
|
313
320
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
314
321
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
322
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
315
323
|
req.headers = {
|
|
316
324
|
**(req.headers || {}),
|
|
317
325
|
**@request_client.get_headers,
|
|
@@ -351,6 +359,7 @@ module TrophyApiClient
|
|
|
351
359
|
response = @request_client.conn.get do |req|
|
|
352
360
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
353
361
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
362
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
354
363
|
req.headers = {
|
|
355
364
|
**(req.headers || {}),
|
|
356
365
|
**@request_client.get_headers,
|
|
@@ -389,6 +398,7 @@ module TrophyApiClient
|
|
|
389
398
|
response = @request_client.conn.get do |req|
|
|
390
399
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
391
400
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
401
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
392
402
|
req.headers = {
|
|
393
403
|
**(req.headers || {}),
|
|
394
404
|
**@request_client.get_headers,
|
|
@@ -35,6 +35,7 @@ module TrophyApiClient
|
|
|
35
35
|
response = @request_client.conn.get do |req|
|
|
36
36
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
37
37
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
38
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
38
39
|
req.headers = {
|
|
39
40
|
**(req.headers || {}),
|
|
40
41
|
**@request_client.get_headers,
|
|
@@ -70,6 +71,7 @@ module TrophyApiClient
|
|
|
70
71
|
response = @request_client.conn.get do |req|
|
|
71
72
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
72
73
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
74
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
73
75
|
req.headers = {
|
|
74
76
|
**(req.headers || {}),
|
|
75
77
|
**@request_client.get_headers,
|
|
@@ -117,6 +119,7 @@ module TrophyApiClient
|
|
|
117
119
|
response = @request_client.conn.get do |req|
|
|
118
120
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
119
121
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
122
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
120
123
|
req.headers = {
|
|
121
124
|
**(req.headers || {}),
|
|
122
125
|
**@request_client.get_headers,
|
|
@@ -154,6 +157,7 @@ module TrophyApiClient
|
|
|
154
157
|
response = @request_client.conn.get do |req|
|
|
155
158
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
156
159
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
160
|
+
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
157
161
|
req.headers = {
|
|
158
162
|
**(req.headers || {}),
|
|
159
163
|
**@request_client.get_headers,
|
|
@@ -61,8 +61,8 @@ module TrophyApiClient
|
|
|
61
61
|
# @param run_interval [Integer] The number of recurrence units between leaderboard runs.
|
|
62
62
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
63
63
|
# @return [TrophyApiClient::AdminLeaderboard]
|
|
64
|
-
def initialize(id:, name:, key:, status:, rank_by:,
|
|
65
|
-
|
|
64
|
+
def initialize(id:, name:, key:, status:, rank_by:, start:, breakdown_attributes:, description: OMIT, metric_id: OMIT, points_system_id: OMIT,
|
|
65
|
+
max_participants: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
|
|
66
66
|
@id = id
|
|
67
67
|
@name = name
|
|
68
68
|
@key = key
|
|
@@ -71,7 +71,7 @@ module TrophyApiClient
|
|
|
71
71
|
@rank_by = rank_by
|
|
72
72
|
@metric_id = metric_id if metric_id != OMIT
|
|
73
73
|
@points_system_id = points_system_id if points_system_id != OMIT
|
|
74
|
-
@max_participants = max_participants
|
|
74
|
+
@max_participants = max_participants if max_participants != OMIT
|
|
75
75
|
@start = start
|
|
76
76
|
@end_ = end_ if end_ != OMIT
|
|
77
77
|
@breakdown_attributes = breakdown_attributes
|
|
@@ -160,7 +160,7 @@ module TrophyApiClient
|
|
|
160
160
|
obj.rank_by.is_a?(TrophyApiClient::AdminLeaderboardRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
|
|
161
161
|
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
162
162
|
obj.points_system_id&.is_a?(String) != false || raise("Passed value for field obj.points_system_id is not the expected type, validation failed.")
|
|
163
|
-
obj.max_participants
|
|
163
|
+
obj.max_participants&.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
|
|
164
164
|
obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
|
165
165
|
obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
|
166
166
|
obj.breakdown_attributes.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
|
|
@@ -23,7 +23,7 @@ module TrophyApiClient
|
|
|
23
23
|
attr_reader :multiplier
|
|
24
24
|
# @return [TrophyApiClient::AdminPointsBoostRounding] How boosted points are rounded.
|
|
25
25
|
attr_reader :rounding
|
|
26
|
-
# @return [String] The
|
|
26
|
+
# @return [String] The ID of the user the boost was created for, or null for
|
|
27
27
|
# global/attribute-filtered boosts.
|
|
28
28
|
attr_reader :user_id
|
|
29
29
|
# @return [Array<TrophyApiClient::AdminPointsBoostUserAttributesItem>] User attribute filters applied to the boost. Only present for non-user-specific
|
|
@@ -44,7 +44,7 @@ module TrophyApiClient
|
|
|
44
44
|
# @param end_ [String] The end date (YYYY-MM-DD) or null if no end date.
|
|
45
45
|
# @param multiplier [Float] The points multiplier.
|
|
46
46
|
# @param rounding [TrophyApiClient::AdminPointsBoostRounding] How boosted points are rounded.
|
|
47
|
-
# @param user_id [String] The
|
|
47
|
+
# @param user_id [String] The ID of the user the boost was created for, or null for
|
|
48
48
|
# global/attribute-filtered boosts.
|
|
49
49
|
# @param user_attributes [Array<TrophyApiClient::AdminPointsBoostUserAttributesItem>] User attribute filters applied to the boost. Only present for non-user-specific
|
|
50
50
|
# boosts (i.e. when `userId` is null). Empty array if no filters are set.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "admin_tenant_status"
|
|
4
|
+
require "date"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# A tenant in a multi-tenant environment.
|
|
10
|
+
class AdminTenant
|
|
11
|
+
# @return [String] The tenant UUID.
|
|
12
|
+
attr_reader :id
|
|
13
|
+
# @return [String] The external customer ID for this tenant.
|
|
14
|
+
attr_reader :customer_id
|
|
15
|
+
# @return [String] Human-readable name for the tenant.
|
|
16
|
+
attr_reader :name
|
|
17
|
+
# @return [TrophyApiClient::AdminTenantStatus] The lifecycle status of the tenant.
|
|
18
|
+
attr_reader :status
|
|
19
|
+
# @return [DateTime] When the tenant was created.
|
|
20
|
+
attr_reader :created
|
|
21
|
+
# @return [DateTime] When the tenant was last updated.
|
|
22
|
+
attr_reader :updated
|
|
23
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
24
|
+
attr_reader :additional_properties
|
|
25
|
+
# @return [Object]
|
|
26
|
+
attr_reader :_field_set
|
|
27
|
+
protected :_field_set
|
|
28
|
+
|
|
29
|
+
OMIT = Object.new
|
|
30
|
+
|
|
31
|
+
# @param id [String] The tenant UUID.
|
|
32
|
+
# @param customer_id [String] The external customer ID for this tenant.
|
|
33
|
+
# @param name [String] Human-readable name for the tenant.
|
|
34
|
+
# @param status [TrophyApiClient::AdminTenantStatus] The lifecycle status of the tenant.
|
|
35
|
+
# @param created [DateTime] When the tenant was created.
|
|
36
|
+
# @param updated [DateTime] When the tenant was last updated.
|
|
37
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
38
|
+
# @return [TrophyApiClient::AdminTenant]
|
|
39
|
+
def initialize(id:, customer_id:, name:, status:, created:, updated:, additional_properties: nil)
|
|
40
|
+
@id = id
|
|
41
|
+
@customer_id = customer_id
|
|
42
|
+
@name = name
|
|
43
|
+
@status = status
|
|
44
|
+
@created = created
|
|
45
|
+
@updated = updated
|
|
46
|
+
@additional_properties = additional_properties
|
|
47
|
+
@_field_set = {
|
|
48
|
+
"id": id,
|
|
49
|
+
"customerId": customer_id,
|
|
50
|
+
"name": name,
|
|
51
|
+
"status": status,
|
|
52
|
+
"created": created,
|
|
53
|
+
"updated": updated
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Deserialize a JSON object to an instance of AdminTenant
|
|
58
|
+
#
|
|
59
|
+
# @param json_object [String]
|
|
60
|
+
# @return [TrophyApiClient::AdminTenant]
|
|
61
|
+
def self.from_json(json_object:)
|
|
62
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
63
|
+
parsed_json = JSON.parse(json_object)
|
|
64
|
+
id = parsed_json["id"]
|
|
65
|
+
customer_id = parsed_json["customerId"]
|
|
66
|
+
name = parsed_json["name"]
|
|
67
|
+
status = parsed_json["status"]
|
|
68
|
+
created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
|
|
69
|
+
updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
|
|
70
|
+
new(
|
|
71
|
+
id: id,
|
|
72
|
+
customer_id: customer_id,
|
|
73
|
+
name: name,
|
|
74
|
+
status: status,
|
|
75
|
+
created: created,
|
|
76
|
+
updated: updated,
|
|
77
|
+
additional_properties: struct
|
|
78
|
+
)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Serialize an instance of AdminTenant to a JSON object
|
|
82
|
+
#
|
|
83
|
+
# @return [String]
|
|
84
|
+
def to_json(*_args)
|
|
85
|
+
@_field_set&.to_json
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
89
|
+
# hash and check each fields type against the current object's property
|
|
90
|
+
# definitions.
|
|
91
|
+
#
|
|
92
|
+
# @param obj [Object]
|
|
93
|
+
# @return [Void]
|
|
94
|
+
def self.validate_raw(obj:)
|
|
95
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
96
|
+
obj.customer_id.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
|
|
97
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
98
|
+
obj.status.is_a?(TrophyApiClient::AdminTenantStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
99
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
|
100
|
+
obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
# A tenant to create.
|
|
8
|
+
class CreateTenantRequestItem
|
|
9
|
+
# @return [String] The external customer ID. Must be unique within the environment.
|
|
10
|
+
attr_reader :customer_id
|
|
11
|
+
# @return [String] Human-readable name for the tenant.
|
|
12
|
+
attr_reader :name
|
|
13
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
14
|
+
attr_reader :additional_properties
|
|
15
|
+
# @return [Object]
|
|
16
|
+
attr_reader :_field_set
|
|
17
|
+
protected :_field_set
|
|
18
|
+
|
|
19
|
+
OMIT = Object.new
|
|
20
|
+
|
|
21
|
+
# @param customer_id [String] The external customer ID. Must be unique within the environment.
|
|
22
|
+
# @param name [String] Human-readable name for the tenant.
|
|
23
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
24
|
+
# @return [TrophyApiClient::CreateTenantRequestItem]
|
|
25
|
+
def initialize(customer_id:, name:, additional_properties: nil)
|
|
26
|
+
@customer_id = customer_id
|
|
27
|
+
@name = name
|
|
28
|
+
@additional_properties = additional_properties
|
|
29
|
+
@_field_set = { "customerId": customer_id, "name": name }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Deserialize a JSON object to an instance of CreateTenantRequestItem
|
|
33
|
+
#
|
|
34
|
+
# @param json_object [String]
|
|
35
|
+
# @return [TrophyApiClient::CreateTenantRequestItem]
|
|
36
|
+
def self.from_json(json_object:)
|
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
38
|
+
parsed_json = JSON.parse(json_object)
|
|
39
|
+
customer_id = parsed_json["customerId"]
|
|
40
|
+
name = parsed_json["name"]
|
|
41
|
+
new(
|
|
42
|
+
customer_id: customer_id,
|
|
43
|
+
name: name,
|
|
44
|
+
additional_properties: struct
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Serialize an instance of CreateTenantRequestItem to a JSON object
|
|
49
|
+
#
|
|
50
|
+
# @return [String]
|
|
51
|
+
def to_json(*_args)
|
|
52
|
+
@_field_set&.to_json
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
56
|
+
# hash and check each fields type against the current object's property
|
|
57
|
+
# definitions.
|
|
58
|
+
#
|
|
59
|
+
# @param obj [Object]
|
|
60
|
+
# @return [Void]
|
|
61
|
+
def self.validate_raw(obj:)
|
|
62
|
+
obj.customer_id.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
|
|
63
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
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 created tenants and any issues.
|
|
10
|
+
class CreateTenantsResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::AdminTenant>] Array of successfully created tenants.
|
|
12
|
+
attr_reader :created
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during creation.
|
|
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 created [Array<TrophyApiClient::AdminTenant>] Array of successfully created tenants.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during creation.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::CreateTenantsResponse]
|
|
27
|
+
def initialize(created:, issues:, additional_properties: nil)
|
|
28
|
+
@created = created
|
|
29
|
+
@issues = issues
|
|
30
|
+
@additional_properties = additional_properties
|
|
31
|
+
@_field_set = { "created": created, "issues": issues }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Deserialize a JSON object to an instance of CreateTenantsResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::CreateTenantsResponse]
|
|
38
|
+
def self.from_json(json_object:)
|
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
40
|
+
parsed_json = JSON.parse(json_object)
|
|
41
|
+
created = parsed_json["created"]&.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
|
+
created: created,
|
|
51
|
+
issues: issues,
|
|
52
|
+
additional_properties: struct
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Serialize an instance of CreateTenantsResponse 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.created.is_a?(Array) != false || raise("Passed value for field obj.created 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
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "deleted_resource"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing deleted tenant IDs and any issues.
|
|
10
|
+
class DeleteTenantsResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::DeletedResource>] Array of deleted tenant IDs.
|
|
12
|
+
attr_reader :deleted
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during deletion.
|
|
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 deleted [Array<TrophyApiClient::DeletedResource>] Array of deleted tenant IDs.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during deletion.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::DeleteTenantsResponse]
|
|
27
|
+
def initialize(deleted:, issues:, additional_properties: nil)
|
|
28
|
+
@deleted = deleted
|
|
29
|
+
@issues = issues
|
|
30
|
+
@additional_properties = additional_properties
|
|
31
|
+
@_field_set = { "deleted": deleted, "issues": issues }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Deserialize a JSON object to an instance of DeleteTenantsResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::DeleteTenantsResponse]
|
|
38
|
+
def self.from_json(json_object:)
|
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
40
|
+
parsed_json = JSON.parse(json_object)
|
|
41
|
+
deleted = parsed_json["deleted"]&.map do |item|
|
|
42
|
+
item = item.to_json
|
|
43
|
+
TrophyApiClient::DeletedResource.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
|
+
deleted: deleted,
|
|
51
|
+
issues: issues,
|
|
52
|
+
additional_properties: struct
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Serialize an instance of DeleteTenantsResponse 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.deleted.is_a?(Array) != false || raise("Passed value for field obj.deleted 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
|
|
@@ -72,8 +72,8 @@ module TrophyApiClient
|
|
|
72
72
|
# type. Null for one-time leaderboards.
|
|
73
73
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
74
74
|
# @return [TrophyApiClient::LeaderboardResponse]
|
|
75
|
-
def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:,
|
|
76
|
-
metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, end_: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
|
|
75
|
+
def initialize(id:, name:, key:, rank_by:, breakdown_attributes:, start:, breakdown_attribute: OMIT, metric_key: OMIT,
|
|
76
|
+
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)
|
|
77
77
|
@id = id
|
|
78
78
|
@name = name
|
|
79
79
|
@key = key
|
|
@@ -87,7 +87,7 @@ module TrophyApiClient
|
|
|
87
87
|
@description = description if description != OMIT
|
|
88
88
|
@start = start
|
|
89
89
|
@end_ = end_ if end_ != OMIT
|
|
90
|
-
@max_participants = max_participants
|
|
90
|
+
@max_participants = max_participants if max_participants != OMIT
|
|
91
91
|
@run_unit = run_unit if run_unit != OMIT
|
|
92
92
|
@run_interval = run_interval if run_interval != OMIT
|
|
93
93
|
@additional_properties = additional_properties
|
|
@@ -184,7 +184,7 @@ module TrophyApiClient
|
|
|
184
184
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
185
185
|
obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
|
186
186
|
obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
|
187
|
-
obj.max_participants
|
|
187
|
+
obj.max_participants&.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
|
|
188
188
|
obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
|
|
189
189
|
obj.run_interval&.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
|
|
190
190
|
end
|
|
@@ -79,8 +79,8 @@ module TrophyApiClient
|
|
|
79
79
|
# type. Null for one-time leaderboards.
|
|
80
80
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
81
81
|
# @return [TrophyApiClient::LeaderboardResponseWithRankings]
|
|
82
|
-
def initialize(status:, rankings:, id:, name:, key:, rank_by:, breakdown_attributes:, start:,
|
|
83
|
-
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)
|
|
82
|
+
def initialize(status:, rankings:, id:, name:, key:, rank_by:, breakdown_attributes:, start:, breakdown_attribute: OMIT,
|
|
83
|
+
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)
|
|
84
84
|
@status = status
|
|
85
85
|
@rankings = rankings
|
|
86
86
|
@id = id
|
|
@@ -96,7 +96,7 @@ module TrophyApiClient
|
|
|
96
96
|
@description = description if description != OMIT
|
|
97
97
|
@start = start
|
|
98
98
|
@end_ = end_ if end_ != OMIT
|
|
99
|
-
@max_participants = max_participants
|
|
99
|
+
@max_participants = max_participants if max_participants != OMIT
|
|
100
100
|
@run_unit = run_unit if run_unit != OMIT
|
|
101
101
|
@run_interval = run_interval if run_interval != OMIT
|
|
102
102
|
@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
|
|
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
|
|
@@ -97,8 +97,8 @@ module TrophyApiClient
|
|
|
97
97
|
# type. Null for one-time leaderboards.
|
|
98
98
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
99
99
|
# @return [TrophyApiClient::MetricEventLeaderboardResponse]
|
|
100
|
-
def initialize(threshold:, id:, name:, key:, rank_by:, breakdown_attributes:, start:,
|
|
101
|
-
breakdown_attribute_values: OMIT, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
|
|
100
|
+
def initialize(threshold:, id:, name:, key:, rank_by:, breakdown_attributes:, start:, end_: OMIT, rank: OMIT, previous_rank: OMIT, breakdown_attribute_value: OMIT,
|
|
101
|
+
breakdown_attribute_values: OMIT, breakdown_attribute: OMIT, metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, max_participants: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
|
|
102
102
|
@end_ = end_ if end_ != OMIT
|
|
103
103
|
@rank = rank if rank != OMIT
|
|
104
104
|
@previous_rank = previous_rank if previous_rank != OMIT
|
|
@@ -117,7 +117,7 @@ module TrophyApiClient
|
|
|
117
117
|
@points_system_name = points_system_name if points_system_name != OMIT
|
|
118
118
|
@description = description if description != OMIT
|
|
119
119
|
@start = start
|
|
120
|
-
@max_participants = max_participants
|
|
120
|
+
@max_participants = max_participants if max_participants != OMIT
|
|
121
121
|
@run_unit = run_unit if run_unit != OMIT
|
|
122
122
|
@run_interval = run_interval if run_interval != OMIT
|
|
123
123
|
@additional_properties = additional_properties
|
|
@@ -237,7 +237,7 @@ module TrophyApiClient
|
|
|
237
237
|
obj.points_system_name&.is_a?(String) != false || raise("Passed value for field obj.points_system_name is not the expected type, validation failed.")
|
|
238
238
|
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
239
239
|
obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
|
240
|
-
obj.max_participants
|
|
240
|
+
obj.max_participants&.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
|
|
241
241
|
obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
|
|
242
242
|
obj.run_interval&.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
|
|
243
243
|
end
|