trophy_api_client 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gemconfig.rb +1 -1
- data/lib/trophy_api_client/admin/attributes/client.rb +368 -0
- data/lib/trophy_api_client/admin/client.rb +21 -0
- data/lib/trophy_api_client/admin/leaderboards/client.rb +371 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +366 -0
- data/lib/trophy_api_client/types/admin_attribute.rb +81 -0
- data/lib/trophy_api_client/types/admin_attribute_type.rb +9 -0
- data/lib/trophy_api_client/types/admin_leaderboard.rb +171 -0
- data/lib/trophy_api_client/types/admin_leaderboard_rank_by.rb +10 -0
- data/lib/trophy_api_client/types/admin_leaderboard_run_unit.rb +10 -0
- data/lib/trophy_api_client/types/admin_leaderboard_status.rb +11 -0
- data/lib/trophy_api_client/types/create_attribute_request_item.rb +76 -0
- data/lib/trophy_api_client/types/create_attribute_request_item_type.rb +9 -0
- data/lib/trophy_api_client/types/create_attributes_request.rb +7 -0
- data/lib/trophy_api_client/types/create_attributes_response.rb +74 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item.rb +171 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_rank_by.rb +10 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_run_unit.rb +11 -0
- data/lib/trophy_api_client/types/create_leaderboard_request_item_status.rb +13 -0
- data/lib/trophy_api_client/types/create_leaderboards_request.rb +7 -0
- data/lib/trophy_api_client/types/create_leaderboards_response.rb +74 -0
- data/lib/trophy_api_client/types/create_metric_request_item.rb +87 -0
- data/lib/trophy_api_client/types/create_metric_request_item_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/create_metrics_request.rb +7 -0
- data/lib/trophy_api_client/types/create_metrics_response.rb +74 -0
- data/lib/trophy_api_client/types/created_metric.rb +88 -0
- data/lib/trophy_api_client/types/created_metric_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/delete_attributes_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_metrics_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_points_boosts_response.rb +2 -2
- data/lib/trophy_api_client/types/list_attributes_response.rb +7 -0
- data/lib/trophy_api_client/types/list_leaderboards_response.rb +7 -0
- data/lib/trophy_api_client/types/list_metrics_response.rb +7 -0
- data/lib/trophy_api_client/types/metric_response.rb +2 -17
- data/lib/trophy_api_client/types/update_attribute_request_item.rb +69 -0
- data/lib/trophy_api_client/types/update_attributes_request.rb +7 -0
- data/lib/trophy_api_client/types/update_attributes_response.rb +75 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item.rb +179 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_rank_by.rb +11 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_run_unit.rb +9 -0
- data/lib/trophy_api_client/types/update_leaderboard_request_item_status.rb +12 -0
- data/lib/trophy_api_client/types/update_leaderboards_request.rb +7 -0
- data/lib/trophy_api_client/types/update_leaderboards_response.rb +75 -0
- data/lib/trophy_api_client/types/update_metric_request_item.rb +86 -0
- data/lib/trophy_api_client/types/update_metric_request_item_unit_type.rb +9 -0
- data/lib/trophy_api_client/types/update_metrics_request.rb +7 -0
- data/lib/trophy_api_client/types/update_metrics_response.rb +75 -0
- data/lib/trophy_api_client/users/client.rb +2 -2
- data/lib/trophy_api_client/version.rb +1 -1
- data/lib/types_export.rb +51 -12
- metadata +45 -3
- data/lib/trophy_api_client/types/metric_status.rb +0 -9
- data/lib/trophy_api_client/types/notification_type.rb +0 -11
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "created_metric_unit_type"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module TrophyApiClient
|
|
8
|
+
# A successfully created metric returned from the create endpoint.
|
|
9
|
+
class CreatedMetric
|
|
10
|
+
# @return [String] The UUID of the created metric.
|
|
11
|
+
attr_reader :id
|
|
12
|
+
# @return [String] The metric name.
|
|
13
|
+
attr_reader :name
|
|
14
|
+
# @return [String] The metric key.
|
|
15
|
+
attr_reader :key
|
|
16
|
+
# @return [TrophyApiClient::CreatedMetricUnitType] The metric unit type.
|
|
17
|
+
attr_reader :unit_type
|
|
18
|
+
# @return [String] The stored units value for the metric.
|
|
19
|
+
attr_reader :units
|
|
20
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
|
+
attr_reader :additional_properties
|
|
22
|
+
# @return [Object]
|
|
23
|
+
attr_reader :_field_set
|
|
24
|
+
protected :_field_set
|
|
25
|
+
|
|
26
|
+
OMIT = Object.new
|
|
27
|
+
|
|
28
|
+
# @param id [String] The UUID of the created metric.
|
|
29
|
+
# @param name [String] The metric name.
|
|
30
|
+
# @param key [String] The metric key.
|
|
31
|
+
# @param unit_type [TrophyApiClient::CreatedMetricUnitType] The metric unit type.
|
|
32
|
+
# @param units [String] The stored units value for the metric.
|
|
33
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
34
|
+
# @return [TrophyApiClient::CreatedMetric]
|
|
35
|
+
def initialize(id:, name:, key:, unit_type:, units:, additional_properties: nil)
|
|
36
|
+
@id = id
|
|
37
|
+
@name = name
|
|
38
|
+
@key = key
|
|
39
|
+
@unit_type = unit_type
|
|
40
|
+
@units = units
|
|
41
|
+
@additional_properties = additional_properties
|
|
42
|
+
@_field_set = { "id": id, "name": name, "key": key, "unitType": unit_type, "units": units }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Deserialize a JSON object to an instance of CreatedMetric
|
|
46
|
+
#
|
|
47
|
+
# @param json_object [String]
|
|
48
|
+
# @return [TrophyApiClient::CreatedMetric]
|
|
49
|
+
def self.from_json(json_object:)
|
|
50
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
51
|
+
parsed_json = JSON.parse(json_object)
|
|
52
|
+
id = parsed_json["id"]
|
|
53
|
+
name = parsed_json["name"]
|
|
54
|
+
key = parsed_json["key"]
|
|
55
|
+
unit_type = parsed_json["unitType"]
|
|
56
|
+
units = parsed_json["units"]
|
|
57
|
+
new(
|
|
58
|
+
id: id,
|
|
59
|
+
name: name,
|
|
60
|
+
key: key,
|
|
61
|
+
unit_type: unit_type,
|
|
62
|
+
units: units,
|
|
63
|
+
additional_properties: struct
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Serialize an instance of CreatedMetric to a JSON object
|
|
68
|
+
#
|
|
69
|
+
# @return [String]
|
|
70
|
+
def to_json(*_args)
|
|
71
|
+
@_field_set&.to_json
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
75
|
+
# hash and check each fields type against the current object's property
|
|
76
|
+
# definitions.
|
|
77
|
+
#
|
|
78
|
+
# @param obj [Object]
|
|
79
|
+
# @return [Void]
|
|
80
|
+
def self.validate_raw(obj:)
|
|
81
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
82
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
83
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
84
|
+
obj.unit_type.is_a?(TrophyApiClient::CreatedMetricUnitType) != false || raise("Passed value for field obj.unit_type is not the expected type, validation failed.")
|
|
85
|
+
obj.units.is_a?(String) != false || raise("Passed value for field obj.units is not the expected type, validation failed.")
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "deleted_resource"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing deleted attributes represented by ID and any per-item
|
|
10
|
+
# issues, including invalid or missing attribute IDs.
|
|
11
|
+
class DeleteAttributesResponse
|
|
12
|
+
# @return [Array<TrophyApiClient::DeletedResource>] Array of deleted attributes represented by ID.
|
|
13
|
+
attr_reader :deleted
|
|
14
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during attribute deletion.
|
|
15
|
+
attr_reader :issues
|
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
|
+
attr_reader :additional_properties
|
|
18
|
+
# @return [Object]
|
|
19
|
+
attr_reader :_field_set
|
|
20
|
+
protected :_field_set
|
|
21
|
+
|
|
22
|
+
OMIT = Object.new
|
|
23
|
+
|
|
24
|
+
# @param deleted [Array<TrophyApiClient::DeletedResource>] Array of deleted attributes represented by ID.
|
|
25
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during attribute deletion.
|
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
|
+
# @return [TrophyApiClient::DeleteAttributesResponse]
|
|
28
|
+
def initialize(deleted:, issues:, additional_properties: nil)
|
|
29
|
+
@deleted = deleted
|
|
30
|
+
@issues = issues
|
|
31
|
+
@additional_properties = additional_properties
|
|
32
|
+
@_field_set = { "deleted": deleted, "issues": issues }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Deserialize a JSON object to an instance of DeleteAttributesResponse
|
|
36
|
+
#
|
|
37
|
+
# @param json_object [String]
|
|
38
|
+
# @return [TrophyApiClient::DeleteAttributesResponse]
|
|
39
|
+
def self.from_json(json_object:)
|
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
41
|
+
parsed_json = JSON.parse(json_object)
|
|
42
|
+
deleted = parsed_json["deleted"]&.map do |item|
|
|
43
|
+
item = item.to_json
|
|
44
|
+
TrophyApiClient::DeletedResource.from_json(json_object: item)
|
|
45
|
+
end
|
|
46
|
+
issues = parsed_json["issues"]&.map do |item|
|
|
47
|
+
item = item.to_json
|
|
48
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
49
|
+
end
|
|
50
|
+
new(
|
|
51
|
+
deleted: deleted,
|
|
52
|
+
issues: issues,
|
|
53
|
+
additional_properties: struct
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Serialize an instance of DeleteAttributesResponse to a JSON object
|
|
58
|
+
#
|
|
59
|
+
# @return [String]
|
|
60
|
+
def to_json(*_args)
|
|
61
|
+
@_field_set&.to_json
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
65
|
+
# hash and check each fields type against the current object's property
|
|
66
|
+
# definitions.
|
|
67
|
+
#
|
|
68
|
+
# @param obj [Object]
|
|
69
|
+
# @return [Void]
|
|
70
|
+
def self.validate_raw(obj:)
|
|
71
|
+
obj.deleted.is_a?(Array) != false || raise("Passed value for field obj.deleted is not the expected type, validation failed.")
|
|
72
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "deleted_resource"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing deleted leaderboards represented by ID and any per-item
|
|
10
|
+
# issues.
|
|
11
|
+
class DeleteLeaderboardsResponse
|
|
12
|
+
# @return [Array<TrophyApiClient::DeletedResource>] Array of deleted leaderboards represented by ID.
|
|
13
|
+
attr_reader :deleted
|
|
14
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during leaderboard deletion.
|
|
15
|
+
attr_reader :issues
|
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
|
+
attr_reader :additional_properties
|
|
18
|
+
# @return [Object]
|
|
19
|
+
attr_reader :_field_set
|
|
20
|
+
protected :_field_set
|
|
21
|
+
|
|
22
|
+
OMIT = Object.new
|
|
23
|
+
|
|
24
|
+
# @param deleted [Array<TrophyApiClient::DeletedResource>] Array of deleted leaderboards represented by ID.
|
|
25
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during leaderboard deletion.
|
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
|
+
# @return [TrophyApiClient::DeleteLeaderboardsResponse]
|
|
28
|
+
def initialize(deleted:, issues:, additional_properties: nil)
|
|
29
|
+
@deleted = deleted
|
|
30
|
+
@issues = issues
|
|
31
|
+
@additional_properties = additional_properties
|
|
32
|
+
@_field_set = { "deleted": deleted, "issues": issues }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Deserialize a JSON object to an instance of DeleteLeaderboardsResponse
|
|
36
|
+
#
|
|
37
|
+
# @param json_object [String]
|
|
38
|
+
# @return [TrophyApiClient::DeleteLeaderboardsResponse]
|
|
39
|
+
def self.from_json(json_object:)
|
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
41
|
+
parsed_json = JSON.parse(json_object)
|
|
42
|
+
deleted = parsed_json["deleted"]&.map do |item|
|
|
43
|
+
item = item.to_json
|
|
44
|
+
TrophyApiClient::DeletedResource.from_json(json_object: item)
|
|
45
|
+
end
|
|
46
|
+
issues = parsed_json["issues"]&.map do |item|
|
|
47
|
+
item = item.to_json
|
|
48
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
49
|
+
end
|
|
50
|
+
new(
|
|
51
|
+
deleted: deleted,
|
|
52
|
+
issues: issues,
|
|
53
|
+
additional_properties: struct
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Serialize an instance of DeleteLeaderboardsResponse to a JSON object
|
|
58
|
+
#
|
|
59
|
+
# @return [String]
|
|
60
|
+
def to_json(*_args)
|
|
61
|
+
@_field_set&.to_json
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
65
|
+
# hash and check each fields type against the current object's property
|
|
66
|
+
# definitions.
|
|
67
|
+
#
|
|
68
|
+
# @param obj [Object]
|
|
69
|
+
# @return [Void]
|
|
70
|
+
def self.validate_raw(obj:)
|
|
71
|
+
obj.deleted.is_a?(Array) != false || raise("Passed value for field obj.deleted is not the expected type, validation failed.")
|
|
72
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "deleted_resource"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing deleted metrics represented by ID and any per-item issues,
|
|
10
|
+
# including invalid or missing metric IDs.
|
|
11
|
+
class DeleteMetricsResponse
|
|
12
|
+
# @return [Array<TrophyApiClient::DeletedResource>] Array of deleted metrics represented by ID.
|
|
13
|
+
attr_reader :deleted
|
|
14
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during metric deletion.
|
|
15
|
+
attr_reader :issues
|
|
16
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
|
+
attr_reader :additional_properties
|
|
18
|
+
# @return [Object]
|
|
19
|
+
attr_reader :_field_set
|
|
20
|
+
protected :_field_set
|
|
21
|
+
|
|
22
|
+
OMIT = Object.new
|
|
23
|
+
|
|
24
|
+
# @param deleted [Array<TrophyApiClient::DeletedResource>] Array of deleted metrics represented by ID.
|
|
25
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during metric deletion.
|
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
|
+
# @return [TrophyApiClient::DeleteMetricsResponse]
|
|
28
|
+
def initialize(deleted:, issues:, additional_properties: nil)
|
|
29
|
+
@deleted = deleted
|
|
30
|
+
@issues = issues
|
|
31
|
+
@additional_properties = additional_properties
|
|
32
|
+
@_field_set = { "deleted": deleted, "issues": issues }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Deserialize a JSON object to an instance of DeleteMetricsResponse
|
|
36
|
+
#
|
|
37
|
+
# @param json_object [String]
|
|
38
|
+
# @return [TrophyApiClient::DeleteMetricsResponse]
|
|
39
|
+
def self.from_json(json_object:)
|
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
41
|
+
parsed_json = JSON.parse(json_object)
|
|
42
|
+
deleted = parsed_json["deleted"]&.map do |item|
|
|
43
|
+
item = item.to_json
|
|
44
|
+
TrophyApiClient::DeletedResource.from_json(json_object: item)
|
|
45
|
+
end
|
|
46
|
+
issues = parsed_json["issues"]&.map do |item|
|
|
47
|
+
item = item.to_json
|
|
48
|
+
TrophyApiClient::AdminIssue.from_json(json_object: item)
|
|
49
|
+
end
|
|
50
|
+
new(
|
|
51
|
+
deleted: deleted,
|
|
52
|
+
issues: issues,
|
|
53
|
+
additional_properties: struct
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Serialize an instance of DeleteMetricsResponse to a JSON object
|
|
58
|
+
#
|
|
59
|
+
# @return [String]
|
|
60
|
+
def to_json(*_args)
|
|
61
|
+
@_field_set&.to_json
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
65
|
+
# hash and check each fields type against the current object's property
|
|
66
|
+
# definitions.
|
|
67
|
+
#
|
|
68
|
+
# @param obj [Object]
|
|
69
|
+
# @return [Void]
|
|
70
|
+
def self.validate_raw(obj:)
|
|
71
|
+
obj.deleted.is_a?(Array) != false || raise("Passed value for field obj.deleted is not the expected type, validation failed.")
|
|
72
|
+
obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -10,7 +10,7 @@ module TrophyApiClient
|
|
|
10
10
|
class DeletePointsBoostsResponse
|
|
11
11
|
# @return [Array<TrophyApiClient::DeletedResource>] Array of deleted points boosts represented by ID.
|
|
12
12
|
attr_reader :deleted
|
|
13
|
-
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost deletion.
|
|
14
14
|
attr_reader :issues
|
|
15
15
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
16
16
|
attr_reader :additional_properties
|
|
@@ -21,7 +21,7 @@ module TrophyApiClient
|
|
|
21
21
|
OMIT = Object.new
|
|
22
22
|
|
|
23
23
|
# @param deleted [Array<TrophyApiClient::DeletedResource>] Array of deleted points boosts represented by ID.
|
|
24
|
-
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost deletion.
|
|
25
25
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
26
|
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
27
27
|
def initialize(deleted:, issues:, additional_properties: nil)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "metric_status"
|
|
4
3
|
require_relative "user_achievement_response"
|
|
5
4
|
require "ostruct"
|
|
6
5
|
require "json"
|
|
@@ -13,8 +12,6 @@ module TrophyApiClient
|
|
|
13
12
|
attr_reader :key
|
|
14
13
|
# @return [String] The name of the metric.
|
|
15
14
|
attr_reader :name
|
|
16
|
-
# @return [TrophyApiClient::MetricStatus] The status of the metric.
|
|
17
|
-
attr_reader :status
|
|
18
15
|
# @return [Float] The user's current total for the metric.
|
|
19
16
|
attr_reader :current
|
|
20
17
|
# @return [Array<TrophyApiClient::UserAchievementResponse>] A list of the metric's achievements and the user's progress towards each.
|
|
@@ -30,27 +27,18 @@ module TrophyApiClient
|
|
|
30
27
|
# @param id [String] The unique ID of the metric.
|
|
31
28
|
# @param key [String] The unique key of the metric.
|
|
32
29
|
# @param name [String] The name of the metric.
|
|
33
|
-
# @param status [TrophyApiClient::MetricStatus] The status of the metric.
|
|
34
30
|
# @param current [Float] The user's current total for the metric.
|
|
35
31
|
# @param achievements [Array<TrophyApiClient::UserAchievementResponse>] A list of the metric's achievements and the user's progress towards each.
|
|
36
32
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
37
33
|
# @return [TrophyApiClient::MetricResponse]
|
|
38
|
-
def initialize(id:, key:, name:,
|
|
34
|
+
def initialize(id:, key:, name:, current:, achievements:, additional_properties: nil)
|
|
39
35
|
@id = id
|
|
40
36
|
@key = key
|
|
41
37
|
@name = name
|
|
42
|
-
@status = status
|
|
43
38
|
@current = current
|
|
44
39
|
@achievements = achievements
|
|
45
40
|
@additional_properties = additional_properties
|
|
46
|
-
@_field_set = {
|
|
47
|
-
"id": id,
|
|
48
|
-
"key": key,
|
|
49
|
-
"name": name,
|
|
50
|
-
"status": status,
|
|
51
|
-
"current": current,
|
|
52
|
-
"achievements": achievements
|
|
53
|
-
}
|
|
41
|
+
@_field_set = { "id": id, "key": key, "name": name, "current": current, "achievements": achievements }
|
|
54
42
|
end
|
|
55
43
|
|
|
56
44
|
# Deserialize a JSON object to an instance of MetricResponse
|
|
@@ -63,7 +51,6 @@ module TrophyApiClient
|
|
|
63
51
|
id = parsed_json["id"]
|
|
64
52
|
key = parsed_json["key"]
|
|
65
53
|
name = parsed_json["name"]
|
|
66
|
-
status = parsed_json["status"]
|
|
67
54
|
current = parsed_json["current"]
|
|
68
55
|
achievements = parsed_json["achievements"]&.map do |item|
|
|
69
56
|
item = item.to_json
|
|
@@ -73,7 +60,6 @@ module TrophyApiClient
|
|
|
73
60
|
id: id,
|
|
74
61
|
key: key,
|
|
75
62
|
name: name,
|
|
76
|
-
status: status,
|
|
77
63
|
current: current,
|
|
78
64
|
achievements: achievements,
|
|
79
65
|
additional_properties: struct
|
|
@@ -97,7 +83,6 @@ module TrophyApiClient
|
|
|
97
83
|
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
98
84
|
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
99
85
|
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
100
|
-
obj.status.is_a?(TrophyApiClient::MetricStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
|
101
86
|
obj.current.is_a?(Float) != false || raise("Passed value for field obj.current is not the expected type, validation failed.")
|
|
102
87
|
obj.achievements.is_a?(Array) != false || raise("Passed value for field obj.achievements is not the expected type, validation failed.")
|
|
103
88
|
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "ostruct"
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module TrophyApiClient
|
|
7
|
+
# An attribute update object. `id` is required and `name` is optional. `key` and
|
|
8
|
+
# `type` cannot be changed through this endpoint.
|
|
9
|
+
class UpdateAttributeRequestItem
|
|
10
|
+
# @return [String] The UUID of the attribute to update.
|
|
11
|
+
attr_reader :id
|
|
12
|
+
# @return [String] The updated attribute name.
|
|
13
|
+
attr_reader :name
|
|
14
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
15
|
+
attr_reader :additional_properties
|
|
16
|
+
# @return [Object]
|
|
17
|
+
attr_reader :_field_set
|
|
18
|
+
protected :_field_set
|
|
19
|
+
|
|
20
|
+
OMIT = Object.new
|
|
21
|
+
|
|
22
|
+
# @param id [String] The UUID of the attribute to update.
|
|
23
|
+
# @param name [String] The updated attribute name.
|
|
24
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
25
|
+
# @return [TrophyApiClient::UpdateAttributeRequestItem]
|
|
26
|
+
def initialize(id:, name: OMIT, additional_properties: nil)
|
|
27
|
+
@id = id
|
|
28
|
+
@name = name if name != OMIT
|
|
29
|
+
@additional_properties = additional_properties
|
|
30
|
+
@_field_set = { "id": id, "name": name }.reject do |_k, v|
|
|
31
|
+
v == OMIT
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Deserialize a JSON object to an instance of UpdateAttributeRequestItem
|
|
36
|
+
#
|
|
37
|
+
# @param json_object [String]
|
|
38
|
+
# @return [TrophyApiClient::UpdateAttributeRequestItem]
|
|
39
|
+
def self.from_json(json_object:)
|
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
41
|
+
parsed_json = JSON.parse(json_object)
|
|
42
|
+
id = parsed_json["id"]
|
|
43
|
+
name = parsed_json["name"]
|
|
44
|
+
new(
|
|
45
|
+
id: id,
|
|
46
|
+
name: name,
|
|
47
|
+
additional_properties: struct
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Serialize an instance of UpdateAttributeRequestItem to a JSON object
|
|
52
|
+
#
|
|
53
|
+
# @return [String]
|
|
54
|
+
def to_json(*_args)
|
|
55
|
+
@_field_set&.to_json
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
|
59
|
+
# hash and check each fields type against the current object's property
|
|
60
|
+
# definitions.
|
|
61
|
+
#
|
|
62
|
+
# @param obj [Object]
|
|
63
|
+
# @return [Void]
|
|
64
|
+
def self.validate_raw(obj:)
|
|
65
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
|
66
|
+
obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "admin_attribute"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing updated attributes and any per-item issues identified by
|
|
10
|
+
# attribute ID.
|
|
11
|
+
class UpdateAttributesResponse
|
|
12
|
+
# @return [Array<TrophyApiClient::AdminAttribute>] Array of successfully updated attributes.
|
|
13
|
+
attr_reader :updated
|
|
14
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during attribute 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::AdminAttribute>] Array of successfully updated attributes.
|
|
25
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during attribute update.
|
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
|
+
# @return [TrophyApiClient::UpdateAttributesResponse]
|
|
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 UpdateAttributesResponse
|
|
36
|
+
#
|
|
37
|
+
# @param json_object [String]
|
|
38
|
+
# @return [TrophyApiClient::UpdateAttributesResponse]
|
|
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::AdminAttribute.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 UpdateAttributesResponse 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
|