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,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
class CreatePointsSystemRequestItemBadge
|
|
8
|
+
# @return [String] Badge image URL.
|
|
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] Badge image URL.
|
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
20
|
+
# @return [TrophyApiClient::CreatePointsSystemRequestItemBadge]
|
|
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 CreatePointsSystemRequestItemBadge
|
|
28
|
+
#
|
|
29
|
+
# @param json_object [String]
|
|
30
|
+
# @return [TrophyApiClient::CreatePointsSystemRequestItemBadge]
|
|
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 CreatePointsSystemRequestItemBadge 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
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "created_admin_points_system"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing created points systems and any per-item issues.
|
|
10
|
+
class CreatePointsSystemsResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::CreatedAdminPointsSystem>] Array of successfully created points systems.
|
|
12
|
+
attr_reader :created
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during creation.
|
|
14
|
+
attr_reader :issues
|
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
16
|
+
attr_reader :additional_properties
|
|
17
|
+
# @return [Object]
|
|
18
|
+
attr_reader :_field_set
|
|
19
|
+
protected :_field_set
|
|
20
|
+
|
|
21
|
+
OMIT = Object.new
|
|
22
|
+
|
|
23
|
+
# @param created [Array<TrophyApiClient::CreatedAdminPointsSystem>] Array of successfully created points systems.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during creation.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::CreatePointsSystemsResponse]
|
|
27
|
+
def initialize(created:, issues:, additional_properties: nil)
|
|
28
|
+
@created = created
|
|
29
|
+
@issues = issues
|
|
30
|
+
@additional_properties = additional_properties
|
|
31
|
+
@_field_set = { "created": created, "issues": issues }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Deserialize a JSON object to an instance of CreatePointsSystemsResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::CreatePointsSystemsResponse]
|
|
38
|
+
def self.from_json(json_object:)
|
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
40
|
+
parsed_json = JSON.parse(json_object)
|
|
41
|
+
created = parsed_json["created"]&.map do |item|
|
|
42
|
+
item = item.to_json
|
|
43
|
+
TrophyApiClient::CreatedAdminPointsSystem.from_json(json_object: item)
|
|
44
|
+
end
|
|
45
|
+
issues = parsed_json["issues"]&.map do |item|
|
|
46
|
+
item = item.to_json
|
|
47
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
48
|
+
end
|
|
49
|
+
new(
|
|
50
|
+
created: created,
|
|
51
|
+
issues: issues,
|
|
52
|
+
additional_properties: struct
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Serialize an instance of CreatePointsSystemsResponse to a JSON object
|
|
57
|
+
#
|
|
58
|
+
# @return [String]
|
|
59
|
+
def to_json(*_args)
|
|
60
|
+
@_field_set&.to_json
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
64
|
+
# hash and check each fields type against the current object's property
|
|
65
|
+
# definitions.
|
|
66
|
+
#
|
|
67
|
+
# @param obj [Object]
|
|
68
|
+
# @return [Void]
|
|
69
|
+
def self.validate_raw(obj:)
|
|
70
|
+
obj.created.is_a?(Array) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
|
71
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "create_points_trigger_request_item_type"
|
|
4
|
+
require_relative "create_points_trigger_request_item_status"
|
|
5
|
+
require_relative "create_points_trigger_request_item_user_attributes_item"
|
|
6
|
+
require_relative "create_points_trigger_request_item_event_attributes_item"
|
|
7
|
+
require_relative "create_points_trigger_request_item_time_unit"
|
|
8
|
+
require "ostruct"
|
|
9
|
+
require "json"
|
|
10
|
+
|
|
11
|
+
module TrophyApiClient
|
|
12
|
+
# A points trigger to create.
|
|
13
|
+
class CreatePointsTriggerRequestItem
|
|
14
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItemType] The type of trigger.
|
|
15
|
+
attr_reader :type
|
|
16
|
+
# @return [Integer] The number of points to award or deduct when the trigger fires. Cannot be zero.
|
|
17
|
+
attr_reader :points
|
|
18
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItemStatus] The status of the trigger. Defaults to 'inactive'.
|
|
19
|
+
attr_reader :status
|
|
20
|
+
# @return [Array<TrophyApiClient::CreatePointsTriggerRequestItemUserAttributesItem>] Optional user attribute filters for the trigger.
|
|
21
|
+
attr_reader :user_attributes
|
|
22
|
+
# @return [String] Required if type is `metric`. The UUID of the metric.
|
|
23
|
+
attr_reader :metric_id
|
|
24
|
+
# @return [Integer] Required if type is `metric`. The metric increment that triggers the points.
|
|
25
|
+
attr_reader :metric_threshold
|
|
26
|
+
# @return [Array<TrophyApiClient::CreatePointsTriggerRequestItemEventAttributesItem>] Optional event attribute filters. Only permitted if type is `metric`.
|
|
27
|
+
attr_reader :event_attributes
|
|
28
|
+
# @return [String] Required if type is `achievement`. The UUID of the achievement.
|
|
29
|
+
attr_reader :achievement_id
|
|
30
|
+
# @return [Integer] Required if type is `streak`. The number of streak periods that triggers the
|
|
31
|
+
# points.
|
|
32
|
+
attr_reader :streak_length
|
|
33
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItemTimeUnit] Required if type is `time`. The unit for the time interval.
|
|
34
|
+
attr_reader :time_unit
|
|
35
|
+
# @return [Integer] Required if type is `time`. The number of time units between recurring awards.
|
|
36
|
+
attr_reader :time_interval
|
|
37
|
+
# @return [Boolean] Whether to block metric events that would reduce the user's points below zero.
|
|
38
|
+
# Defaults to false.
|
|
39
|
+
attr_reader :block_if_out_of_points
|
|
40
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
41
|
+
attr_reader :additional_properties
|
|
42
|
+
# @return [Object]
|
|
43
|
+
attr_reader :_field_set
|
|
44
|
+
protected :_field_set
|
|
45
|
+
|
|
46
|
+
OMIT = Object.new
|
|
47
|
+
|
|
48
|
+
# @param type [TrophyApiClient::CreatePointsTriggerRequestItemType] The type of trigger.
|
|
49
|
+
# @param points [Integer] The number of points to award or deduct when the trigger fires. Cannot be zero.
|
|
50
|
+
# @param status [TrophyApiClient::CreatePointsTriggerRequestItemStatus] The status of the trigger. Defaults to 'inactive'.
|
|
51
|
+
# @param user_attributes [Array<TrophyApiClient::CreatePointsTriggerRequestItemUserAttributesItem>] Optional user attribute filters for the trigger.
|
|
52
|
+
# @param metric_id [String] Required if type is `metric`. The UUID of the metric.
|
|
53
|
+
# @param metric_threshold [Integer] Required if type is `metric`. The metric increment that triggers the points.
|
|
54
|
+
# @param event_attributes [Array<TrophyApiClient::CreatePointsTriggerRequestItemEventAttributesItem>] Optional event attribute filters. Only permitted if type is `metric`.
|
|
55
|
+
# @param achievement_id [String] Required if type is `achievement`. The UUID of the achievement.
|
|
56
|
+
# @param streak_length [Integer] Required if type is `streak`. The number of streak periods that triggers the
|
|
57
|
+
# points.
|
|
58
|
+
# @param time_unit [TrophyApiClient::CreatePointsTriggerRequestItemTimeUnit] Required if type is `time`. The unit for the time interval.
|
|
59
|
+
# @param time_interval [Integer] Required if type is `time`. The number of time units between recurring awards.
|
|
60
|
+
# @param block_if_out_of_points [Boolean] Whether to block metric events that would reduce the user's points below zero.
|
|
61
|
+
# Defaults to false.
|
|
62
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
63
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItem]
|
|
64
|
+
def initialize(type:, points:, status: OMIT, user_attributes: OMIT, metric_id: OMIT, metric_threshold: OMIT,
|
|
65
|
+
event_attributes: OMIT, achievement_id: OMIT, streak_length: OMIT, time_unit: OMIT, time_interval: OMIT, block_if_out_of_points: OMIT, additional_properties: nil)
|
|
66
|
+
@type = type
|
|
67
|
+
@points = points
|
|
68
|
+
@status = status if status != OMIT
|
|
69
|
+
@user_attributes = user_attributes if user_attributes != OMIT
|
|
70
|
+
@metric_id = metric_id if metric_id != OMIT
|
|
71
|
+
@metric_threshold = metric_threshold if metric_threshold != OMIT
|
|
72
|
+
@event_attributes = event_attributes if event_attributes != OMIT
|
|
73
|
+
@achievement_id = achievement_id if achievement_id != OMIT
|
|
74
|
+
@streak_length = streak_length if streak_length != OMIT
|
|
75
|
+
@time_unit = time_unit if time_unit != OMIT
|
|
76
|
+
@time_interval = time_interval if time_interval != OMIT
|
|
77
|
+
@block_if_out_of_points = block_if_out_of_points if block_if_out_of_points != OMIT
|
|
78
|
+
@additional_properties = additional_properties
|
|
79
|
+
@_field_set = {
|
|
80
|
+
"type": type,
|
|
81
|
+
"points": points,
|
|
82
|
+
"status": status,
|
|
83
|
+
"userAttributes": user_attributes,
|
|
84
|
+
"metricId": metric_id,
|
|
85
|
+
"metricThreshold": metric_threshold,
|
|
86
|
+
"eventAttributes": event_attributes,
|
|
87
|
+
"achievementId": achievement_id,
|
|
88
|
+
"streakLength": streak_length,
|
|
89
|
+
"timeUnit": time_unit,
|
|
90
|
+
"timeInterval": time_interval,
|
|
91
|
+
"blockIfOutOfPoints": block_if_out_of_points
|
|
92
|
+
}.reject do |_k, v|
|
|
93
|
+
v == OMIT
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Deserialize a JSON object to an instance of CreatePointsTriggerRequestItem
|
|
98
|
+
#
|
|
99
|
+
# @param json_object [String]
|
|
100
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItem]
|
|
101
|
+
def self.from_json(json_object:)
|
|
102
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
103
|
+
parsed_json = JSON.parse(json_object)
|
|
104
|
+
type = parsed_json["type"]
|
|
105
|
+
points = parsed_json["points"]
|
|
106
|
+
status = parsed_json["status"]
|
|
107
|
+
user_attributes = parsed_json["userAttributes"]&.map do |item|
|
|
108
|
+
item = item.to_json
|
|
109
|
+
TrophyApiClient::CreatePointsTriggerRequestItemUserAttributesItem.from_json(json_object: item)
|
|
110
|
+
end
|
|
111
|
+
metric_id = parsed_json["metricId"]
|
|
112
|
+
metric_threshold = parsed_json["metricThreshold"]
|
|
113
|
+
event_attributes = parsed_json["eventAttributes"]&.map do |item|
|
|
114
|
+
item = item.to_json
|
|
115
|
+
TrophyApiClient::CreatePointsTriggerRequestItemEventAttributesItem.from_json(json_object: item)
|
|
116
|
+
end
|
|
117
|
+
achievement_id = parsed_json["achievementId"]
|
|
118
|
+
streak_length = parsed_json["streakLength"]
|
|
119
|
+
time_unit = parsed_json["timeUnit"]
|
|
120
|
+
time_interval = parsed_json["timeInterval"]
|
|
121
|
+
block_if_out_of_points = parsed_json["blockIfOutOfPoints"]
|
|
122
|
+
new(
|
|
123
|
+
type: type,
|
|
124
|
+
points: points,
|
|
125
|
+
status: status,
|
|
126
|
+
user_attributes: user_attributes,
|
|
127
|
+
metric_id: metric_id,
|
|
128
|
+
metric_threshold: metric_threshold,
|
|
129
|
+
event_attributes: event_attributes,
|
|
130
|
+
achievement_id: achievement_id,
|
|
131
|
+
streak_length: streak_length,
|
|
132
|
+
time_unit: time_unit,
|
|
133
|
+
time_interval: time_interval,
|
|
134
|
+
block_if_out_of_points: block_if_out_of_points,
|
|
135
|
+
additional_properties: struct
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Serialize an instance of CreatePointsTriggerRequestItem to a JSON object
|
|
140
|
+
#
|
|
141
|
+
# @return [String]
|
|
142
|
+
def to_json(*_args)
|
|
143
|
+
@_field_set&.to_json
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
147
|
+
# hash and check each fields type against the current object's property
|
|
148
|
+
# definitions.
|
|
149
|
+
#
|
|
150
|
+
# @param obj [Object]
|
|
151
|
+
# @return [Void]
|
|
152
|
+
def self.validate_raw(obj:)
|
|
153
|
+
obj.type.is_a?(TrophyApiClient::CreatePointsTriggerRequestItemType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
|
154
|
+
obj.points.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
|
|
155
|
+
obj.status&.is_a?(TrophyApiClient::CreatePointsTriggerRequestItemStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
156
|
+
obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
|
|
157
|
+
obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
|
|
158
|
+
obj.metric_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.metric_threshold is not the expected type, validation failed.")
|
|
159
|
+
obj.event_attributes&.is_a?(Array) != false || raise("Passed value for field obj.event_attributes is not the expected type, validation failed.")
|
|
160
|
+
obj.achievement_id&.is_a?(String) != false || raise("Passed value for field obj.achievement_id is not the expected type, validation failed.")
|
|
161
|
+
obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
|
|
162
|
+
obj.time_unit&.is_a?(TrophyApiClient::CreatePointsTriggerRequestItemTimeUnit) != false || raise("Passed value for field obj.time_unit is not the expected type, validation failed.")
|
|
163
|
+
obj.time_interval&.is_a?(Integer) != false || raise("Passed value for field obj.time_interval is not the expected type, validation failed.")
|
|
164
|
+
obj.block_if_out_of_points&.is_a?(Boolean) != false || raise("Passed value for field obj.block_if_out_of_points is not the expected type, validation failed.")
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
class CreatePointsTriggerRequestItemEventAttributesItem
|
|
8
|
+
# @return [String] The UUID of the event attribute.
|
|
9
|
+
attr_reader :attribute_id
|
|
10
|
+
# @return [String] The value to match.
|
|
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] The UUID of the event attribute.
|
|
21
|
+
# @param attribute_value [String] The value to match.
|
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
23
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItemEventAttributesItem]
|
|
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
|
+
# CreatePointsTriggerRequestItemEventAttributesItem
|
|
33
|
+
#
|
|
34
|
+
# @param json_object [String]
|
|
35
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItemEventAttributesItem]
|
|
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 CreatePointsTriggerRequestItemEventAttributesItem 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,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TrophyApiClient
|
|
4
|
+
# The type of trigger.
|
|
5
|
+
class CreatePointsTriggerRequestItemType
|
|
6
|
+
METRIC = "metric"
|
|
7
|
+
ACHIEVEMENT = "achievement"
|
|
8
|
+
STREAK = "streak"
|
|
9
|
+
TIME = "time"
|
|
10
|
+
USER_CREATION = "user_creation"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
class CreatePointsTriggerRequestItemUserAttributesItem
|
|
8
|
+
# @return [String] The UUID of the user attribute.
|
|
9
|
+
attr_reader :attribute_id
|
|
10
|
+
# @return [String] The value to match.
|
|
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] The UUID of the user attribute.
|
|
21
|
+
# @param attribute_value [String] The value to match.
|
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
23
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItemUserAttributesItem]
|
|
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
|
+
# CreatePointsTriggerRequestItemUserAttributesItem
|
|
33
|
+
#
|
|
34
|
+
# @param json_object [String]
|
|
35
|
+
# @return [TrophyApiClient::CreatePointsTriggerRequestItemUserAttributesItem]
|
|
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 CreatePointsTriggerRequestItemUserAttributesItem 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 created triggers and any per-item issues.
|
|
10
|
+
class CreatePointsTriggersResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::AdminPointsTrigger>] Array of successfully created triggers.
|
|
12
|
+
attr_reader :created
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during trigger creation.
|
|
14
|
+
attr_reader :issues
|
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
16
|
+
attr_reader :additional_properties
|
|
17
|
+
# @return [Object]
|
|
18
|
+
attr_reader :_field_set
|
|
19
|
+
protected :_field_set
|
|
20
|
+
|
|
21
|
+
OMIT = Object.new
|
|
22
|
+
|
|
23
|
+
# @param created [Array<TrophyApiClient::AdminPointsTrigger>] Array of successfully created triggers.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during trigger creation.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::CreatePointsTriggersResponse]
|
|
27
|
+
def initialize(created:, issues:, additional_properties: nil)
|
|
28
|
+
@created = created
|
|
29
|
+
@issues = issues
|
|
30
|
+
@additional_properties = additional_properties
|
|
31
|
+
@_field_set = { "created": created, "issues": issues }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Deserialize a JSON object to an instance of CreatePointsTriggersResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::CreatePointsTriggersResponse]
|
|
38
|
+
def self.from_json(json_object:)
|
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
40
|
+
parsed_json = JSON.parse(json_object)
|
|
41
|
+
created = parsed_json["created"]&.map do |item|
|
|
42
|
+
item = item.to_json
|
|
43
|
+
TrophyApiClient::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
|
+
created: created,
|
|
51
|
+
issues: issues,
|
|
52
|
+
additional_properties: struct
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Serialize an instance of CreatePointsTriggersResponse to a JSON object
|
|
57
|
+
#
|
|
58
|
+
# @return [String]
|
|
59
|
+
def to_json(*_args)
|
|
60
|
+
@_field_set&.to_json
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
64
|
+
# hash and check each fields type against the current object's property
|
|
65
|
+
# definitions.
|
|
66
|
+
#
|
|
67
|
+
# @param obj [Object]
|
|
68
|
+
# @return [Void]
|
|
69
|
+
def self.validate_raw(obj:)
|
|
70
|
+
obj.created.is_a?(Array) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
|
71
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|