trophy_api_client 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/admin/attributes/client.rb +368 -0
- data/lib/trophy_api_client/admin/client.rb +21 -0
- data/lib/trophy_api_client/admin/leaderboards/client.rb +371 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +366 -0
- data/lib/trophy_api_client/types/admin_attribute.rb +81 -0
- data/lib/trophy_api_client/types/admin_attribute_type.rb +9 -0
- data/lib/trophy_api_client/types/admin_leaderboard.rb +171 -0
- data/lib/trophy_api_client/types/admin_leaderboard_rank_by.rb +10 -0
- data/lib/trophy_api_client/types/admin_leaderboard_run_unit.rb +10 -0
- data/lib/trophy_api_client/types/admin_leaderboard_status.rb +11 -0
- data/lib/trophy_api_client/types/create_attribute_request_item.rb +76 -0
- data/lib/trophy_api_client/types/create_attribute_request_item_type.rb +9 -0
- data/lib/trophy_api_client/types/create_attributes_request.rb +7 -0
- data/lib/trophy_api_client/types/create_attributes_response.rb +74 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item.rb +171 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_rank_by.rb +10 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_run_unit.rb +11 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_status.rb +13 -0
- data/lib/trophy_api_client/types/create_leaderboards_request.rb +7 -0
- data/lib/trophy_api_client/types/create_leaderboards_response.rb +74 -0
- data/lib/trophy_api_client/types/create_metric_request_item.rb +87 -0
- data/lib/trophy_api_client/types/create_metric_request_item_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/create_metrics_request.rb +7 -0
- data/lib/trophy_api_client/types/create_metrics_response.rb +74 -0
- data/lib/trophy_api_client/types/created_metric.rb +88 -0
- data/lib/trophy_api_client/types/created_metric_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/delete_attributes_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_metrics_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_points_boosts_response.rb +2 -2
- data/lib/trophy_api_client/types/list_attributes_response.rb +7 -0
- data/lib/trophy_api_client/types/list_leaderboards_response.rb +7 -0
- data/lib/trophy_api_client/types/list_metrics_response.rb +7 -0
- data/lib/trophy_api_client/types/metric_response.rb +2 -17
- data/lib/trophy_api_client/types/update_attribute_request_item.rb +69 -0
- data/lib/trophy_api_client/types/update_attributes_request.rb +7 -0
- data/lib/trophy_api_client/types/update_attributes_response.rb +75 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item.rb +179 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_rank_by.rb +11 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_run_unit.rb +9 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_status.rb +12 -0
- data/lib/trophy_api_client/types/update_leaderboards_request.rb +7 -0
- data/lib/trophy_api_client/types/update_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/update_metric_request_item.rb +86 -0
- data/lib/trophy_api_client/types/update_metric_request_item_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/update_metrics_request.rb +7 -0
- data/lib/trophy_api_client/types/update_metrics_response.rb +75 -0
- data/lib/trophy_api_client/users/client.rb +2 -2
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +51 -12
- metadata +45 -3
- data/lib/trophy_api_client/types/metric_status.rb +0 -9
- data/lib/trophy_api_client/types/notification_type.rb +0 -11
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "update_leaderboard_request_item_status"
|
|
4
|
+
require_relative "update_leaderboard_request_item_rank_by"
|
|
5
|
+
require_relative "update_leaderboard_request_item_run_unit"
|
|
6
|
+
require "ostruct"
|
|
7
|
+
require "json"
|
|
8
|
+
|
|
9
|
+
module TrophyApiClient
|
|
10
|
+
# A leaderboard update object. `id` is required. Once a leaderboard has been
|
|
11
|
+
# activated, the dashboard-imposed restrictions on ranking configuration and
|
|
12
|
+
# scheduling changes still apply.
|
|
13
|
+
class UpdateLeaderboardRequestItem
|
|
14
|
+
# @return [String] The UUID of the leaderboard to update.
|
|
15
|
+
attr_reader :id
|
|
16
|
+
# @return [String] The updated leaderboard name.
|
|
17
|
+
attr_reader :name
|
|
18
|
+
# @return [String] The updated leaderboard key. This can only be changed while the leaderboard is
|
|
19
|
+
# inactive.
|
|
20
|
+
attr_reader :key
|
|
21
|
+
# @return [String] The updated leaderboard description.
|
|
22
|
+
attr_reader :description
|
|
23
|
+
# @return [TrophyApiClient::UpdateLeaderboardRequestItemStatus] The target user-facing status. `scheduled` activates a leaderboard whose start
|
|
24
|
+
# date is in the future. `finished` behaves like the dashboard finish action.
|
|
25
|
+
attr_reader :status
|
|
26
|
+
# @return [TrophyApiClient::UpdateLeaderboardRequestItemRankBy] The updated ranking criterion. This can only be changed while the leaderboard is
|
|
27
|
+
# inactive.
|
|
28
|
+
attr_reader :rank_by
|
|
29
|
+
# @return [String] The metric ID to use when `rankBy` is `metric`.
|
|
30
|
+
attr_reader :metric_id
|
|
31
|
+
# @return [String] The points system ID to use when `rankBy` is `points`.
|
|
32
|
+
attr_reader :points_system_id
|
|
33
|
+
# @return [Integer] The updated maximum number of participants.
|
|
34
|
+
attr_reader :max_participants
|
|
35
|
+
# @return [String] The updated start date in YYYY-MM-DD format.
|
|
36
|
+
attr_reader :start
|
|
37
|
+
# @return [String] The updated end date in YYYY-MM-DD format, or `null` to clear it.
|
|
38
|
+
attr_reader :end_
|
|
39
|
+
# @return [Array<String>] The updated breakdown attribute UUIDs.
|
|
40
|
+
attr_reader :breakdown_attributes
|
|
41
|
+
# @return [TrophyApiClient::UpdateLeaderboardRequestItemRunUnit] The updated recurrence unit.
|
|
42
|
+
attr_reader :run_unit
|
|
43
|
+
# @return [Integer] The updated recurrence interval.
|
|
44
|
+
attr_reader :run_interval
|
|
45
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
46
|
+
attr_reader :additional_properties
|
|
47
|
+
# @return [Object]
|
|
48
|
+
attr_reader :_field_set
|
|
49
|
+
protected :_field_set
|
|
50
|
+
|
|
51
|
+
OMIT = Object.new
|
|
52
|
+
|
|
53
|
+
# @param id [String] The UUID of the leaderboard to update.
|
|
54
|
+
# @param name [String] The updated leaderboard name.
|
|
55
|
+
# @param key [String] The updated leaderboard key. This can only be changed while the leaderboard is
|
|
56
|
+
# inactive.
|
|
57
|
+
# @param description [String] The updated leaderboard description.
|
|
58
|
+
# @param status [TrophyApiClient::UpdateLeaderboardRequestItemStatus] The target user-facing status. `scheduled` activates a leaderboard whose start
|
|
59
|
+
# date is in the future. `finished` behaves like the dashboard finish action.
|
|
60
|
+
# @param rank_by [TrophyApiClient::UpdateLeaderboardRequestItemRankBy] The updated ranking criterion. This can only be changed while the leaderboard is
|
|
61
|
+
# inactive.
|
|
62
|
+
# @param metric_id [String] The metric ID to use when `rankBy` is `metric`.
|
|
63
|
+
# @param points_system_id [String] The points system ID to use when `rankBy` is `points`.
|
|
64
|
+
# @param max_participants [Integer] The updated maximum number of participants.
|
|
65
|
+
# @param start [String] The updated start date in YYYY-MM-DD format.
|
|
66
|
+
# @param end_ [String] The updated end date in YYYY-MM-DD format, or `null` to clear it.
|
|
67
|
+
# @param breakdown_attributes [Array<String>] The updated breakdown attribute UUIDs.
|
|
68
|
+
# @param run_unit [TrophyApiClient::UpdateLeaderboardRequestItemRunUnit] The updated recurrence unit.
|
|
69
|
+
# @param run_interval [Integer] The updated recurrence interval.
|
|
70
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
71
|
+
# @return [TrophyApiClient::UpdateLeaderboardRequestItem]
|
|
72
|
+
def initialize(id:, name: OMIT, key: OMIT, description: OMIT, status: OMIT, rank_by: OMIT, metric_id: OMIT,
|
|
73
|
+
points_system_id: OMIT, max_participants: OMIT, start: OMIT, end_: OMIT, breakdown_attributes: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
|
|
74
|
+
@id = id
|
|
75
|
+
@name = name if name != OMIT
|
|
76
|
+
@key = key if key != OMIT
|
|
77
|
+
@description = description if description != OMIT
|
|
78
|
+
@status = status if status != OMIT
|
|
79
|
+
@rank_by = rank_by if rank_by != OMIT
|
|
80
|
+
@metric_id = metric_id if metric_id != OMIT
|
|
81
|
+
@points_system_id = points_system_id if points_system_id != OMIT
|
|
82
|
+
@max_participants = max_participants if max_participants != OMIT
|
|
83
|
+
@start = start if start != OMIT
|
|
84
|
+
@end_ = end_ if end_ != OMIT
|
|
85
|
+
@breakdown_attributes = breakdown_attributes if breakdown_attributes != OMIT
|
|
86
|
+
@run_unit = run_unit if run_unit != OMIT
|
|
87
|
+
@run_interval = run_interval if run_interval != OMIT
|
|
88
|
+
@additional_properties = additional_properties
|
|
89
|
+
@_field_set = {
|
|
90
|
+
"id": id,
|
|
91
|
+
"name": name,
|
|
92
|
+
"key": key,
|
|
93
|
+
"description": description,
|
|
94
|
+
"status": status,
|
|
95
|
+
"rankBy": rank_by,
|
|
96
|
+
"metricId": metric_id,
|
|
97
|
+
"pointsSystemId": points_system_id,
|
|
98
|
+
"maxParticipants": max_participants,
|
|
99
|
+
"start": start,
|
|
100
|
+
"end": end_,
|
|
101
|
+
"breakdownAttributes": breakdown_attributes,
|
|
102
|
+
"runUnit": run_unit,
|
|
103
|
+
"runInterval": run_interval
|
|
104
|
+
}.reject do |_k, v|
|
|
105
|
+
v == OMIT
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Deserialize a JSON object to an instance of UpdateLeaderboardRequestItem
|
|
110
|
+
#
|
|
111
|
+
# @param json_object [String]
|
|
112
|
+
# @return [TrophyApiClient::UpdateLeaderboardRequestItem]
|
|
113
|
+
def self.from_json(json_object:)
|
|
114
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
115
|
+
parsed_json = JSON.parse(json_object)
|
|
116
|
+
id = parsed_json["id"]
|
|
117
|
+
name = parsed_json["name"]
|
|
118
|
+
key = parsed_json["key"]
|
|
119
|
+
description = parsed_json["description"]
|
|
120
|
+
status = parsed_json["status"]
|
|
121
|
+
rank_by = parsed_json["rankBy"]
|
|
122
|
+
metric_id = parsed_json["metricId"]
|
|
123
|
+
points_system_id = parsed_json["pointsSystemId"]
|
|
124
|
+
max_participants = parsed_json["maxParticipants"]
|
|
125
|
+
start = parsed_json["start"]
|
|
126
|
+
end_ = parsed_json["end"]
|
|
127
|
+
breakdown_attributes = parsed_json["breakdownAttributes"]
|
|
128
|
+
run_unit = parsed_json["runUnit"]
|
|
129
|
+
run_interval = parsed_json["runInterval"]
|
|
130
|
+
new(
|
|
131
|
+
id: id,
|
|
132
|
+
name: name,
|
|
133
|
+
key: key,
|
|
134
|
+
description: description,
|
|
135
|
+
status: status,
|
|
136
|
+
rank_by: rank_by,
|
|
137
|
+
metric_id: metric_id,
|
|
138
|
+
points_system_id: points_system_id,
|
|
139
|
+
max_participants: max_participants,
|
|
140
|
+
start: start,
|
|
141
|
+
end_: end_,
|
|
142
|
+
breakdown_attributes: breakdown_attributes,
|
|
143
|
+
run_unit: run_unit,
|
|
144
|
+
run_interval: run_interval,
|
|
145
|
+
additional_properties: struct
|
|
146
|
+
)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Serialize an instance of UpdateLeaderboardRequestItem to a JSON object
|
|
150
|
+
#
|
|
151
|
+
# @return [String]
|
|
152
|
+
def to_json(*_args)
|
|
153
|
+
@_field_set&.to_json
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
157
|
+
# hash and check each fields type against the current object's property
|
|
158
|
+
# definitions.
|
|
159
|
+
#
|
|
160
|
+
# @param obj [Object]
|
|
161
|
+
# @return [Void]
|
|
162
|
+
def self.validate_raw(obj:)
|
|
163
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
164
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
165
|
+
obj.key&.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
166
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
167
|
+
obj.status&.is_a?(TrophyApiClient::UpdateLeaderboardRequestItemStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
168
|
+
obj.rank_by&.is_a?(TrophyApiClient::UpdateLeaderboardRequestItemRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
|
|
169
|
+
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
170
|
+
obj.points_system_id&.is_a?(String) != false || raise("Passed value for field obj.points_system_id is not the expected type, validation failed.")
|
|
171
|
+
obj.max_participants&.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
|
|
172
|
+
obj.start&.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
|
|
173
|
+
obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
|
|
174
|
+
obj.breakdown_attributes&.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
|
|
175
|
+
obj.run_unit&.is_a?(TrophyApiClient::UpdateLeaderboardRequestItemRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
|
|
176
|
+
obj.run_interval&.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TrophyApiClient
|
|
4
|
+
# The updated ranking criterion. This can only be changed while the leaderboard is
|
|
5
|
+
# inactive.
|
|
6
|
+
class UpdateLeaderboardRequestItemRankBy
|
|
7
|
+
METRIC = "metric"
|
|
8
|
+
STREAK = "streak"
|
|
9
|
+
POINTS = "points"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TrophyApiClient
|
|
4
|
+
# The target user-facing status. `scheduled` activates a leaderboard whose start
|
|
5
|
+
# date is in the future. `finished` behaves like the dashboard finish action.
|
|
6
|
+
class UpdateLeaderboardRequestItemStatus
|
|
7
|
+
INACTIVE = "inactive"
|
|
8
|
+
ACTIVE = "active"
|
|
9
|
+
SCHEDULED = "scheduled"
|
|
10
|
+
FINISHED = "finished"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "admin_leaderboard"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing updated leaderboards and any per-item issues identified by
|
|
10
|
+
# leaderboard ID.
|
|
11
|
+
class UpdateLeaderboardsResponse
|
|
12
|
+
# @return [Array<TrophyApiClient::AdminLeaderboard>] Array of successfully updated leaderboards.
|
|
13
|
+
attr_reader :updated
|
|
14
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during leaderboard update.
|
|
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 updated [Array<TrophyApiClient::AdminLeaderboard>] Array of successfully updated leaderboards.
|
|
25
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during leaderboard update.
|
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
|
+
# @return [TrophyApiClient::UpdateLeaderboardsResponse]
|
|
28
|
+
def initialize(updated:, issues:, additional_properties: nil)
|
|
29
|
+
@updated = updated
|
|
30
|
+
@issues = issues
|
|
31
|
+
@additional_properties = additional_properties
|
|
32
|
+
@_field_set = { "updated": updated, "issues": issues }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Deserialize a JSON object to an instance of UpdateLeaderboardsResponse
|
|
36
|
+
#
|
|
37
|
+
# @param json_object [String]
|
|
38
|
+
# @return [TrophyApiClient::UpdateLeaderboardsResponse]
|
|
39
|
+
def self.from_json(json_object:)
|
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
41
|
+
parsed_json = JSON.parse(json_object)
|
|
42
|
+
updated = parsed_json["updated"]&.map do |item|
|
|
43
|
+
item = item.to_json
|
|
44
|
+
TrophyApiClient::AdminLeaderboard.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
|
+
updated: updated,
|
|
52
|
+
issues: issues,
|
|
53
|
+
additional_properties: struct
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Serialize an instance of UpdateLeaderboardsResponse 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.updated.is_a?(Array) != false || raise("Passed value for field obj.updated 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
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "update_metric_request_item_unit_type"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module TrophyApiClient
|
|
8
|
+
# A metric update object. `id` is required; `name`, `unitType`, and `units` are
|
|
9
|
+
# optional. `key` cannot be changed through this endpoint.
|
|
10
|
+
class UpdateMetricRequestItem
|
|
11
|
+
# @return [String] The UUID of the metric to update.
|
|
12
|
+
attr_reader :id
|
|
13
|
+
# @return [String] The updated metric name.
|
|
14
|
+
attr_reader :name
|
|
15
|
+
# @return [TrophyApiClient::UpdateMetricRequestItemUnitType] The updated metric unit type.
|
|
16
|
+
attr_reader :unit_type
|
|
17
|
+
# @return [String] The updated units value. For `unitType: currency`, this must be a supported
|
|
18
|
+
# `MetricCurrency` code such as `USD`.
|
|
19
|
+
attr_reader :units
|
|
20
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
|
+
attr_reader :additional_properties
|
|
22
|
+
# @return [Object]
|
|
23
|
+
attr_reader :_field_set
|
|
24
|
+
protected :_field_set
|
|
25
|
+
|
|
26
|
+
OMIT = Object.new
|
|
27
|
+
|
|
28
|
+
# @param id [String] The UUID of the metric to update.
|
|
29
|
+
# @param name [String] The updated metric name.
|
|
30
|
+
# @param unit_type [TrophyApiClient::UpdateMetricRequestItemUnitType] The updated metric unit type.
|
|
31
|
+
# @param units [String] The updated units value. For `unitType: currency`, this must be a supported
|
|
32
|
+
# `MetricCurrency` code such as `USD`.
|
|
33
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
34
|
+
# @return [TrophyApiClient::UpdateMetricRequestItem]
|
|
35
|
+
def initialize(id:, name: OMIT, unit_type: OMIT, units: OMIT, additional_properties: nil)
|
|
36
|
+
@id = id
|
|
37
|
+
@name = name if name != OMIT
|
|
38
|
+
@unit_type = unit_type if unit_type != OMIT
|
|
39
|
+
@units = units if units != OMIT
|
|
40
|
+
@additional_properties = additional_properties
|
|
41
|
+
@_field_set = { "id": id, "name": name, "unitType": unit_type, "units": units }.reject do |_k, v|
|
|
42
|
+
v == OMIT
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Deserialize a JSON object to an instance of UpdateMetricRequestItem
|
|
47
|
+
#
|
|
48
|
+
# @param json_object [String]
|
|
49
|
+
# @return [TrophyApiClient::UpdateMetricRequestItem]
|
|
50
|
+
def self.from_json(json_object:)
|
|
51
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
52
|
+
parsed_json = JSON.parse(json_object)
|
|
53
|
+
id = parsed_json["id"]
|
|
54
|
+
name = parsed_json["name"]
|
|
55
|
+
unit_type = parsed_json["unitType"]
|
|
56
|
+
units = parsed_json["units"]
|
|
57
|
+
new(
|
|
58
|
+
id: id,
|
|
59
|
+
name: name,
|
|
60
|
+
unit_type: unit_type,
|
|
61
|
+
units: units,
|
|
62
|
+
additional_properties: struct
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Serialize an instance of UpdateMetricRequestItem to a JSON object
|
|
67
|
+
#
|
|
68
|
+
# @return [String]
|
|
69
|
+
def to_json(*_args)
|
|
70
|
+
@_field_set&.to_json
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
74
|
+
# hash and check each fields type against the current object's property
|
|
75
|
+
# definitions.
|
|
76
|
+
#
|
|
77
|
+
# @param obj [Object]
|
|
78
|
+
# @return [Void]
|
|
79
|
+
def self.validate_raw(obj:)
|
|
80
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
81
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
82
|
+
obj.unit_type&.is_a?(TrophyApiClient::UpdateMetricRequestItemUnitType) != false || raise("Passed value for field obj.unit_type is not the expected type, validation failed.")
|
|
83
|
+
obj.units&.is_a?(String) != false || raise("Passed value for field obj.units is not the expected type, validation failed.")
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "created_metric"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing updated metrics and any per-item issues identified by metric
|
|
10
|
+
# ID.
|
|
11
|
+
class UpdateMetricsResponse
|
|
12
|
+
# @return [Array<TrophyApiClient::CreatedMetric>] Array of successfully updated metrics.
|
|
13
|
+
attr_reader :updated
|
|
14
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during metric update.
|
|
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 updated [Array<TrophyApiClient::CreatedMetric>] Array of successfully updated metrics.
|
|
25
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during metric update.
|
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
|
+
# @return [TrophyApiClient::UpdateMetricsResponse]
|
|
28
|
+
def initialize(updated:, issues:, additional_properties: nil)
|
|
29
|
+
@updated = updated
|
|
30
|
+
@issues = issues
|
|
31
|
+
@additional_properties = additional_properties
|
|
32
|
+
@_field_set = { "updated": updated, "issues": issues }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Deserialize a JSON object to an instance of UpdateMetricsResponse
|
|
36
|
+
#
|
|
37
|
+
# @param json_object [String]
|
|
38
|
+
# @return [TrophyApiClient::UpdateMetricsResponse]
|
|
39
|
+
def self.from_json(json_object:)
|
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
41
|
+
parsed_json = JSON.parse(json_object)
|
|
42
|
+
updated = parsed_json["updated"]&.map do |item|
|
|
43
|
+
item = item.to_json
|
|
44
|
+
TrophyApiClient::CreatedMetric.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
|
+
updated: updated,
|
|
52
|
+
issues: issues,
|
|
53
|
+
additional_properties: struct
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Serialize an instance of UpdateMetricsResponse 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.updated.is_a?(Array) != false || raise("Passed value for field obj.updated 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
|
|
@@ -33,7 +33,7 @@ module TrophyApiClient
|
|
|
33
33
|
|
|
34
34
|
# Create a new user.
|
|
35
35
|
#
|
|
36
|
-
# @param request [Hash]
|
|
36
|
+
# @param request [Hash] Request of type TrophyApiClient::UpsertedUser, as a Hash
|
|
37
37
|
# * :id (String)
|
|
38
38
|
# * :email (String)
|
|
39
39
|
# * :name (String)
|
|
@@ -657,7 +657,7 @@ module TrophyApiClient
|
|
|
657
657
|
|
|
658
658
|
# Create a new user.
|
|
659
659
|
#
|
|
660
|
-
# @param request [Hash]
|
|
660
|
+
# @param request [Hash] Request of type TrophyApiClient::UpsertedUser, as a Hash
|
|
661
661
|
# * :id (String)
|
|
662
662
|
# * :email (String)
|
|
663
663
|
# * :name (String)
|
data/lib/types_export.rb
CHANGED
|
@@ -26,7 +26,6 @@ require_relative "trophy_api_client/types/webhooks_leaderboard_started_payload"
|
|
|
26
26
|
require_relative "trophy_api_client/types/webhooks_leaderboard_changed_payload"
|
|
27
27
|
require_relative "trophy_api_client/types/webhooks_leaderboard_finished_payload"
|
|
28
28
|
require_relative "trophy_api_client/types/webhooks_leaderboard_rank_changed_payload"
|
|
29
|
-
require_relative "trophy_api_client/types/metric_status"
|
|
30
29
|
require_relative "trophy_api_client/types/streak_frequency"
|
|
31
30
|
require_relative "trophy_api_client/types/base_streak_response"
|
|
32
31
|
require_relative "trophy_api_client/types/bulk_streak_response_item"
|
|
@@ -74,7 +73,6 @@ require_relative "trophy_api_client/types/updated_user"
|
|
|
74
73
|
require_relative "trophy_api_client/types/upserted_user"
|
|
75
74
|
require_relative "trophy_api_client/types/user"
|
|
76
75
|
require_relative "trophy_api_client/types/notification_channel"
|
|
77
|
-
require_relative "trophy_api_client/types/notification_type"
|
|
78
76
|
require_relative "trophy_api_client/types/notification_preferences"
|
|
79
77
|
require_relative "trophy_api_client/types/user_preferences_response"
|
|
80
78
|
require_relative "trophy_api_client/types/error_body"
|
|
@@ -89,16 +87,6 @@ require_relative "trophy_api_client/types/leaderboard_event"
|
|
|
89
87
|
require_relative "trophy_api_client/types/user_leaderboard_response"
|
|
90
88
|
require_relative "trophy_api_client/types/user_leaderboard_response_with_history"
|
|
91
89
|
require_relative "trophy_api_client/types/webhook_user_leaderboard_response"
|
|
92
|
-
require_relative "trophy_api_client/types/create_streak_freezes_response"
|
|
93
|
-
require_relative "trophy_api_client/types/created_points_boost_status"
|
|
94
|
-
require_relative "trophy_api_client/types/created_points_boost_rounding"
|
|
95
|
-
require_relative "trophy_api_client/types/created_points_boost"
|
|
96
|
-
require_relative "trophy_api_client/types/create_points_boosts_response"
|
|
97
|
-
require_relative "trophy_api_client/types/delete_points_boosts_response"
|
|
98
|
-
require_relative "trophy_api_client/types/restore_streaks_response"
|
|
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"
|
|
102
90
|
require_relative "trophy_api_client/types/wrapped_metric_by_attribute_value_value"
|
|
103
91
|
require_relative "trophy_api_client/types/wrapped_metric"
|
|
104
92
|
require_relative "trophy_api_client/types/wrapped_points"
|
|
@@ -110,3 +98,54 @@ require_relative "trophy_api_client/types/wrapped_most_active_month"
|
|
|
110
98
|
require_relative "trophy_api_client/types/wrapped_entire_year"
|
|
111
99
|
require_relative "trophy_api_client/types/wrapped_activity"
|
|
112
100
|
require_relative "trophy_api_client/types/wrapped_response"
|
|
101
|
+
require_relative "trophy_api_client/types/create_streak_freezes_response"
|
|
102
|
+
require_relative "trophy_api_client/types/create_attribute_request_item"
|
|
103
|
+
require_relative "trophy_api_client/types/create_attributes_request"
|
|
104
|
+
require_relative "trophy_api_client/types/create_attribute_request_item_type"
|
|
105
|
+
require_relative "trophy_api_client/types/admin_attribute_type"
|
|
106
|
+
require_relative "trophy_api_client/types/admin_attribute"
|
|
107
|
+
require_relative "trophy_api_client/types/create_attributes_response"
|
|
108
|
+
require_relative "trophy_api_client/types/update_attribute_request_item"
|
|
109
|
+
require_relative "trophy_api_client/types/update_attributes_request"
|
|
110
|
+
require_relative "trophy_api_client/types/update_attributes_response"
|
|
111
|
+
require_relative "trophy_api_client/types/delete_attributes_response"
|
|
112
|
+
require_relative "trophy_api_client/types/list_attributes_response"
|
|
113
|
+
require_relative "trophy_api_client/types/create_leaderboard_request_item"
|
|
114
|
+
require_relative "trophy_api_client/types/create_leaderboards_request"
|
|
115
|
+
require_relative "trophy_api_client/types/create_leaderboard_request_item_status"
|
|
116
|
+
require_relative "trophy_api_client/types/create_leaderboard_request_item_rank_by"
|
|
117
|
+
require_relative "trophy_api_client/types/create_leaderboard_request_item_run_unit"
|
|
118
|
+
require_relative "trophy_api_client/types/admin_leaderboard_status"
|
|
119
|
+
require_relative "trophy_api_client/types/admin_leaderboard_rank_by"
|
|
120
|
+
require_relative "trophy_api_client/types/admin_leaderboard_run_unit"
|
|
121
|
+
require_relative "trophy_api_client/types/admin_leaderboard"
|
|
122
|
+
require_relative "trophy_api_client/types/create_leaderboards_response"
|
|
123
|
+
require_relative "trophy_api_client/types/update_leaderboard_request_item"
|
|
124
|
+
require_relative "trophy_api_client/types/update_leaderboards_request"
|
|
125
|
+
require_relative "trophy_api_client/types/update_leaderboard_request_item_status"
|
|
126
|
+
require_relative "trophy_api_client/types/update_leaderboard_request_item_rank_by"
|
|
127
|
+
require_relative "trophy_api_client/types/update_leaderboard_request_item_run_unit"
|
|
128
|
+
require_relative "trophy_api_client/types/update_leaderboards_response"
|
|
129
|
+
require_relative "trophy_api_client/types/delete_leaderboards_response"
|
|
130
|
+
require_relative "trophy_api_client/types/list_leaderboards_response"
|
|
131
|
+
require_relative "trophy_api_client/types/create_metric_request_item"
|
|
132
|
+
require_relative "trophy_api_client/types/create_metrics_request"
|
|
133
|
+
require_relative "trophy_api_client/types/create_metric_request_item_unit_type"
|
|
134
|
+
require_relative "trophy_api_client/types/created_metric_unit_type"
|
|
135
|
+
require_relative "trophy_api_client/types/created_metric"
|
|
136
|
+
require_relative "trophy_api_client/types/create_metrics_response"
|
|
137
|
+
require_relative "trophy_api_client/types/update_metric_request_item"
|
|
138
|
+
require_relative "trophy_api_client/types/update_metrics_request"
|
|
139
|
+
require_relative "trophy_api_client/types/update_metric_request_item_unit_type"
|
|
140
|
+
require_relative "trophy_api_client/types/update_metrics_response"
|
|
141
|
+
require_relative "trophy_api_client/types/delete_metrics_response"
|
|
142
|
+
require_relative "trophy_api_client/types/list_metrics_response"
|
|
143
|
+
require_relative "trophy_api_client/types/created_points_boost_status"
|
|
144
|
+
require_relative "trophy_api_client/types/created_points_boost_rounding"
|
|
145
|
+
require_relative "trophy_api_client/types/created_points_boost"
|
|
146
|
+
require_relative "trophy_api_client/types/create_points_boosts_response"
|
|
147
|
+
require_relative "trophy_api_client/types/delete_points_boosts_response"
|
|
148
|
+
require_relative "trophy_api_client/types/restore_streaks_response"
|
|
149
|
+
require_relative "trophy_api_client/types/admin_issue_severity"
|
|
150
|
+
require_relative "trophy_api_client/types/admin_issue"
|
|
151
|
+
require_relative "trophy_api_client/types/deleted_resource"
|