trophy_api_client 1.4.0 → 1.6.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 +14 -0
- data/lib/trophy_api_client/admin/metrics/client.rb +366 -0
- data/lib/trophy_api_client/admin/points/boosts/client.rb +6 -74
- 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/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_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_metrics_response.rb +75 -0
- data/lib/trophy_api_client/types/delete_points_boosts_response.rb +5 -6
- data/lib/trophy_api_client/types/deleted_resource.rb +3 -3
- data/lib/trophy_api_client/types/list_attributes_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_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/version.rb +1 -1
- data/lib/types_export.rb +23 -1
- metadata +26 -2
- data/lib/trophy_api_client/types/metric_status.rb +0 -9
|
@@ -0,0 +1,74 @@
|
|
|
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 created attributes and any per-item issues.
|
|
10
|
+
class CreateAttributesResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::AdminAttribute>] Array of successfully created attributes.
|
|
12
|
+
attr_reader :created
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during attribute 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::AdminAttribute>] Array of successfully created attributes.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during attribute creation.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::CreateAttributesResponse]
|
|
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 CreateAttributesResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::CreateAttributesResponse]
|
|
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::AdminAttribute.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 CreateAttributesResponse 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,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "create_metric_request_item_unit_type"
|
|
4
|
+
require "ostruct"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module TrophyApiClient
|
|
8
|
+
# A metric to create.
|
|
9
|
+
class CreateMetricRequestItem
|
|
10
|
+
# @return [String] The metric name.
|
|
11
|
+
attr_reader :name
|
|
12
|
+
# @return [String] The metric key. Only alphanumeric characters, hyphens, and underscores are
|
|
13
|
+
# permitted.
|
|
14
|
+
attr_reader :key
|
|
15
|
+
# @return [TrophyApiClient::CreateMetricRequestItemUnitType] The metric unit type. Defaults to `number`.
|
|
16
|
+
attr_reader :unit_type
|
|
17
|
+
# @return [String] For `unitType: currency`, this must be a supported `MetricCurrency` code such as
|
|
18
|
+
# `USD`. For `number`, this is an optional freeform unit label.
|
|
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 name [String] The metric name.
|
|
29
|
+
# @param key [String] The metric key. Only alphanumeric characters, hyphens, and underscores are
|
|
30
|
+
# permitted.
|
|
31
|
+
# @param unit_type [TrophyApiClient::CreateMetricRequestItemUnitType] The metric unit type. Defaults to `number`.
|
|
32
|
+
# @param units [String] For `unitType: currency`, this must be a supported `MetricCurrency` code such as
|
|
33
|
+
# `USD`. For `number`, this is an optional freeform unit label.
|
|
34
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
35
|
+
# @return [TrophyApiClient::CreateMetricRequestItem]
|
|
36
|
+
def initialize(name:, key:, unit_type: OMIT, units: OMIT, additional_properties: nil)
|
|
37
|
+
@name = name
|
|
38
|
+
@key = key
|
|
39
|
+
@unit_type = unit_type if unit_type != OMIT
|
|
40
|
+
@units = units if units != OMIT
|
|
41
|
+
@additional_properties = additional_properties
|
|
42
|
+
@_field_set = { "name": name, "key": key, "unitType": unit_type, "units": units }.reject do |_k, v|
|
|
43
|
+
v == OMIT
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Deserialize a JSON object to an instance of CreateMetricRequestItem
|
|
48
|
+
#
|
|
49
|
+
# @param json_object [String]
|
|
50
|
+
# @return [TrophyApiClient::CreateMetricRequestItem]
|
|
51
|
+
def self.from_json(json_object:)
|
|
52
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
|
53
|
+
parsed_json = JSON.parse(json_object)
|
|
54
|
+
name = parsed_json["name"]
|
|
55
|
+
key = parsed_json["key"]
|
|
56
|
+
unit_type = parsed_json["unitType"]
|
|
57
|
+
units = parsed_json["units"]
|
|
58
|
+
new(
|
|
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 CreateMetricRequestItem 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.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
|
82
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
|
83
|
+
obj.unit_type&.is_a?(TrophyApiClient::CreateMetricRequestItemUnitType) != false || raise("Passed value for field obj.unit_type is not the expected type, validation failed.")
|
|
84
|
+
obj.units&.is_a?(String) != false || raise("Passed value for field obj.units is not the expected type, validation failed.")
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "created_metric"
|
|
4
|
+
require_relative "admin_issue"
|
|
5
|
+
require "ostruct"
|
|
6
|
+
require "json"
|
|
7
|
+
|
|
8
|
+
module TrophyApiClient
|
|
9
|
+
# Response containing created metrics and any per-item issues.
|
|
10
|
+
class CreateMetricsResponse
|
|
11
|
+
# @return [Array<TrophyApiClient::CreatedMetric>] Array of successfully created metrics.
|
|
12
|
+
attr_reader :created
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during metric 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::CreatedMetric>] Array of successfully created metrics.
|
|
24
|
+
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during metric creation.
|
|
25
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
26
|
+
# @return [TrophyApiClient::CreateMetricsResponse]
|
|
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 CreateMetricsResponse
|
|
35
|
+
#
|
|
36
|
+
# @param json_object [String]
|
|
37
|
+
# @return [TrophyApiClient::CreateMetricsResponse]
|
|
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::CreatedMetric.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 CreateMetricsResponse 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,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 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
|
|
@@ -6,12 +6,11 @@ require "ostruct"
|
|
|
6
6
|
require "json"
|
|
7
7
|
|
|
8
8
|
module TrophyApiClient
|
|
9
|
-
# Response containing the points boosts that were
|
|
10
|
-
# issues.
|
|
9
|
+
# Response containing the points boosts that were deleted and any per-item issues.
|
|
11
10
|
class DeletePointsBoostsResponse
|
|
12
|
-
# @return [Array<TrophyApiClient::DeletedResource>] Array of
|
|
11
|
+
# @return [Array<TrophyApiClient::DeletedResource>] Array of deleted points boosts represented by ID.
|
|
13
12
|
attr_reader :deleted
|
|
14
|
-
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost
|
|
13
|
+
# @return [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost deletion.
|
|
15
14
|
attr_reader :issues
|
|
16
15
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
17
16
|
attr_reader :additional_properties
|
|
@@ -21,8 +20,8 @@ module TrophyApiClient
|
|
|
21
20
|
|
|
22
21
|
OMIT = Object.new
|
|
23
22
|
|
|
24
|
-
# @param deleted [Array<TrophyApiClient::DeletedResource>] Array of
|
|
25
|
-
# @param issues [Array<TrophyApiClient::AdminIssue>] Array of issues encountered during boost
|
|
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 deletion.
|
|
26
25
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
27
26
|
# @return [TrophyApiClient::DeletePointsBoostsResponse]
|
|
28
27
|
def initialize(deleted:, issues:, additional_properties: nil)
|
|
@@ -4,9 +4,9 @@ require "ostruct"
|
|
|
4
4
|
require "json"
|
|
5
5
|
|
|
6
6
|
module TrophyApiClient
|
|
7
|
-
# A
|
|
7
|
+
# A deleted resource represented by ID.
|
|
8
8
|
class DeletedResource
|
|
9
|
-
# @return [String] The ID of the
|
|
9
|
+
# @return [String] The ID of the deleted resource.
|
|
10
10
|
attr_reader :id
|
|
11
11
|
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
|
12
12
|
attr_reader :additional_properties
|
|
@@ -16,7 +16,7 @@ module TrophyApiClient
|
|
|
16
16
|
|
|
17
17
|
OMIT = Object.new
|
|
18
18
|
|
|
19
|
-
# @param id [String] The ID of the
|
|
19
|
+
# @param id [String] The ID of the deleted resource.
|
|
20
20
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
|
21
21
|
# @return [TrophyApiClient::DeletedResource]
|
|
22
22
|
def initialize(id:, 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
|