trophy_api_client 1.7.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gemconfig.rb +1 -1
- data/lib/requests.rb +34 -8
- data/lib/trophy_api_client/achievements/client.rb +4 -0
- data/lib/trophy_api_client/admin/attributes/client.rb +10 -0
- data/lib/trophy_api_client/admin/client.rb +7 -0
- data/lib/trophy_api_client/admin/leaderboards/client.rb +10 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +10 -0
- data/lib/trophy_api_client/admin/points/boosts/client.rb +268 -39
- data/lib/trophy_api_client/admin/points/client.rb +21 -0
- data/lib/trophy_api_client/admin/points/levels/client.rb +412 -0
- data/lib/trophy_api_client/admin/points/systems/client.rb +384 -0
- data/lib/trophy_api_client/admin/points/triggers/client.rb +412 -0
- data/lib/trophy_api_client/admin/streaks/client.rb +2 -0
- data/lib/trophy_api_client/admin/streaks/freezes/client.rb +2 -0
- data/lib/trophy_api_client/admin/tenants/client.rb +376 -0
- data/lib/trophy_api_client/leaderboards/client.rb +4 -0
- data/lib/trophy_api_client/metrics/client.rb +2 -0
- data/lib/trophy_api_client/points/client.rb +10 -0
- data/lib/trophy_api_client/streaks/client.rb +4 -0
- data/lib/trophy_api_client/types/{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/admin_tenant.rb +103 -0
- data/lib/trophy_api_client/types/admin_tenant_status.rb +9 -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/create_tenant_request_item.rb +66 -0
- data/lib/trophy_api_client/types/create_tenants_request.rb +7 -0
- data/lib/trophy_api_client/types/create_tenants_response.rb +74 -0
- data/lib/trophy_api_client/types/created_admin_points_system.rb +163 -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/delete_tenants_response.rb +74 -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/list_tenants_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_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/types/update_tenant_request_item.rb +75 -0
- data/lib/trophy_api_client/types/update_tenants_request.rb +7 -0
- data/lib/trophy_api_client/types/update_tenants_response.rb +74 -0
- data/lib/trophy_api_client/users/client.rb +32 -0
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/trophy_api_client.rb +12 -4
- data/lib/types_export.rb +74 -5
- metadata +80 -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "
|
|
3
|
+
require_relative "admin_points_boost"
|
|
4
4
|
require_relative "admin_issue"
|
|
5
5
|
require "ostruct"
|
|
6
6
|
require "json"
|
|
@@ -9,7 +9,7 @@ module TrophyApiClient
|
|
|
9
9
|
# Response containing created boosts and any issues encountered while creating
|
|
10
10
|
# points boosts.
|
|
11
11
|
class CreatePointsBoostsResponse
|
|
12
|
-
# @return [Array<TrophyApiClient::
|
|
12
|
+
# @return [Array<TrophyApiClient::AdminPointsBoost>] Array of successfully created boosts.
|
|
13
13
|
attr_reader :created
|
|
14
14
|
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
|
|
15
15
|
attr_reader :issues
|
|
@@ -21,7 +21,7 @@ module TrophyApiClient
|
|
|
21
21
|
|
|
22
22
|
OMIT = Object.new
|
|
23
23
|
|
|
24
|
-
# @param created [Array<TrophyApiClient::
|
|
24
|
+
# @param created [Array<TrophyApiClient::AdminPointsBoost>] Array of successfully created boosts.
|
|
25
25
|
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost creation.
|
|
26
26
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
27
|
# @return [TrophyApiClient::CreatePointsBoostsResponse]
|
|
@@ -41,7 +41,7 @@ module TrophyApiClient
|
|
|
41
41
|
parsed_json = JSON.parse(json_object)
|
|
42
42
|
created = parsed_json["created"]&.map do |item|
|
|
43
43
|
item = item.to_json
|
|
44
|
-
TrophyApiClient::
|
|
44
|
+
TrophyApiClient::AdminPointsBoost.from_json(json_object: item)
|
|
45
45
|
end
|
|
46
46
|
issues = parsed_json["issues"]&.map do |item|
|
|
47
47
|
item = item.to_json
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "create_points_level_request_item_badge"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module TrophyApiClient
|
|
8
|
+
# A points level to create.
|
|
9
|
+
class CreatePointsLevelRequestItem
|
|
10
|
+
# @return [String] The name of the level.
|
|
11
|
+
attr_reader :name
|
|
12
|
+
# @return [String] A unique key for the level. Only alphanumeric characters, hyphens, and
|
|
13
|
+
# underscores are permitted.
|
|
14
|
+
attr_reader :key
|
|
15
|
+
# @return [Integer] The threshold points value for the level.
|
|
16
|
+
attr_reader :points
|
|
17
|
+
# @return [String] An optional description of the level.
|
|
18
|
+
attr_reader :description
|
|
19
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItemBadge] An optional badge for the level.
|
|
20
|
+
attr_reader :badge
|
|
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 name [String] The name of the level.
|
|
30
|
+
# @param key [String] A unique key for the level. Only alphanumeric characters, hyphens, and
|
|
31
|
+
# underscores are permitted.
|
|
32
|
+
# @param points [Integer] The threshold points value for the level.
|
|
33
|
+
# @param description [String] An optional description of the level.
|
|
34
|
+
# @param badge [TrophyApiClient::CreatePointsLevelRequestItemBadge] An optional badge for the level.
|
|
35
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
36
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItem]
|
|
37
|
+
def initialize(name:, key:, points:, description: OMIT, badge: OMIT, additional_properties: nil)
|
|
38
|
+
@name = name
|
|
39
|
+
@key = key
|
|
40
|
+
@points = points
|
|
41
|
+
@description = description if description != OMIT
|
|
42
|
+
@badge = badge if badge != OMIT
|
|
43
|
+
@additional_properties = additional_properties
|
|
44
|
+
@_field_set = {
|
|
45
|
+
"name": name,
|
|
46
|
+
"key": key,
|
|
47
|
+
"points": points,
|
|
48
|
+
"description": description,
|
|
49
|
+
"badge": badge
|
|
50
|
+
}.reject do |_k, v|
|
|
51
|
+
v == OMIT
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Deserialize a JSON object to an instance of CreatePointsLevelRequestItem
|
|
56
|
+
#
|
|
57
|
+
# @param json_object [String]
|
|
58
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItem]
|
|
59
|
+
def self.from_json(json_object:)
|
|
60
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
61
|
+
parsed_json = JSON.parse(json_object)
|
|
62
|
+
name = parsed_json["name"]
|
|
63
|
+
key = parsed_json["key"]
|
|
64
|
+
points = parsed_json["points"]
|
|
65
|
+
description = parsed_json["description"]
|
|
66
|
+
if parsed_json["badge"].nil?
|
|
67
|
+
badge = nil
|
|
68
|
+
else
|
|
69
|
+
badge = parsed_json["badge"].to_json
|
|
70
|
+
badge = TrophyApiClient::CreatePointsLevelRequestItemBadge.from_json(json_object: badge)
|
|
71
|
+
end
|
|
72
|
+
new(
|
|
73
|
+
name: name,
|
|
74
|
+
key: key,
|
|
75
|
+
points: points,
|
|
76
|
+
description: description,
|
|
77
|
+
badge: badge,
|
|
78
|
+
additional_properties: struct
|
|
79
|
+
)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Serialize an instance of CreatePointsLevelRequestItem to a JSON object
|
|
83
|
+
#
|
|
84
|
+
# @return [String]
|
|
85
|
+
def to_json(*_args)
|
|
86
|
+
@_field_set&.to_json
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
90
|
+
# hash and check each fields type against the current object's property
|
|
91
|
+
# definitions.
|
|
92
|
+
#
|
|
93
|
+
# @param obj [Object]
|
|
94
|
+
# @return [Void]
|
|
95
|
+
def self.validate_raw(obj:)
|
|
96
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
97
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
98
|
+
obj.points.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
|
|
99
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
100
|
+
obj.badge.nil? || TrophyApiClient::CreatePointsLevelRequestItemBadge.validate_raw(obj: obj.badge)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
# An optional badge for the level.
|
|
8
|
+
class CreatePointsLevelRequestItemBadge
|
|
9
|
+
# @return [String] The URL of the badge image.
|
|
10
|
+
attr_reader :url
|
|
11
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
12
|
+
attr_reader :additional_properties
|
|
13
|
+
# @return [Object]
|
|
14
|
+
attr_reader :_field_set
|
|
15
|
+
protected :_field_set
|
|
16
|
+
|
|
17
|
+
OMIT = Object.new
|
|
18
|
+
|
|
19
|
+
# @param url [String] The URL of the badge image.
|
|
20
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItemBadge]
|
|
22
|
+
def initialize(url:, additional_properties: nil)
|
|
23
|
+
@url = url
|
|
24
|
+
@additional_properties = additional_properties
|
|
25
|
+
@_field_set = { "url": url }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Deserialize a JSON object to an instance of CreatePointsLevelRequestItemBadge
|
|
29
|
+
#
|
|
30
|
+
# @param json_object [String]
|
|
31
|
+
# @return [TrophyApiClient::CreatePointsLevelRequestItemBadge]
|
|
32
|
+
def self.from_json(json_object:)
|
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
34
|
+
parsed_json = JSON.parse(json_object)
|
|
35
|
+
url = parsed_json["url"]
|
|
36
|
+
new(url: url, additional_properties: struct)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Serialize an instance of CreatePointsLevelRequestItemBadge to a JSON object
|
|
40
|
+
#
|
|
41
|
+
# @return [String]
|
|
42
|
+
def to_json(*_args)
|
|
43
|
+
@_field_set&.to_json
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
47
|
+
# hash and check each fields type against the current object's property
|
|
48
|
+
# definitions.
|
|
49
|
+
#
|
|
50
|
+
# @param obj [Object]
|
|
51
|
+
# @return [Void]
|
|
52
|
+
def self.validate_raw(obj:)
|
|
53
|
+
obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "admin_points_level"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing created levels and any per-item issues.
|
|
10
|
+
class CreatePointsLevelsResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::AdminPointsLevel>] Array of successfully created levels.
|
|
12
|
+
attr_reader :created
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during level 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::AdminPointsLevel>] Array of successfully created levels.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during level creation.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::CreatePointsLevelsResponse]
|
|
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 CreatePointsLevelsResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::CreatePointsLevelsResponse]
|
|
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::AdminPointsLevel.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 CreatePointsLevelsResponse 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,140 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "create_points_system_request_item_badge"
|
|
4
|
+
require_relative "create_points_level_request_item"
|
|
5
|
+
require_relative "create_points_boost_request_item"
|
|
6
|
+
require_relative "create_points_trigger_request_item"
|
|
7
|
+
require "ostruct"
|
|
8
|
+
require "json"
|
|
9
|
+
|
|
10
|
+
module TrophyApiClient
|
|
11
|
+
# A points system to create. Optionally include sub-entities.
|
|
12
|
+
class CreatePointsSystemRequestItem
|
|
13
|
+
# @return [String] The points system name.
|
|
14
|
+
attr_reader :name
|
|
15
|
+
# @return [String] The points system key. Only alphanumeric characters, hyphens, and underscores
|
|
16
|
+
# are permitted.
|
|
17
|
+
attr_reader :key
|
|
18
|
+
# @return [String] A short description of the points system.
|
|
19
|
+
attr_reader :description
|
|
20
|
+
# @return [TrophyApiClient::CreatePointsSystemRequestItemBadge] An optional badge for the points system.
|
|
21
|
+
attr_reader :badge
|
|
22
|
+
# @return [Integer] Optional maximum points a user can earn.
|
|
23
|
+
attr_reader :max_points
|
|
24
|
+
# @return [Array<TrophyApiClient::CreatePointsLevelRequestItem>] Optional array of levels to create alongside the system.
|
|
25
|
+
attr_reader :levels
|
|
26
|
+
# @return [Array<TrophyApiClient::CreatePointsBoostRequestItem>] Optional array of boosts to create alongside the system.
|
|
27
|
+
attr_reader :boosts
|
|
28
|
+
# @return [Array<TrophyApiClient::CreatePointsTriggerRequestItem>] Optional array of triggers to create alongside the system.
|
|
29
|
+
attr_reader :triggers
|
|
30
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
31
|
+
attr_reader :additional_properties
|
|
32
|
+
# @return [Object]
|
|
33
|
+
attr_reader :_field_set
|
|
34
|
+
protected :_field_set
|
|
35
|
+
|
|
36
|
+
OMIT = Object.new
|
|
37
|
+
|
|
38
|
+
# @param name [String] The points system name.
|
|
39
|
+
# @param key [String] The points system key. Only alphanumeric characters, hyphens, and underscores
|
|
40
|
+
# are permitted.
|
|
41
|
+
# @param description [String] A short description of the points system.
|
|
42
|
+
# @param badge [TrophyApiClient::CreatePointsSystemRequestItemBadge] An optional badge for the points system.
|
|
43
|
+
# @param max_points [Integer] Optional maximum points a user can earn.
|
|
44
|
+
# @param levels [Array<TrophyApiClient::CreatePointsLevelRequestItem>] Optional array of levels to create alongside the system.
|
|
45
|
+
# @param boosts [Array<TrophyApiClient::CreatePointsBoostRequestItem>] Optional array of boosts to create alongside the system.
|
|
46
|
+
# @param triggers [Array<TrophyApiClient::CreatePointsTriggerRequestItem>] Optional array of triggers to create alongside the system.
|
|
47
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
48
|
+
# @return [TrophyApiClient::CreatePointsSystemRequestItem]
|
|
49
|
+
def initialize(name:, key:, description: OMIT, badge: OMIT, max_points: OMIT, levels: OMIT, boosts: OMIT,
|
|
50
|
+
triggers: OMIT, additional_properties: nil)
|
|
51
|
+
@name = name
|
|
52
|
+
@key = key
|
|
53
|
+
@description = description if description != OMIT
|
|
54
|
+
@badge = badge if badge != OMIT
|
|
55
|
+
@max_points = max_points if max_points != OMIT
|
|
56
|
+
@levels = levels if levels != OMIT
|
|
57
|
+
@boosts = boosts if boosts != OMIT
|
|
58
|
+
@triggers = triggers if triggers != OMIT
|
|
59
|
+
@additional_properties = additional_properties
|
|
60
|
+
@_field_set = {
|
|
61
|
+
"name": name,
|
|
62
|
+
"key": key,
|
|
63
|
+
"description": description,
|
|
64
|
+
"badge": badge,
|
|
65
|
+
"maxPoints": max_points,
|
|
66
|
+
"levels": levels,
|
|
67
|
+
"boosts": boosts,
|
|
68
|
+
"triggers": triggers
|
|
69
|
+
}.reject do |_k, v|
|
|
70
|
+
v == OMIT
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Deserialize a JSON object to an instance of CreatePointsSystemRequestItem
|
|
75
|
+
#
|
|
76
|
+
# @param json_object [String]
|
|
77
|
+
# @return [TrophyApiClient::CreatePointsSystemRequestItem]
|
|
78
|
+
def self.from_json(json_object:)
|
|
79
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
80
|
+
parsed_json = JSON.parse(json_object)
|
|
81
|
+
name = parsed_json["name"]
|
|
82
|
+
key = parsed_json["key"]
|
|
83
|
+
description = parsed_json["description"]
|
|
84
|
+
if parsed_json["badge"].nil?
|
|
85
|
+
badge = nil
|
|
86
|
+
else
|
|
87
|
+
badge = parsed_json["badge"].to_json
|
|
88
|
+
badge = TrophyApiClient::CreatePointsSystemRequestItemBadge.from_json(json_object: badge)
|
|
89
|
+
end
|
|
90
|
+
max_points = parsed_json["maxPoints"]
|
|
91
|
+
levels = parsed_json["levels"]&.map do |item|
|
|
92
|
+
item = item.to_json
|
|
93
|
+
TrophyApiClient::CreatePointsLevelRequestItem.from_json(json_object: item)
|
|
94
|
+
end
|
|
95
|
+
boosts = parsed_json["boosts"]&.map do |item|
|
|
96
|
+
item = item.to_json
|
|
97
|
+
TrophyApiClient::CreatePointsBoostRequestItem.from_json(json_object: item)
|
|
98
|
+
end
|
|
99
|
+
triggers = parsed_json["triggers"]&.map do |item|
|
|
100
|
+
item = item.to_json
|
|
101
|
+
TrophyApiClient::CreatePointsTriggerRequestItem.from_json(json_object: item)
|
|
102
|
+
end
|
|
103
|
+
new(
|
|
104
|
+
name: name,
|
|
105
|
+
key: key,
|
|
106
|
+
description: description,
|
|
107
|
+
badge: badge,
|
|
108
|
+
max_points: max_points,
|
|
109
|
+
levels: levels,
|
|
110
|
+
boosts: boosts,
|
|
111
|
+
triggers: triggers,
|
|
112
|
+
additional_properties: struct
|
|
113
|
+
)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Serialize an instance of CreatePointsSystemRequestItem to a JSON object
|
|
117
|
+
#
|
|
118
|
+
# @return [String]
|
|
119
|
+
def to_json(*_args)
|
|
120
|
+
@_field_set&.to_json
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
124
|
+
# hash and check each fields type against the current object's property
|
|
125
|
+
# definitions.
|
|
126
|
+
#
|
|
127
|
+
# @param obj [Object]
|
|
128
|
+
# @return [Void]
|
|
129
|
+
def self.validate_raw(obj:)
|
|
130
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
131
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
132
|
+
obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
|
|
133
|
+
obj.badge.nil? || TrophyApiClient::CreatePointsSystemRequestItemBadge.validate_raw(obj: obj.badge)
|
|
134
|
+
obj.max_points&.is_a?(Integer) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
|
|
135
|
+
obj.levels&.is_a?(Array) != false || raise("Passed value for field obj.levels is not the expected type, validation failed.")
|
|
136
|
+
obj.boosts&.is_a?(Array) != false || raise("Passed value for field obj.boosts is not the expected type, validation failed.")
|
|
137
|
+
obj.triggers&.is_a?(Array) != false || raise("Passed value for field obj.triggers is not the expected type, validation failed.")
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -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
|