trophy_api_client 1.3.4 → 1.4.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/points/boosts/client.rb +13 -11
- data/lib/trophy_api_client/admin/streaks/client.rb +10 -6
- data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -2
- data/lib/trophy_api_client/types/admin_issue.rb +98 -0
- data/lib/trophy_api_client/types/{bulk_insert_issue_level.rb → admin_issue_severity.rb} +1 -1
- data/lib/trophy_api_client/types/create_points_boosts_response.rb +4 -4
- data/lib/trophy_api_client/types/create_streak_freezes_response.rb +4 -4
- data/lib/trophy_api_client/types/delete_points_boosts_response.rb +75 -0
- data/lib/trophy_api_client/types/{archive_points_boosts_response.rb → deleted_resource.rb} +15 -15
- data/lib/trophy_api_client/types/restore_streaks_response.rb +4 -4
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +4 -3
- metadata +5 -4
- data/lib/trophy_api_client/types/bulk_insert_issue.rb +0 -74
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7604c5f6f0a271ed7eae0b4878f29932ba518ac374f61c0854a4c5afb5a58c6d
|
|
4
|
+
data.tar.gz: 5b8a86b550c0aba78eb4edae772cfd3799f4108727eb2acac4770e9358fc7c41
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f31395b433ab72efbd23a45a2e8dbda31c6ba589841e2d3eae7260f5744831948f3460d810cce0e91035c87ac112e47b1abbddc78b5ea9360c745169d364a61f
|
|
7
|
+
data.tar.gz: 92f5324cb1d892cacdda6303f7617d52e70eb17a3e41df09c93041dc90437eefd9637911fe3da12bc70e31e481c09800845c268084eb9bce03d195920959fae0
|
data/lib/gemconfig.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require_relative "../../../../requests"
|
|
4
4
|
require_relative "types/create_points_boosts_request_boosts_item"
|
|
5
5
|
require_relative "../../../types/create_points_boosts_response"
|
|
6
|
-
require_relative "../../../types/
|
|
6
|
+
require_relative "../../../types/delete_points_boosts_response"
|
|
7
7
|
require "async"
|
|
8
8
|
|
|
9
9
|
module TrophyApiClient
|
|
@@ -22,7 +22,7 @@ module TrophyApiClient
|
|
|
22
22
|
# Create points boosts for multiple users.
|
|
23
23
|
#
|
|
24
24
|
# @param system_key [String] The key of the points system to create boosts for.
|
|
25
|
-
# @param boosts [Array<Hash>] Array of boosts to create. Maximum
|
|
25
|
+
# @param boosts [Array<Hash>] Array of boosts to create. Maximum 100 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
|
|
26
26
|
# * :user_id (String)
|
|
27
27
|
# * :name (String)
|
|
28
28
|
# * :start (String)
|
|
@@ -64,7 +64,7 @@ module TrophyApiClient
|
|
|
64
64
|
#
|
|
65
65
|
# @param ids [String] A list of up to 100 boost IDs.
|
|
66
66
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
67
|
-
# @return [TrophyApiClient::
|
|
67
|
+
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
68
68
|
# @example
|
|
69
69
|
# api = TrophyApiClient::Client.new(
|
|
70
70
|
# base_url: "https://api.example.com",
|
|
@@ -87,14 +87,14 @@ module TrophyApiClient
|
|
|
87
87
|
end
|
|
88
88
|
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/points/boosts"
|
|
89
89
|
end
|
|
90
|
-
TrophyApiClient::
|
|
90
|
+
TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
# Archive a points boost by ID.
|
|
94
94
|
#
|
|
95
95
|
# @param id [String] The UUID of the points boost to archive
|
|
96
96
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
97
|
-
# @return [
|
|
97
|
+
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
98
98
|
# @example
|
|
99
99
|
# api = TrophyApiClient::Client.new(
|
|
100
100
|
# base_url: "https://api.example.com",
|
|
@@ -103,7 +103,7 @@ module TrophyApiClient
|
|
|
103
103
|
# )
|
|
104
104
|
# api.admin.points.boosts.archive(id: "id")
|
|
105
105
|
def archive(id:, request_options: nil)
|
|
106
|
-
@request_client.conn.delete do |req|
|
|
106
|
+
response = @request_client.conn.delete do |req|
|
|
107
107
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
108
108
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
109
109
|
req.headers = {
|
|
@@ -120,6 +120,7 @@ module TrophyApiClient
|
|
|
120
120
|
req.url "#{@request_client.get_url(environment: admin,
|
|
121
121
|
request_options: request_options)}/points/boosts/#{id}"
|
|
122
122
|
end
|
|
123
|
+
TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
|
|
123
124
|
end
|
|
124
125
|
end
|
|
125
126
|
|
|
@@ -136,7 +137,7 @@ module TrophyApiClient
|
|
|
136
137
|
# Create points boosts for multiple users.
|
|
137
138
|
#
|
|
138
139
|
# @param system_key [String] The key of the points system to create boosts for.
|
|
139
|
-
# @param boosts [Array<Hash>] Array of boosts to create. Maximum
|
|
140
|
+
# @param boosts [Array<Hash>] Array of boosts to create. Maximum 100 boosts per request.Request of type Array<TrophyApiClient::Admin::Points::Boosts::CreatePointsBoostsRequestBoostsItem>, as a Hash
|
|
140
141
|
# * :user_id (String)
|
|
141
142
|
# * :name (String)
|
|
142
143
|
# * :start (String)
|
|
@@ -180,7 +181,7 @@ module TrophyApiClient
|
|
|
180
181
|
#
|
|
181
182
|
# @param ids [String] A list of up to 100 boost IDs.
|
|
182
183
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
183
|
-
# @return [TrophyApiClient::
|
|
184
|
+
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
184
185
|
# @example
|
|
185
186
|
# api = TrophyApiClient::Client.new(
|
|
186
187
|
# base_url: "https://api.example.com",
|
|
@@ -204,7 +205,7 @@ module TrophyApiClient
|
|
|
204
205
|
end
|
|
205
206
|
req.url "#{@request_client.get_url(environment: admin, request_options: request_options)}/points/boosts"
|
|
206
207
|
end
|
|
207
|
-
TrophyApiClient::
|
|
208
|
+
TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
|
|
208
209
|
end
|
|
209
210
|
end
|
|
210
211
|
|
|
@@ -212,7 +213,7 @@ module TrophyApiClient
|
|
|
212
213
|
#
|
|
213
214
|
# @param id [String] The UUID of the points boost to archive
|
|
214
215
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
215
|
-
# @return [
|
|
216
|
+
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
216
217
|
# @example
|
|
217
218
|
# api = TrophyApiClient::Client.new(
|
|
218
219
|
# base_url: "https://api.example.com",
|
|
@@ -222,7 +223,7 @@ module TrophyApiClient
|
|
|
222
223
|
# api.admin.points.boosts.archive(id: "id")
|
|
223
224
|
def archive(id:, request_options: nil)
|
|
224
225
|
Async do
|
|
225
|
-
@request_client.conn.delete do |req|
|
|
226
|
+
response = @request_client.conn.delete do |req|
|
|
226
227
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
227
228
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
228
229
|
req.headers = {
|
|
@@ -239,6 +240,7 @@ module TrophyApiClient
|
|
|
239
240
|
req.url "#{@request_client.get_url(environment: admin,
|
|
240
241
|
request_options: request_options)}/points/boosts/#{id}"
|
|
241
242
|
end
|
|
243
|
+
TrophyApiClient::DeletePointsBoostsResponse.from_json(json_object: response.body)
|
|
242
244
|
end
|
|
243
245
|
end
|
|
244
246
|
end
|
|
@@ -17,9 +17,11 @@ module TrophyApiClient
|
|
|
17
17
|
@request_client = request_client
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# Restore streaks for multiple users to the maximum
|
|
21
|
-
#
|
|
22
|
-
#
|
|
20
|
+
# Restore streaks for multiple users to the maximum previously achieved streak
|
|
21
|
+
# length found within the current restore window: the last 90 days for daily
|
|
22
|
+
# streaks, weekly periods starting with the week containing the start of the
|
|
23
|
+
# current calendar year for weekly streaks, and monthly periods starting at the
|
|
24
|
+
# beginning of the previous calendar year for monthly streaks.
|
|
23
25
|
#
|
|
24
26
|
# @param users [Array<Hash>] Array of users to restore streaks for. Maximum 100 users per request.Request of type Array<TrophyApiClient::Admin::Streaks::RestoreStreaksRequestUsersItem>, as a Hash
|
|
25
27
|
# * :id (String)
|
|
@@ -61,9 +63,11 @@ module TrophyApiClient
|
|
|
61
63
|
@request_client = request_client
|
|
62
64
|
end
|
|
63
65
|
|
|
64
|
-
# Restore streaks for multiple users to the maximum
|
|
65
|
-
#
|
|
66
|
-
#
|
|
66
|
+
# Restore streaks for multiple users to the maximum previously achieved streak
|
|
67
|
+
# length found within the current restore window: the last 90 days for daily
|
|
68
|
+
# streaks, weekly periods starting with the week containing the start of the
|
|
69
|
+
# current calendar year for weekly streaks, and monthly periods starting at the
|
|
70
|
+
# beginning of the previous calendar year for monthly streaks.
|
|
67
71
|
#
|
|
68
72
|
# @param users [Array<Hash>] Array of users to restore streaks for. Maximum 100 users per request.Request of type Array<TrophyApiClient::Admin::Streaks::RestoreStreaksRequestUsersItem>, as a Hash
|
|
69
73
|
# * :id (String)
|
|
@@ -20,7 +20,7 @@ module TrophyApiClient
|
|
|
20
20
|
|
|
21
21
|
# Create streak freezes for multiple users.
|
|
22
22
|
#
|
|
23
|
-
# @param freezes [Array<Hash>] Array of freezes to create. Maximum
|
|
23
|
+
# @param freezes [Array<Hash>] Array of freezes to create. Maximum 100 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
|
|
24
24
|
# * :user_id (String)
|
|
25
25
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
26
26
|
# @return [TrophyApiClient::CreateStreakFreezesResponse]
|
|
@@ -62,7 +62,7 @@ module TrophyApiClient
|
|
|
62
62
|
|
|
63
63
|
# Create streak freezes for multiple users.
|
|
64
64
|
#
|
|
65
|
-
# @param freezes [Array<Hash>] Array of freezes to create. Maximum
|
|
65
|
+
# @param freezes [Array<Hash>] Array of freezes to create. Maximum 100 freezes per request.Request of type Array<TrophyApiClient::Admin::Streaks::Freezes::CreateStreakFreezesRequestFreezesItem>, as a Hash
|
|
66
66
|
# * :user_id (String)
|
|
67
67
|
# @param request_options [TrophyApiClient::RequestOptions]
|
|
68
68
|
# @return [TrophyApiClient::CreateStreakFreezesResponse]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "admin_issue_severity"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module TrophyApiClient
|
|
8
|
+
# An issue encountered while processing an item in an admin API request.
|
|
9
|
+
class AdminIssue
|
|
10
|
+
# @return [String] The ID of the user the issue relates to, when applicable.
|
|
11
|
+
attr_reader :user_id
|
|
12
|
+
# @return [String] The ID of the points boost the issue relates to, when applicable.
|
|
13
|
+
attr_reader :boost_id
|
|
14
|
+
# @return [Integer] The zero-based index of the item the issue relates to, when no resource ID
|
|
15
|
+
# exists yet.
|
|
16
|
+
attr_reader :index
|
|
17
|
+
# @return [TrophyApiClient::AdminIssueSeverity] The severity level of the issue.
|
|
18
|
+
attr_reader :severity
|
|
19
|
+
# @return [String] A human-readable description of the issue.
|
|
20
|
+
attr_reader :message
|
|
21
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
22
|
+
attr_reader :additional_properties
|
|
23
|
+
# @return [Object]
|
|
24
|
+
attr_reader :_field_set
|
|
25
|
+
protected :_field_set
|
|
26
|
+
|
|
27
|
+
OMIT = Object.new
|
|
28
|
+
|
|
29
|
+
# @param user_id [String] The ID of the user the issue relates to, when applicable.
|
|
30
|
+
# @param boost_id [String] The ID of the points boost the issue relates to, when applicable.
|
|
31
|
+
# @param index [Integer] The zero-based index of the item the issue relates to, when no resource ID
|
|
32
|
+
# exists yet.
|
|
33
|
+
# @param severity [TrophyApiClient::AdminIssueSeverity] The severity level of the issue.
|
|
34
|
+
# @param message [String] A human-readable description of the issue.
|
|
35
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
36
|
+
# @return [TrophyApiClient::AdminIssue]
|
|
37
|
+
def initialize(severity:, message:, user_id: OMIT, boost_id: OMIT, index: OMIT, additional_properties: nil)
|
|
38
|
+
@user_id = user_id if user_id != OMIT
|
|
39
|
+
@boost_id = boost_id if boost_id != OMIT
|
|
40
|
+
@index = index if index != OMIT
|
|
41
|
+
@severity = severity
|
|
42
|
+
@message = message
|
|
43
|
+
@additional_properties = additional_properties
|
|
44
|
+
@_field_set = {
|
|
45
|
+
"userId": user_id,
|
|
46
|
+
"boostId": boost_id,
|
|
47
|
+
"index": index,
|
|
48
|
+
"severity": severity,
|
|
49
|
+
"message": message
|
|
50
|
+
}.reject do |_k, v|
|
|
51
|
+
v == OMIT
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Deserialize a JSON object to an instance of AdminIssue
|
|
56
|
+
#
|
|
57
|
+
# @param json_object [String]
|
|
58
|
+
# @return [TrophyApiClient::AdminIssue]
|
|
59
|
+
def self.from_json(json_object:)
|
|
60
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
61
|
+
parsed_json = JSON.parse(json_object)
|
|
62
|
+
user_id = parsed_json["userId"]
|
|
63
|
+
boost_id = parsed_json["boostId"]
|
|
64
|
+
index = parsed_json["index"]
|
|
65
|
+
severity = parsed_json["severity"]
|
|
66
|
+
message = parsed_json["message"]
|
|
67
|
+
new(
|
|
68
|
+
user_id: user_id,
|
|
69
|
+
boost_id: boost_id,
|
|
70
|
+
index: index,
|
|
71
|
+
severity: severity,
|
|
72
|
+
message: message,
|
|
73
|
+
additional_properties: struct
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Serialize an instance of AdminIssue to a JSON object
|
|
78
|
+
#
|
|
79
|
+
# @return [String]
|
|
80
|
+
def to_json(*_args)
|
|
81
|
+
@_field_set&.to_json
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
85
|
+
# hash and check each fields type against the current object's property
|
|
86
|
+
# definitions.
|
|
87
|
+
#
|
|
88
|
+
# @param obj [Object]
|
|
89
|
+
# @return [Void]
|
|
90
|
+
def self.validate_raw(obj:)
|
|
91
|
+
obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
|
|
92
|
+
obj.boost_id&.is_a?(String) != false || raise("Passed value for field obj.boost_id is not the expected type, validation failed.")
|
|
93
|
+
obj.index&.is_a?(Integer) != false || raise("Passed value for field obj.index is not the expected type, validation failed.")
|
|
94
|
+
obj.severity.is_a?(TrophyApiClient::AdminIssueSeverity) != false || raise("Passed value for field obj.severity is not the expected type, validation failed.")
|
|
95
|
+
obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "created_points_boost"
|
|
4
|
-
require_relative "
|
|
4
|
+
require_relative "admin_issue"
|
|
5
5
|
require "ostruct"
|
|
6
6
|
require "json"
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ module TrophyApiClient
|
|
|
11
11
|
class CreatePointsBoostsResponse
|
|
12
12
|
# @return [Array<TrophyApiClient::CreatedPointsBoost>] Array of successfully created boosts.
|
|
13
13
|
attr_reader :created
|
|
14
|
-
# @return [Array<TrophyApiClient::
|
|
14
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
|
|
15
15
|
attr_reader :issues
|
|
16
16
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
17
|
attr_reader :additional_properties
|
|
@@ -22,7 +22,7 @@ module TrophyApiClient
|
|
|
22
22
|
OMIT = Object.new
|
|
23
23
|
|
|
24
24
|
# @param created [Array<TrophyApiClient::CreatedPointsBoost>] Array of successfully created boosts.
|
|
25
|
-
# @param issues [Array<TrophyApiClient::
|
|
25
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
|
|
26
26
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
27
|
# @return [TrophyApiClient::CreatePointsBoostsResponse]
|
|
28
28
|
def initialize(created:, issues:, additional_properties: nil)
|
|
@@ -45,7 +45,7 @@ module TrophyApiClient
|
|
|
45
45
|
end
|
|
46
46
|
issues = parsed_json["issues"]&.map do |item|
|
|
47
47
|
item = item.to_json
|
|
48
|
-
TrophyApiClient::
|
|
48
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
49
49
|
end
|
|
50
50
|
new(
|
|
51
51
|
created: created,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "
|
|
3
|
+
require_relative "admin_issue"
|
|
4
4
|
require "ostruct"
|
|
5
5
|
require "json"
|
|
6
6
|
|
|
7
7
|
module TrophyApiClient
|
|
8
8
|
# Response containing any issues encountered while creating streak freezes.
|
|
9
9
|
class CreateStreakFreezesResponse
|
|
10
|
-
# @return [Array<TrophyApiClient::
|
|
10
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during freeze creation.
|
|
11
11
|
attr_reader :issues
|
|
12
12
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
13
13
|
attr_reader :additional_properties
|
|
@@ -17,7 +17,7 @@ module TrophyApiClient
|
|
|
17
17
|
|
|
18
18
|
OMIT = Object.new
|
|
19
19
|
|
|
20
|
-
# @param issues [Array<TrophyApiClient::
|
|
20
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during freeze creation.
|
|
21
21
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
22
22
|
# @return [TrophyApiClient::CreateStreakFreezesResponse]
|
|
23
23
|
def initialize(issues:, additional_properties: nil)
|
|
@@ -35,7 +35,7 @@ module TrophyApiClient
|
|
|
35
35
|
parsed_json = JSON.parse(json_object)
|
|
36
36
|
issues = parsed_json["issues"]&.map do |item|
|
|
37
37
|
item = item.to_json
|
|
38
|
-
TrophyApiClient::
|
|
38
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
39
39
|
end
|
|
40
40
|
new(issues: issues, additional_properties: struct)
|
|
41
41
|
end
|
|
@@ -0,0 +1,75 @@
|
|
|
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 the points boosts that were archived and any per-item
|
|
10
|
+
# issues.
|
|
11
|
+
class DeletePointsBoostsResponse
|
|
12
|
+
# @return [Array<TrophyApiClient::DeletedResource>] Array of archived points boosts represented by ID.
|
|
13
|
+
attr_reader :deleted
|
|
14
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost archival.
|
|
15
|
+
attr_reader :issues
|
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
|
+
attr_reader :additional_properties
|
|
18
|
+
# @return [Object]
|
|
19
|
+
attr_reader :_field_set
|
|
20
|
+
protected :_field_set
|
|
21
|
+
|
|
22
|
+
OMIT = Object.new
|
|
23
|
+
|
|
24
|
+
# @param deleted [Array<TrophyApiClient::DeletedResource>] Array of archived points boosts represented by ID.
|
|
25
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost archival.
|
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
|
+
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
28
|
+
def initialize(deleted:, issues:, additional_properties: nil)
|
|
29
|
+
@deleted = deleted
|
|
30
|
+
@issues = issues
|
|
31
|
+
@additional_properties = additional_properties
|
|
32
|
+
@_field_set = { "deleted": deleted, "issues": issues }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Deserialize a JSON object to an instance of DeletePointsBoostsResponse
|
|
36
|
+
#
|
|
37
|
+
# @param json_object [String]
|
|
38
|
+
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
39
|
+
def self.from_json(json_object:)
|
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
41
|
+
parsed_json = JSON.parse(json_object)
|
|
42
|
+
deleted = parsed_json["deleted"]&.map do |item|
|
|
43
|
+
item = item.to_json
|
|
44
|
+
TrophyApiClient::DeletedResource.from_json(json_object: item)
|
|
45
|
+
end
|
|
46
|
+
issues = parsed_json["issues"]&.map do |item|
|
|
47
|
+
item = item.to_json
|
|
48
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
49
|
+
end
|
|
50
|
+
new(
|
|
51
|
+
deleted: deleted,
|
|
52
|
+
issues: issues,
|
|
53
|
+
additional_properties: struct
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Serialize an instance of DeletePointsBoostsResponse to a JSON object
|
|
58
|
+
#
|
|
59
|
+
# @return [String]
|
|
60
|
+
def to_json(*_args)
|
|
61
|
+
@_field_set&.to_json
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
65
|
+
# hash and check each fields type against the current object's property
|
|
66
|
+
# definitions.
|
|
67
|
+
#
|
|
68
|
+
# @param obj [Object]
|
|
69
|
+
# @return [Void]
|
|
70
|
+
def self.validate_raw(obj:)
|
|
71
|
+
obj.deleted.is_a?(Array) != false || raise("Passed value for field obj.deleted is not the expected type, validation failed.")
|
|
72
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -4,10 +4,10 @@ require "ostruct"
|
|
|
4
4
|
require "json"
|
|
5
5
|
|
|
6
6
|
module TrophyApiClient
|
|
7
|
-
#
|
|
8
|
-
class
|
|
9
|
-
# @return [
|
|
10
|
-
attr_reader :
|
|
7
|
+
# A soft-deleted resource represented by ID.
|
|
8
|
+
class DeletedResource
|
|
9
|
+
# @return [String] The ID of the archived resource.
|
|
10
|
+
attr_reader :id
|
|
11
11
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
12
12
|
attr_reader :additional_properties
|
|
13
13
|
# @return [Object]
|
|
@@ -16,27 +16,27 @@ module TrophyApiClient
|
|
|
16
16
|
|
|
17
17
|
OMIT = Object.new
|
|
18
18
|
|
|
19
|
-
# @param
|
|
19
|
+
# @param id [String] The ID of the archived resource.
|
|
20
20
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
|
-
# @return [TrophyApiClient::
|
|
22
|
-
def initialize(
|
|
23
|
-
@
|
|
21
|
+
# @return [TrophyApiClient::DeletedResource]
|
|
22
|
+
def initialize(id:, additional_properties: nil)
|
|
23
|
+
@id = id
|
|
24
24
|
@additional_properties = additional_properties
|
|
25
|
-
@_field_set = { "
|
|
25
|
+
@_field_set = { "id": id }
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
# Deserialize a JSON object to an instance of
|
|
28
|
+
# Deserialize a JSON object to an instance of DeletedResource
|
|
29
29
|
#
|
|
30
30
|
# @param json_object [String]
|
|
31
|
-
# @return [TrophyApiClient::
|
|
31
|
+
# @return [TrophyApiClient::DeletedResource]
|
|
32
32
|
def self.from_json(json_object:)
|
|
33
33
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
34
34
|
parsed_json = JSON.parse(json_object)
|
|
35
|
-
|
|
36
|
-
new(
|
|
35
|
+
id = parsed_json["id"]
|
|
36
|
+
new(id: id, additional_properties: struct)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
# Serialize an instance of
|
|
39
|
+
# Serialize an instance of DeletedResource to a JSON object
|
|
40
40
|
#
|
|
41
41
|
# @return [String]
|
|
42
42
|
def to_json(*_args)
|
|
@@ -50,7 +50,7 @@ module TrophyApiClient
|
|
|
50
50
|
# @param obj [Object]
|
|
51
51
|
# @return [Void]
|
|
52
52
|
def self.validate_raw(obj:)
|
|
53
|
-
obj.
|
|
53
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "
|
|
3
|
+
require_relative "admin_issue"
|
|
4
4
|
require "ostruct"
|
|
5
5
|
require "json"
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ module TrophyApiClient
|
|
|
9
9
|
class RestoreStreaksResponse
|
|
10
10
|
# @return [Array<String>] Array of user IDs whose streaks were successfully restored.
|
|
11
11
|
attr_reader :restored_users
|
|
12
|
-
# @return [Array<TrophyApiClient::
|
|
12
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during streak restoration.
|
|
13
13
|
attr_reader :issues
|
|
14
14
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
15
15
|
attr_reader :additional_properties
|
|
@@ -20,7 +20,7 @@ module TrophyApiClient
|
|
|
20
20
|
OMIT = Object.new
|
|
21
21
|
|
|
22
22
|
# @param restored_users [Array<String>] Array of user IDs whose streaks were successfully restored.
|
|
23
|
-
# @param issues [Array<TrophyApiClient::
|
|
23
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during streak restoration.
|
|
24
24
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
25
25
|
# @return [TrophyApiClient::RestoreStreaksResponse]
|
|
26
26
|
def initialize(restored_users:, issues:, additional_properties: nil)
|
|
@@ -40,7 +40,7 @@ module TrophyApiClient
|
|
|
40
40
|
restored_users = parsed_json["restoredUsers"]
|
|
41
41
|
issues = parsed_json["issues"]&.map do |item|
|
|
42
42
|
item = item.to_json
|
|
43
|
-
TrophyApiClient::
|
|
43
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
44
44
|
end
|
|
45
45
|
new(
|
|
46
46
|
restored_users: restored_users,
|
data/lib/types_export.rb
CHANGED
|
@@ -94,10 +94,11 @@ require_relative "trophy_api_client/types/created_points_boost_status"
|
|
|
94
94
|
require_relative "trophy_api_client/types/created_points_boost_rounding"
|
|
95
95
|
require_relative "trophy_api_client/types/created_points_boost"
|
|
96
96
|
require_relative "trophy_api_client/types/create_points_boosts_response"
|
|
97
|
-
require_relative "trophy_api_client/types/
|
|
97
|
+
require_relative "trophy_api_client/types/delete_points_boosts_response"
|
|
98
98
|
require_relative "trophy_api_client/types/restore_streaks_response"
|
|
99
|
-
require_relative "trophy_api_client/types/
|
|
100
|
-
require_relative "trophy_api_client/types/
|
|
99
|
+
require_relative "trophy_api_client/types/admin_issue_severity"
|
|
100
|
+
require_relative "trophy_api_client/types/admin_issue"
|
|
101
|
+
require_relative "trophy_api_client/types/deleted_resource"
|
|
101
102
|
require_relative "trophy_api_client/types/wrapped_metric_by_attribute_value_value"
|
|
102
103
|
require_relative "trophy_api_client/types/wrapped_metric"
|
|
103
104
|
require_relative "trophy_api_client/types/wrapped_points"
|
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.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Trophy Labs, Inc
|
|
@@ -123,10 +123,9 @@ files:
|
|
|
123
123
|
- lib/trophy_api_client/types/achievement_response_trigger.rb
|
|
124
124
|
- lib/trophy_api_client/types/achievement_response_user_attributes_item.rb
|
|
125
125
|
- lib/trophy_api_client/types/achievement_with_stats_response.rb
|
|
126
|
-
- lib/trophy_api_client/types/
|
|
126
|
+
- lib/trophy_api_client/types/admin_issue.rb
|
|
127
|
+
- lib/trophy_api_client/types/admin_issue_severity.rb
|
|
127
128
|
- lib/trophy_api_client/types/base_streak_response.rb
|
|
128
|
-
- lib/trophy_api_client/types/bulk_insert_issue.rb
|
|
129
|
-
- lib/trophy_api_client/types/bulk_insert_issue_level.rb
|
|
130
129
|
- lib/trophy_api_client/types/bulk_streak_response.rb
|
|
131
130
|
- lib/trophy_api_client/types/bulk_streak_response_item.rb
|
|
132
131
|
- lib/trophy_api_client/types/create_points_boosts_response.rb
|
|
@@ -134,6 +133,8 @@ files:
|
|
|
134
133
|
- lib/trophy_api_client/types/created_points_boost.rb
|
|
135
134
|
- lib/trophy_api_client/types/created_points_boost_rounding.rb
|
|
136
135
|
- lib/trophy_api_client/types/created_points_boost_status.rb
|
|
136
|
+
- lib/trophy_api_client/types/delete_points_boosts_response.rb
|
|
137
|
+
- lib/trophy_api_client/types/deleted_resource.rb
|
|
137
138
|
- lib/trophy_api_client/types/error_body.rb
|
|
138
139
|
- lib/trophy_api_client/types/event_response.rb
|
|
139
140
|
- lib/trophy_api_client/types/get_user_points_response.rb
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "bulk_insert_issue_level"
|
|
4
|
-
require "ostruct"
|
|
5
|
-
require "json"
|
|
6
|
-
|
|
7
|
-
module TrophyApiClient
|
|
8
|
-
# An issue encountered while bulk inserting data.
|
|
9
|
-
class BulkInsertIssue
|
|
10
|
-
# @return [String] The ID of the user the issue relates to.
|
|
11
|
-
attr_reader :user_id
|
|
12
|
-
# @return [TrophyApiClient::BulkInsertIssueLevel] The severity level of the issue.
|
|
13
|
-
attr_reader :level
|
|
14
|
-
# @return [String] A human-readable description of the issue.
|
|
15
|
-
attr_reader :reason
|
|
16
|
-
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
|
-
attr_reader :additional_properties
|
|
18
|
-
# @return [Object]
|
|
19
|
-
attr_reader :_field_set
|
|
20
|
-
protected :_field_set
|
|
21
|
-
|
|
22
|
-
OMIT = Object.new
|
|
23
|
-
|
|
24
|
-
# @param user_id [String] The ID of the user the issue relates to.
|
|
25
|
-
# @param level [TrophyApiClient::BulkInsertIssueLevel] The severity level of the issue.
|
|
26
|
-
# @param reason [String] A human-readable description of the issue.
|
|
27
|
-
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
28
|
-
# @return [TrophyApiClient::BulkInsertIssue]
|
|
29
|
-
def initialize(user_id:, level:, reason:, additional_properties: nil)
|
|
30
|
-
@user_id = user_id
|
|
31
|
-
@level = level
|
|
32
|
-
@reason = reason
|
|
33
|
-
@additional_properties = additional_properties
|
|
34
|
-
@_field_set = { "userId": user_id, "level": level, "reason": reason }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Deserialize a JSON object to an instance of BulkInsertIssue
|
|
38
|
-
#
|
|
39
|
-
# @param json_object [String]
|
|
40
|
-
# @return [TrophyApiClient::BulkInsertIssue]
|
|
41
|
-
def self.from_json(json_object:)
|
|
42
|
-
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
43
|
-
parsed_json = JSON.parse(json_object)
|
|
44
|
-
user_id = parsed_json["userId"]
|
|
45
|
-
level = parsed_json["level"]
|
|
46
|
-
reason = parsed_json["reason"]
|
|
47
|
-
new(
|
|
48
|
-
user_id: user_id,
|
|
49
|
-
level: level,
|
|
50
|
-
reason: reason,
|
|
51
|
-
additional_properties: struct
|
|
52
|
-
)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Serialize an instance of BulkInsertIssue to a JSON object
|
|
56
|
-
#
|
|
57
|
-
# @return [String]
|
|
58
|
-
def to_json(*_args)
|
|
59
|
-
@_field_set&.to_json
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
63
|
-
# hash and check each fields type against the current object's property
|
|
64
|
-
# definitions.
|
|
65
|
-
#
|
|
66
|
-
# @param obj [Object]
|
|
67
|
-
# @return [Void]
|
|
68
|
-
def self.validate_raw(obj:)
|
|
69
|
-
obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
|
|
70
|
-
obj.level.is_a?(TrophyApiClient::BulkInsertIssueLevel) != false || raise("Passed value for field obj.level is not the expected type, validation failed.")
|
|
71
|
-
obj.reason.is_a?(String) != false || raise("Passed value for field obj.reason is not the expected type, validation failed.")
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|