trophy_api_client 1.6.0 → 1.8.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 +6 -6
- data/lib/trophy_api_client/admin/client.rb +14 -7
- data/lib/trophy_api_client/admin/leaderboards/client.rb +371 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +6 -6
- data/lib/trophy_api_client/admin/points/boosts/client.rb +258 -39
- data/lib/trophy_api_client/admin/points/client.rb +21 -0
- data/lib/trophy_api_client/admin/points/levels/client.rb +402 -0
- data/lib/trophy_api_client/admin/points/systems/client.rb +374 -0
- data/lib/trophy_api_client/admin/points/triggers/client.rb +402 -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/{created_points_boost.rb → admin_points_boost.rb} +39 -23
- data/lib/trophy_api_client/types/{created_points_boost_rounding.rb → admin_points_boost_rounding.rb} +1 -1
- data/lib/trophy_api_client/types/{created_points_boost_status.rb → admin_points_boost_status.rb} +1 -1
- data/lib/trophy_api_client/types/admin_points_boost_user_attributes_item.rb +65 -0
- data/lib/trophy_api_client/types/admin_points_level.rb +109 -0
- data/lib/trophy_api_client/types/admin_points_level_badge.rb +55 -0
- data/lib/trophy_api_client/types/admin_points_system.rb +118 -0
- data/lib/trophy_api_client/types/admin_points_system_badge.rb +55 -0
- data/lib/trophy_api_client/types/admin_points_system_status.rb +9 -0
- data/lib/trophy_api_client/types/admin_points_trigger.rb +175 -0
- data/lib/trophy_api_client/types/admin_points_trigger_event_attributes_item.rb +66 -0
- data/lib/trophy_api_client/types/admin_points_trigger_status.rb +9 -0
- data/lib/trophy_api_client/types/admin_points_trigger_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/admin_points_trigger_type.rb +12 -0
- data/lib/trophy_api_client/types/admin_points_trigger_user_attributes_item.rb +65 -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_points_boost_request_item.rb +125 -0
- data/lib/trophy_api_client/types/create_points_boost_request_item_rounding.rb +10 -0
- data/lib/trophy_api_client/types/create_points_boost_request_item_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/create_points_boosts_request.rb +7 -0
- data/lib/trophy_api_client/types/create_points_boosts_response.rb +4 -4
- data/lib/trophy_api_client/types/create_points_level_request_item.rb +103 -0
- data/lib/trophy_api_client/types/create_points_level_request_item_badge.rb +56 -0
- data/lib/trophy_api_client/types/create_points_levels_request.rb +7 -0
- data/lib/trophy_api_client/types/create_points_levels_response.rb +74 -0
- data/lib/trophy_api_client/types/create_points_system_request_item.rb +140 -0
- data/lib/trophy_api_client/types/create_points_system_request_item_badge.rb +55 -0
- data/lib/trophy_api_client/types/create_points_systems_request.rb +7 -0
- data/lib/trophy_api_client/types/create_points_systems_response.rb +74 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item.rb +167 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_event_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_status.rb +9 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_type.rb +12 -0
- data/lib/trophy_api_client/types/create_points_trigger_request_item_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/create_points_triggers_request.rb +7 -0
- data/lib/trophy_api_client/types/create_points_triggers_response.rb +74 -0
- data/lib/trophy_api_client/types/created_admin_points_system.rb +163 -0
- data/lib/trophy_api_client/types/delete_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_points_levels_response.rb +74 -0
- data/lib/trophy_api_client/types/delete_points_systems_response.rb +74 -0
- data/lib/trophy_api_client/types/delete_points_triggers_response.rb +75 -0
- data/lib/trophy_api_client/types/list_leaderboards_response.rb +7 -0
- data/lib/trophy_api_client/types/list_points_boosts_response.rb +7 -0
- data/lib/trophy_api_client/types/list_points_levels_response.rb +7 -0
- data/lib/trophy_api_client/types/list_points_systems_response.rb +7 -0
- data/lib/trophy_api_client/types/list_points_triggers_response.rb +7 -0
- data/lib/trophy_api_client/types/patch_points_boosts_request.rb +7 -0
- data/lib/trophy_api_client/types/patch_points_boosts_request_item.rb +118 -0
- data/lib/trophy_api_client/types/patch_points_boosts_request_item_rounding.rb +10 -0
- data/lib/trophy_api_client/types/patch_points_boosts_request_item_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/patch_points_boosts_response.rb +74 -0
- data/lib/trophy_api_client/types/patch_points_levels_request.rb +7 -0
- data/lib/trophy_api_client/types/patch_points_levels_request_item.rb +100 -0
- data/lib/trophy_api_client/types/patch_points_levels_request_item_badge.rb +55 -0
- data/lib/trophy_api_client/types/patch_points_levels_response.rb +74 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request.rb +7 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item.rb +174 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_event_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_status.rb +9 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_time_unit.rb +9 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_type.rb +13 -0
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_user_attributes_item.rb +67 -0
- data/lib/trophy_api_client/types/patch_points_triggers_response.rb +74 -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_points_system_request_item.rb +102 -0
- data/lib/trophy_api_client/types/update_points_system_request_item_badge.rb +55 -0
- data/lib/trophy_api_client/types/update_points_systems_request.rb +7 -0
- data/lib/trophy_api_client/types/update_points_systems_response.rb +74 -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 +93 -17
- metadata +87 -7
- data/lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb +0 -111
- data/lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item_rounding.rb +0 -16
- data/lib/trophy_api_client/types/notification_type.rb +0 -11
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
class PatchPointsTriggersRequestItemUserAttributesItem
|
|
8
|
+
# @return [String]
|
|
9
|
+
attr_reader :attribute_id
|
|
10
|
+
# @return [String]
|
|
11
|
+
attr_reader :attribute_value
|
|
12
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
13
|
+
attr_reader :additional_properties
|
|
14
|
+
# @return [Object]
|
|
15
|
+
attr_reader :_field_set
|
|
16
|
+
protected :_field_set
|
|
17
|
+
|
|
18
|
+
OMIT = Object.new
|
|
19
|
+
|
|
20
|
+
# @param attribute_id [String]
|
|
21
|
+
# @param attribute_value [String]
|
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
23
|
+
# @return [TrophyApiClient::PatchPointsTriggersRequestItemUserAttributesItem]
|
|
24
|
+
def initialize(attribute_id:, attribute_value:, additional_properties: nil)
|
|
25
|
+
@attribute_id = attribute_id
|
|
26
|
+
@attribute_value = attribute_value
|
|
27
|
+
@additional_properties = additional_properties
|
|
28
|
+
@_field_set = { "attributeId": attribute_id, "attributeValue": attribute_value }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Deserialize a JSON object to an instance of
|
|
32
|
+
# PatchPointsTriggersRequestItemUserAttributesItem
|
|
33
|
+
#
|
|
34
|
+
# @param json_object [String]
|
|
35
|
+
# @return [TrophyApiClient::PatchPointsTriggersRequestItemUserAttributesItem]
|
|
36
|
+
def self.from_json(json_object:)
|
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
38
|
+
parsed_json = JSON.parse(json_object)
|
|
39
|
+
attribute_id = parsed_json["attributeId"]
|
|
40
|
+
attribute_value = parsed_json["attributeValue"]
|
|
41
|
+
new(
|
|
42
|
+
attribute_id: attribute_id,
|
|
43
|
+
attribute_value: attribute_value,
|
|
44
|
+
additional_properties: struct
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Serialize an instance of PatchPointsTriggersRequestItemUserAttributesItem to a
|
|
49
|
+
# JSON object
|
|
50
|
+
#
|
|
51
|
+
# @return [String]
|
|
52
|
+
def to_json(*_args)
|
|
53
|
+
@_field_set&.to_json
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
57
|
+
# hash and check each fields type against the current object's property
|
|
58
|
+
# definitions.
|
|
59
|
+
#
|
|
60
|
+
# @param obj [Object]
|
|
61
|
+
# @return [Void]
|
|
62
|
+
def self.validate_raw(obj:)
|
|
63
|
+
obj.attribute_id.is_a?(String) != false || raise("Passed value for field obj.attribute_id is not the expected type, validation failed.")
|
|
64
|
+
obj.attribute_value.is_a?(String) != false || raise("Passed value for field obj.attribute_value is not the expected type, validation failed.")
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "admin_points_trigger"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing updated triggers and any issues encountered.
|
|
10
|
+
class PatchPointsTriggersResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::AdminPointsTrigger>] Array of successfully updated triggers.
|
|
12
|
+
attr_reader :updated
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during trigger updates.
|
|
14
|
+
attr_reader :issues
|
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
16
|
+
attr_reader :additional_properties
|
|
17
|
+
# @return [Object]
|
|
18
|
+
attr_reader :_field_set
|
|
19
|
+
protected :_field_set
|
|
20
|
+
|
|
21
|
+
OMIT = Object.new
|
|
22
|
+
|
|
23
|
+
# @param updated [Array<TrophyApiClient::AdminPointsTrigger>] Array of successfully updated triggers.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during trigger updates.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::PatchPointsTriggersResponse]
|
|
27
|
+
def initialize(updated:, issues:, additional_properties: nil)
|
|
28
|
+
@updated = updated
|
|
29
|
+
@issues = issues
|
|
30
|
+
@additional_properties = additional_properties
|
|
31
|
+
@_field_set = { "updated": updated, "issues": issues }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Deserialize a JSON object to an instance of PatchPointsTriggersResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::PatchPointsTriggersResponse]
|
|
38
|
+
def self.from_json(json_object:)
|
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
40
|
+
parsed_json = JSON.parse(json_object)
|
|
41
|
+
updated = parsed_json["updated"]&.map do |item|
|
|
42
|
+
item = item.to_json
|
|
43
|
+
TrophyApiClient::AdminPointsTrigger.from_json(json_object: item)
|
|
44
|
+
end
|
|
45
|
+
issues = parsed_json["issues"]&.map do |item|
|
|
46
|
+
item = item.to_json
|
|
47
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
48
|
+
end
|
|
49
|
+
new(
|
|
50
|
+
updated: updated,
|
|
51
|
+
issues: issues,
|
|
52
|
+
additional_properties: struct
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Serialize an instance of PatchPointsTriggersResponse to a JSON object
|
|
57
|
+
#
|
|
58
|
+
# @return [String]
|
|
59
|
+
def to_json(*_args)
|
|
60
|
+
@_field_set&.to_json
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
64
|
+
# hash and check each fields type against the current object's property
|
|
65
|
+
# definitions.
|
|
66
|
+
#
|
|
67
|
+
# @param obj [Object]
|
|
68
|
+
# @return [Void]
|
|
69
|
+
def self.validate_raw(obj:)
|
|
70
|
+
obj.updated.is_a?(Array) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
|
|
71
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -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,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "update_points_system_request_item_badge"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module TrophyApiClient
|
|
8
|
+
# A points system update object. Only id is required; all other fields are
|
|
9
|
+
# optional.
|
|
10
|
+
class UpdatePointsSystemRequestItem
|
|
11
|
+
# @return [String] The UUID of the points system to update.
|
|
12
|
+
attr_reader :id
|
|
13
|
+
# @return [String] Updated name.
|
|
14
|
+
attr_reader :name
|
|
15
|
+
# @return [String] Updated description.
|
|
16
|
+
attr_reader :description
|
|
17
|
+
# @return [TrophyApiClient::UpdatePointsSystemRequestItemBadge] Updated badge. Set to null to remove.
|
|
18
|
+
attr_reader :badge
|
|
19
|
+
# @return [Integer] Updated max points. Set to null to remove.
|
|
20
|
+
attr_reader :max_points
|
|
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 id [String] The UUID of the points system to update.
|
|
30
|
+
# @param name [String] Updated name.
|
|
31
|
+
# @param description [String] Updated description.
|
|
32
|
+
# @param badge [TrophyApiClient::UpdatePointsSystemRequestItemBadge] Updated badge. Set to null to remove.
|
|
33
|
+
# @param max_points [Integer] Updated max points. Set to null to remove.
|
|
34
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
35
|
+
# @return [TrophyApiClient::UpdatePointsSystemRequestItem]
|
|
36
|
+
def initialize(id:, name: OMIT, description: OMIT, badge: OMIT, max_points: OMIT, additional_properties: nil)
|
|
37
|
+
@id = id
|
|
38
|
+
@name = name if name != OMIT
|
|
39
|
+
@description = description if description != OMIT
|
|
40
|
+
@badge = badge if badge != OMIT
|
|
41
|
+
@max_points = max_points if max_points != OMIT
|
|
42
|
+
@additional_properties = additional_properties
|
|
43
|
+
@_field_set = {
|
|
44
|
+
"id": id,
|
|
45
|
+
"name": name,
|
|
46
|
+
"description": description,
|
|
47
|
+
"badge": badge,
|
|
48
|
+
"maxPoints": max_points
|
|
49
|
+
}.reject do |_k, v|
|
|
50
|
+
v == OMIT
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Deserialize a JSON object to an instance of UpdatePointsSystemRequestItem
|
|
55
|
+
#
|
|
56
|
+
# @param json_object [String]
|
|
57
|
+
# @return [TrophyApiClient::UpdatePointsSystemRequestItem]
|
|
58
|
+
def self.from_json(json_object:)
|
|
59
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
60
|
+
parsed_json = JSON.parse(json_object)
|
|
61
|
+
id = parsed_json["id"]
|
|
62
|
+
name = parsed_json["name"]
|
|
63
|
+
description = parsed_json["description"]
|
|
64
|
+
if parsed_json["badge"].nil?
|
|
65
|
+
badge = nil
|
|
66
|
+
else
|
|
67
|
+
badge = parsed_json["badge"].to_json
|
|
68
|
+
badge = TrophyApiClient::UpdatePointsSystemRequestItemBadge.from_json(json_object: badge)
|
|
69
|
+
end
|
|
70
|
+
max_points = parsed_json["maxPoints"]
|
|
71
|
+
new(
|
|
72
|
+
id: id,
|
|
73
|
+
name: name,
|
|
74
|
+
description: description,
|
|
75
|
+
badge: badge,
|
|
76
|
+
max_points: max_points,
|
|
77
|
+
additional_properties: struct
|
|
78
|
+
)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Serialize an instance of UpdatePointsSystemRequestItem 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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
97
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
98
|
+
obj.badge.nil? || TrophyApiClient::UpdatePointsSystemRequestItemBadge.validate_raw(obj: obj.badge)
|
|
99
|
+
obj.max_points&.is_a?(Integer) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
class UpdatePointsSystemRequestItemBadge
|
|
8
|
+
# @return [String]
|
|
9
|
+
attr_reader :url
|
|
10
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
11
|
+
attr_reader :additional_properties
|
|
12
|
+
# @return [Object]
|
|
13
|
+
attr_reader :_field_set
|
|
14
|
+
protected :_field_set
|
|
15
|
+
|
|
16
|
+
OMIT = Object.new
|
|
17
|
+
|
|
18
|
+
# @param url [String]
|
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
20
|
+
# @return [TrophyApiClient::UpdatePointsSystemRequestItemBadge]
|
|
21
|
+
def initialize(url:, additional_properties: nil)
|
|
22
|
+
@url = url
|
|
23
|
+
@additional_properties = additional_properties
|
|
24
|
+
@_field_set = { "url": url }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Deserialize a JSON object to an instance of UpdatePointsSystemRequestItemBadge
|
|
28
|
+
#
|
|
29
|
+
# @param json_object [String]
|
|
30
|
+
# @return [TrophyApiClient::UpdatePointsSystemRequestItemBadge]
|
|
31
|
+
def self.from_json(json_object:)
|
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
33
|
+
parsed_json = JSON.parse(json_object)
|
|
34
|
+
url = parsed_json["url"]
|
|
35
|
+
new(url: url, additional_properties: struct)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Serialize an instance of UpdatePointsSystemRequestItemBadge to a JSON object
|
|
39
|
+
#
|
|
40
|
+
# @return [String]
|
|
41
|
+
def to_json(*_args)
|
|
42
|
+
@_field_set&.to_json
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
46
|
+
# hash and check each fields type against the current object's property
|
|
47
|
+
# definitions.
|
|
48
|
+
#
|
|
49
|
+
# @param obj [Object]
|
|
50
|
+
# @return [Void]
|
|
51
|
+
def self.validate_raw(obj:)
|
|
52
|
+
obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|