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