trophy_api_client 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/trophy_api_client/admin/attributes/client.rb +6 -6
  4. data/lib/trophy_api_client/admin/client.rb +14 -7
  5. data/lib/trophy_api_client/admin/leaderboards/client.rb +371 -0
  6. data/lib/trophy_api_client/admin/metrics/client.rb +6 -6
  7. data/lib/trophy_api_client/admin/points/boosts/client.rb +258 -39
  8. data/lib/trophy_api_client/admin/points/client.rb +21 -0
  9. data/lib/trophy_api_client/admin/points/levels/client.rb +402 -0
  10. data/lib/trophy_api_client/admin/points/systems/client.rb +374 -0
  11. data/lib/trophy_api_client/admin/points/triggers/client.rb +402 -0
  12. data/lib/trophy_api_client/types/admin_leaderboard.rb +171 -0
  13. data/lib/trophy_api_client/types/admin_leaderboard_rank_by.rb +10 -0
  14. data/lib/trophy_api_client/types/admin_leaderboard_run_unit.rb +10 -0
  15. data/lib/trophy_api_client/types/admin_leaderboard_status.rb +11 -0
  16. data/lib/trophy_api_client/types/{created_points_boost.rb → admin_points_boost.rb} +39 -23
  17. data/lib/trophy_api_client/types/{created_points_boost_rounding.rb → admin_points_boost_rounding.rb} +1 -1
  18. data/lib/trophy_api_client/types/{created_points_boost_status.rb → admin_points_boost_status.rb} +1 -1
  19. data/lib/trophy_api_client/types/admin_points_boost_user_attributes_item.rb +65 -0
  20. data/lib/trophy_api_client/types/admin_points_level.rb +109 -0
  21. data/lib/trophy_api_client/types/admin_points_level_badge.rb +55 -0
  22. data/lib/trophy_api_client/types/admin_points_system.rb +118 -0
  23. data/lib/trophy_api_client/types/admin_points_system_badge.rb +55 -0
  24. data/lib/trophy_api_client/types/admin_points_system_status.rb +9 -0
  25. data/lib/trophy_api_client/types/admin_points_trigger.rb +175 -0
  26. data/lib/trophy_api_client/types/admin_points_trigger_event_attributes_item.rb +66 -0
  27. data/lib/trophy_api_client/types/admin_points_trigger_status.rb +9 -0
  28. data/lib/trophy_api_client/types/admin_points_trigger_time_unit.rb +9 -0
  29. data/lib/trophy_api_client/types/admin_points_trigger_type.rb +12 -0
  30. data/lib/trophy_api_client/types/admin_points_trigger_user_attributes_item.rb +65 -0
  31. data/lib/trophy_api_client/types/create_leaderboard_request_item.rb +171 -0
  32. data/lib/trophy_api_client/types/create_leaderboard_request_item_rank_by.rb +10 -0
  33. data/lib/trophy_api_client/types/create_leaderboard_request_item_run_unit.rb +11 -0
  34. data/lib/trophy_api_client/types/create_leaderboard_request_item_status.rb +13 -0
  35. data/lib/trophy_api_client/types/create_leaderboards_request.rb +7 -0
  36. data/lib/trophy_api_client/types/create_leaderboards_response.rb +74 -0
  37. data/lib/trophy_api_client/types/create_points_boost_request_item.rb +125 -0
  38. data/lib/trophy_api_client/types/create_points_boost_request_item_rounding.rb +10 -0
  39. data/lib/trophy_api_client/types/create_points_boost_request_item_user_attributes_item.rb +67 -0
  40. data/lib/trophy_api_client/types/create_points_boosts_request.rb +7 -0
  41. data/lib/trophy_api_client/types/create_points_boosts_response.rb +4 -4
  42. data/lib/trophy_api_client/types/create_points_level_request_item.rb +103 -0
  43. data/lib/trophy_api_client/types/create_points_level_request_item_badge.rb +56 -0
  44. data/lib/trophy_api_client/types/create_points_levels_request.rb +7 -0
  45. data/lib/trophy_api_client/types/create_points_levels_response.rb +74 -0
  46. data/lib/trophy_api_client/types/create_points_system_request_item.rb +140 -0
  47. data/lib/trophy_api_client/types/create_points_system_request_item_badge.rb +55 -0
  48. data/lib/trophy_api_client/types/create_points_systems_request.rb +7 -0
  49. data/lib/trophy_api_client/types/create_points_systems_response.rb +74 -0
  50. data/lib/trophy_api_client/types/create_points_trigger_request_item.rb +167 -0
  51. data/lib/trophy_api_client/types/create_points_trigger_request_item_event_attributes_item.rb +67 -0
  52. data/lib/trophy_api_client/types/create_points_trigger_request_item_status.rb +9 -0
  53. data/lib/trophy_api_client/types/create_points_trigger_request_item_time_unit.rb +9 -0
  54. data/lib/trophy_api_client/types/create_points_trigger_request_item_type.rb +12 -0
  55. data/lib/trophy_api_client/types/create_points_trigger_request_item_user_attributes_item.rb +67 -0
  56. data/lib/trophy_api_client/types/create_points_triggers_request.rb +7 -0
  57. data/lib/trophy_api_client/types/create_points_triggers_response.rb +74 -0
  58. data/lib/trophy_api_client/types/created_admin_points_system.rb +163 -0
  59. data/lib/trophy_api_client/types/delete_leaderboards_response.rb +75 -0
  60. data/lib/trophy_api_client/types/delete_points_levels_response.rb +74 -0
  61. data/lib/trophy_api_client/types/delete_points_systems_response.rb +74 -0
  62. data/lib/trophy_api_client/types/delete_points_triggers_response.rb +75 -0
  63. data/lib/trophy_api_client/types/list_leaderboards_response.rb +7 -0
  64. data/lib/trophy_api_client/types/list_points_boosts_response.rb +7 -0
  65. data/lib/trophy_api_client/types/list_points_levels_response.rb +7 -0
  66. data/lib/trophy_api_client/types/list_points_systems_response.rb +7 -0
  67. data/lib/trophy_api_client/types/list_points_triggers_response.rb +7 -0
  68. data/lib/trophy_api_client/types/patch_points_boosts_request.rb +7 -0
  69. data/lib/trophy_api_client/types/patch_points_boosts_request_item.rb +118 -0
  70. data/lib/trophy_api_client/types/patch_points_boosts_request_item_rounding.rb +10 -0
  71. data/lib/trophy_api_client/types/patch_points_boosts_request_item_user_attributes_item.rb +67 -0
  72. data/lib/trophy_api_client/types/patch_points_boosts_response.rb +74 -0
  73. data/lib/trophy_api_client/types/patch_points_levels_request.rb +7 -0
  74. data/lib/trophy_api_client/types/patch_points_levels_request_item.rb +100 -0
  75. data/lib/trophy_api_client/types/patch_points_levels_request_item_badge.rb +55 -0
  76. data/lib/trophy_api_client/types/patch_points_levels_response.rb +74 -0
  77. data/lib/trophy_api_client/types/patch_points_triggers_request.rb +7 -0
  78. data/lib/trophy_api_client/types/patch_points_triggers_request_item.rb +174 -0
  79. data/lib/trophy_api_client/types/patch_points_triggers_request_item_event_attributes_item.rb +67 -0
  80. data/lib/trophy_api_client/types/patch_points_triggers_request_item_status.rb +9 -0
  81. data/lib/trophy_api_client/types/patch_points_triggers_request_item_time_unit.rb +9 -0
  82. data/lib/trophy_api_client/types/patch_points_triggers_request_item_type.rb +13 -0
  83. data/lib/trophy_api_client/types/patch_points_triggers_request_item_user_attributes_item.rb +67 -0
  84. data/lib/trophy_api_client/types/patch_points_triggers_response.rb +74 -0
  85. data/lib/trophy_api_client/types/update_leaderboard_request_item.rb +179 -0
  86. data/lib/trophy_api_client/types/update_leaderboard_request_item_rank_by.rb +11 -0
  87. data/lib/trophy_api_client/types/update_leaderboard_request_item_run_unit.rb +9 -0
  88. data/lib/trophy_api_client/types/update_leaderboard_request_item_status.rb +12 -0
  89. data/lib/trophy_api_client/types/update_leaderboards_request.rb +7 -0
  90. data/lib/trophy_api_client/types/update_leaderboards_response.rb +75 -0
  91. data/lib/trophy_api_client/types/update_points_system_request_item.rb +102 -0
  92. data/lib/trophy_api_client/types/update_points_system_request_item_badge.rb +55 -0
  93. data/lib/trophy_api_client/types/update_points_systems_request.rb +7 -0
  94. data/lib/trophy_api_client/types/update_points_systems_response.rb +74 -0
  95. data/lib/trophy_api_client/users/client.rb +2 -2
  96. data/lib/trophy_api_client/version.rb +1 -1
  97. data/lib/types_export.rb +93 -17
  98. metadata +87 -7
  99. data/lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item.rb +0 -111
  100. data/lib/trophy_api_client/admin/points/boosts/types/create_points_boosts_request_boosts_item_rounding.rb +0 -16
  101. data/lib/trophy_api_client/types/notification_type.rb +0 -11
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "created_points_boost_status"
4
- require_relative "created_points_boost_rounding"
3
+ require_relative "admin_points_boost_status"
4
+ require_relative "admin_points_boost_rounding"
5
+ require_relative "admin_points_boost_user_attributes_item"
5
6
  require "ostruct"
6
7
  require "json"
7
8
 
8
9
  module TrophyApiClient
9
- # A successfully created points boost returned from the create endpoint.
10
- class CreatedPointsBoost
11
- # @return [String] The UUID of the created boost.
10
+ # A points boost as returned from admin endpoints.
11
+ class AdminPointsBoost
12
+ # @return [String] The UUID of the boost.
12
13
  attr_reader :id
13
14
  # @return [String] The name of the boost.
14
15
  attr_reader :name
15
- # @return [TrophyApiClient::CreatedPointsBoostStatus] The status of the boost.
16
+ # @return [TrophyApiClient::AdminPointsBoostStatus] The status of the boost.
16
17
  attr_reader :status
17
18
  # @return [String] The start date (YYYY-MM-DD).
18
19
  attr_reader :start
@@ -20,10 +21,14 @@ module TrophyApiClient
20
21
  attr_reader :end_
21
22
  # @return [Float] The points multiplier.
22
23
  attr_reader :multiplier
23
- # @return [TrophyApiClient::CreatedPointsBoostRounding] How boosted points are rounded.
24
+ # @return [TrophyApiClient::AdminPointsBoostRounding] How boosted points are rounded.
24
25
  attr_reader :rounding
25
- # @return [String] The customer ID of the user the boost was created for.
26
+ # @return [String] The customer ID of the user the boost was created for, or null for
27
+ # global/attribute-filtered boosts.
26
28
  attr_reader :user_id
29
+ # @return [Array<TrophyApiClient::AdminPointsBoostUserAttributesItem>] User attribute filters applied to the boost. Only present for non-user-specific
30
+ # boosts (i.e. when `userId` is null). Empty array if no filters are set.
31
+ attr_reader :user_attributes
27
32
  # @return [OpenStruct] Additional properties unmapped to the current class definition
28
33
  attr_reader :additional_properties
29
34
  # @return [Object]
@@ -32,18 +37,21 @@ module TrophyApiClient
32
37
 
33
38
  OMIT = Object.new
34
39
 
35
- # @param id [String] The UUID of the created boost.
40
+ # @param id [String] The UUID of the boost.
36
41
  # @param name [String] The name of the boost.
37
- # @param status [TrophyApiClient::CreatedPointsBoostStatus] The status of the boost.
42
+ # @param status [TrophyApiClient::AdminPointsBoostStatus] The status of the boost.
38
43
  # @param start [String] The start date (YYYY-MM-DD).
39
44
  # @param end_ [String] The end date (YYYY-MM-DD) or null if no end date.
40
45
  # @param multiplier [Float] The points multiplier.
41
- # @param rounding [TrophyApiClient::CreatedPointsBoostRounding] How boosted points are rounded.
42
- # @param user_id [String] The customer ID of the user the boost was created for.
46
+ # @param rounding [TrophyApiClient::AdminPointsBoostRounding] How boosted points are rounded.
47
+ # @param user_id [String] The customer ID of the user the boost was created for, or null for
48
+ # global/attribute-filtered boosts.
49
+ # @param user_attributes [Array<TrophyApiClient::AdminPointsBoostUserAttributesItem>] User attribute filters applied to the boost. Only present for non-user-specific
50
+ # boosts (i.e. when `userId` is null). Empty array if no filters are set.
43
51
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
44
- # @return [TrophyApiClient::CreatedPointsBoost]
45
- def initialize(id:, name:, status:, start:, multiplier:, rounding:, user_id:, end_: OMIT,
46
- additional_properties: nil)
52
+ # @return [TrophyApiClient::AdminPointsBoost]
53
+ def initialize(id:, name:, status:, start:, multiplier:, rounding:, end_: OMIT, user_id: OMIT,
54
+ user_attributes: OMIT, additional_properties: nil)
47
55
  @id = id
48
56
  @name = name
49
57
  @status = status
@@ -51,7 +59,8 @@ module TrophyApiClient
51
59
  @end_ = end_ if end_ != OMIT
52
60
  @multiplier = multiplier
53
61
  @rounding = rounding
54
- @user_id = user_id
62
+ @user_id = user_id if user_id != OMIT
63
+ @user_attributes = user_attributes if user_attributes != OMIT
55
64
  @additional_properties = additional_properties
56
65
  @_field_set = {
57
66
  "id": id,
@@ -61,16 +70,17 @@ module TrophyApiClient
61
70
  "end": end_,
62
71
  "multiplier": multiplier,
63
72
  "rounding": rounding,
64
- "userId": user_id
73
+ "userId": user_id,
74
+ "userAttributes": user_attributes
65
75
  }.reject do |_k, v|
66
76
  v == OMIT
67
77
  end
68
78
  end
69
79
 
70
- # Deserialize a JSON object to an instance of CreatedPointsBoost
80
+ # Deserialize a JSON object to an instance of AdminPointsBoost
71
81
  #
72
82
  # @param json_object [String]
73
- # @return [TrophyApiClient::CreatedPointsBoost]
83
+ # @return [TrophyApiClient::AdminPointsBoost]
74
84
  def self.from_json(json_object:)
75
85
  struct = JSON.parse(json_object, object_class: OpenStruct)
76
86
  parsed_json = JSON.parse(json_object)
@@ -82,6 +92,10 @@ module TrophyApiClient
82
92
  multiplier = parsed_json["multiplier"]
83
93
  rounding = parsed_json["rounding"]
84
94
  user_id = parsed_json["userId"]
95
+ user_attributes = parsed_json["userAttributes"]&.map do |item|
96
+ item = item.to_json
97
+ TrophyApiClient::AdminPointsBoostUserAttributesItem.from_json(json_object: item)
98
+ end
85
99
  new(
86
100
  id: id,
87
101
  name: name,
@@ -91,11 +105,12 @@ module TrophyApiClient
91
105
  multiplier: multiplier,
92
106
  rounding: rounding,
93
107
  user_id: user_id,
108
+ user_attributes: user_attributes,
94
109
  additional_properties: struct
95
110
  )
96
111
  end
97
112
 
98
- # Serialize an instance of CreatedPointsBoost to a JSON object
113
+ # Serialize an instance of AdminPointsBoost to a JSON object
99
114
  #
100
115
  # @return [String]
101
116
  def to_json(*_args)
@@ -111,12 +126,13 @@ module TrophyApiClient
111
126
  def self.validate_raw(obj:)
112
127
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
113
128
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
114
- obj.status.is_a?(TrophyApiClient::CreatedPointsBoostStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
129
+ obj.status.is_a?(TrophyApiClient::AdminPointsBoostStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
115
130
  obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
116
131
  obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
117
132
  obj.multiplier.is_a?(Float) != false || raise("Passed value for field obj.multiplier is not the expected type, validation failed.")
118
- obj.rounding.is_a?(TrophyApiClient::CreatedPointsBoostRounding) != false || raise("Passed value for field obj.rounding is not the expected type, validation failed.")
119
- obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
133
+ obj.rounding.is_a?(TrophyApiClient::AdminPointsBoostRounding) != false || raise("Passed value for field obj.rounding is not the expected type, validation failed.")
134
+ obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
135
+ obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
120
136
  end
121
137
  end
122
138
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  # How boosted points are rounded.
5
- class CreatedPointsBoostRounding
5
+ class AdminPointsBoostRounding
6
6
  DOWN = "down"
7
7
  UP = "up"
8
8
  NEAREST = "nearest"
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  # The status of the boost.
5
- class CreatedPointsBoostStatus
5
+ class AdminPointsBoostStatus
6
6
  ACTIVE = "active"
7
7
  SCHEDULED = "scheduled"
8
8
  FINISHED = "finished"
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module TrophyApiClient
7
+ class AdminPointsBoostUserAttributesItem
8
+ # @return [String] The UUID of the user attribute.
9
+ attr_reader :attribute_id
10
+ # @return [String] The matched attribute value.
11
+ attr_reader :attribute_value
12
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
13
+ attr_reader :additional_properties
14
+ # @return [Object]
15
+ attr_reader :_field_set
16
+ protected :_field_set
17
+
18
+ OMIT = Object.new
19
+
20
+ # @param attribute_id [String] The UUID of the user attribute.
21
+ # @param attribute_value [String] The matched attribute value.
22
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
+ # @return [TrophyApiClient::AdminPointsBoostUserAttributesItem]
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 AdminPointsBoostUserAttributesItem
32
+ #
33
+ # @param json_object [String]
34
+ # @return [TrophyApiClient::AdminPointsBoostUserAttributesItem]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ parsed_json = JSON.parse(json_object)
38
+ attribute_id = parsed_json["attributeId"]
39
+ attribute_value = parsed_json["attributeValue"]
40
+ new(
41
+ attribute_id: attribute_id,
42
+ attribute_value: attribute_value,
43
+ additional_properties: struct
44
+ )
45
+ end
46
+
47
+ # Serialize an instance of AdminPointsBoostUserAttributesItem to a JSON object
48
+ #
49
+ # @return [String]
50
+ def to_json(*_args)
51
+ @_field_set&.to_json
52
+ end
53
+
54
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
55
+ # hash and check each fields type against the current object's property
56
+ # definitions.
57
+ #
58
+ # @param obj [Object]
59
+ # @return [Void]
60
+ def self.validate_raw(obj:)
61
+ obj.attribute_id.is_a?(String) != false || raise("Passed value for field obj.attribute_id is not the expected type, validation failed.")
62
+ obj.attribute_value.is_a?(String) != false || raise("Passed value for field obj.attribute_value is not the expected type, validation failed.")
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_points_level_badge"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module TrophyApiClient
8
+ # A points level as returned from admin endpoints.
9
+ class AdminPointsLevel
10
+ # @return [String] The UUID of the level.
11
+ attr_reader :id
12
+ # @return [String] The name of the level.
13
+ attr_reader :name
14
+ # @return [String] The level key.
15
+ attr_reader :key
16
+ # @return [Integer] The threshold points value for the level.
17
+ attr_reader :points
18
+ # @return [String] The level description.
19
+ attr_reader :description
20
+ # @return [TrophyApiClient::AdminPointsLevelBadge] The badge for the level, or null if no badge is set.
21
+ attr_reader :badge
22
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
23
+ attr_reader :additional_properties
24
+ # @return [Object]
25
+ attr_reader :_field_set
26
+ protected :_field_set
27
+
28
+ OMIT = Object.new
29
+
30
+ # @param id [String] The UUID of the level.
31
+ # @param name [String] The name of the level.
32
+ # @param key [String] The level key.
33
+ # @param points [Integer] The threshold points value for the level.
34
+ # @param description [String] The level description.
35
+ # @param badge [TrophyApiClient::AdminPointsLevelBadge] The badge for the level, or null if no badge is set.
36
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
37
+ # @return [TrophyApiClient::AdminPointsLevel]
38
+ def initialize(id:, name:, key:, points:, description:, badge: OMIT, additional_properties: nil)
39
+ @id = id
40
+ @name = name
41
+ @key = key
42
+ @points = points
43
+ @description = description
44
+ @badge = badge if badge != OMIT
45
+ @additional_properties = additional_properties
46
+ @_field_set = {
47
+ "id": id,
48
+ "name": name,
49
+ "key": key,
50
+ "points": points,
51
+ "description": description,
52
+ "badge": badge
53
+ }.reject do |_k, v|
54
+ v == OMIT
55
+ end
56
+ end
57
+
58
+ # Deserialize a JSON object to an instance of AdminPointsLevel
59
+ #
60
+ # @param json_object [String]
61
+ # @return [TrophyApiClient::AdminPointsLevel]
62
+ def self.from_json(json_object:)
63
+ struct = JSON.parse(json_object, object_class: OpenStruct)
64
+ parsed_json = JSON.parse(json_object)
65
+ id = parsed_json["id"]
66
+ name = parsed_json["name"]
67
+ key = parsed_json["key"]
68
+ points = parsed_json["points"]
69
+ description = parsed_json["description"]
70
+ if parsed_json["badge"].nil?
71
+ badge = nil
72
+ else
73
+ badge = parsed_json["badge"].to_json
74
+ badge = TrophyApiClient::AdminPointsLevelBadge.from_json(json_object: badge)
75
+ end
76
+ new(
77
+ id: id,
78
+ name: name,
79
+ key: key,
80
+ points: points,
81
+ description: description,
82
+ badge: badge,
83
+ additional_properties: struct
84
+ )
85
+ end
86
+
87
+ # Serialize an instance of AdminPointsLevel to a JSON object
88
+ #
89
+ # @return [String]
90
+ def to_json(*_args)
91
+ @_field_set&.to_json
92
+ end
93
+
94
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
95
+ # hash and check each fields type against the current object's property
96
+ # definitions.
97
+ #
98
+ # @param obj [Object]
99
+ # @return [Void]
100
+ def self.validate_raw(obj:)
101
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
102
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
103
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
104
+ obj.points.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
105
+ obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
106
+ obj.badge.nil? || TrophyApiClient::AdminPointsLevelBadge.validate_raw(obj: obj.badge)
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module TrophyApiClient
7
+ class AdminPointsLevelBadge
8
+ # @return [String] The URL of the badge image.
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] The URL of the badge image.
19
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
20
+ # @return [TrophyApiClient::AdminPointsLevelBadge]
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 AdminPointsLevelBadge
28
+ #
29
+ # @param json_object [String]
30
+ # @return [TrophyApiClient::AdminPointsLevelBadge]
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 AdminPointsLevelBadge 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,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "admin_points_system_status"
4
+ require_relative "admin_points_system_badge"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module TrophyApiClient
9
+ # A points system returned from the admin points systems endpoints.
10
+ class AdminPointsSystem
11
+ # @return [String] The UUID of the points system.
12
+ attr_reader :id
13
+ # @return [String] The points system name.
14
+ attr_reader :name
15
+ # @return [String] The points system key.
16
+ attr_reader :key
17
+ # @return [String] The points system description.
18
+ attr_reader :description
19
+ # @return [TrophyApiClient::AdminPointsSystemStatus] The points system status.
20
+ attr_reader :status
21
+ # @return [TrophyApiClient::AdminPointsSystemBadge] The badge for the points system.
22
+ attr_reader :badge
23
+ # @return [Integer] The maximum points a user can earn.
24
+ attr_reader :max_points
25
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
26
+ attr_reader :additional_properties
27
+ # @return [Object]
28
+ attr_reader :_field_set
29
+ protected :_field_set
30
+
31
+ OMIT = Object.new
32
+
33
+ # @param id [String] The UUID of the points system.
34
+ # @param name [String] The points system name.
35
+ # @param key [String] The points system key.
36
+ # @param description [String] The points system description.
37
+ # @param status [TrophyApiClient::AdminPointsSystemStatus] The points system status.
38
+ # @param badge [TrophyApiClient::AdminPointsSystemBadge] The badge for the points system.
39
+ # @param max_points [Integer] The maximum points a user can earn.
40
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
41
+ # @return [TrophyApiClient::AdminPointsSystem]
42
+ def initialize(id:, name:, key:, description:, status:, badge: OMIT, max_points: OMIT, additional_properties: nil)
43
+ @id = id
44
+ @name = name
45
+ @key = key
46
+ @description = description
47
+ @status = status
48
+ @badge = badge if badge != OMIT
49
+ @max_points = max_points if max_points != OMIT
50
+ @additional_properties = additional_properties
51
+ @_field_set = {
52
+ "id": id,
53
+ "name": name,
54
+ "key": key,
55
+ "description": description,
56
+ "status": status,
57
+ "badge": badge,
58
+ "maxPoints": max_points
59
+ }.reject do |_k, v|
60
+ v == OMIT
61
+ end
62
+ end
63
+
64
+ # Deserialize a JSON object to an instance of AdminPointsSystem
65
+ #
66
+ # @param json_object [String]
67
+ # @return [TrophyApiClient::AdminPointsSystem]
68
+ def self.from_json(json_object:)
69
+ struct = JSON.parse(json_object, object_class: OpenStruct)
70
+ parsed_json = JSON.parse(json_object)
71
+ id = parsed_json["id"]
72
+ name = parsed_json["name"]
73
+ key = parsed_json["key"]
74
+ description = parsed_json["description"]
75
+ status = parsed_json["status"]
76
+ if parsed_json["badge"].nil?
77
+ badge = nil
78
+ else
79
+ badge = parsed_json["badge"].to_json
80
+ badge = TrophyApiClient::AdminPointsSystemBadge.from_json(json_object: badge)
81
+ end
82
+ max_points = parsed_json["maxPoints"]
83
+ new(
84
+ id: id,
85
+ name: name,
86
+ key: key,
87
+ description: description,
88
+ status: status,
89
+ badge: badge,
90
+ max_points: max_points,
91
+ additional_properties: struct
92
+ )
93
+ end
94
+
95
+ # Serialize an instance of AdminPointsSystem to a JSON object
96
+ #
97
+ # @return [String]
98
+ def to_json(*_args)
99
+ @_field_set&.to_json
100
+ end
101
+
102
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
103
+ # hash and check each fields type against the current object's property
104
+ # definitions.
105
+ #
106
+ # @param obj [Object]
107
+ # @return [Void]
108
+ def self.validate_raw(obj:)
109
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
110
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
111
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
112
+ obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
113
+ obj.status.is_a?(TrophyApiClient::AdminPointsSystemStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
114
+ obj.badge.nil? || TrophyApiClient::AdminPointsSystemBadge.validate_raw(obj: obj.badge)
115
+ obj.max_points&.is_a?(Integer) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module TrophyApiClient
7
+ class AdminPointsSystemBadge
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::AdminPointsSystemBadge]
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 AdminPointsSystemBadge
28
+ #
29
+ # @param json_object [String]
30
+ # @return [TrophyApiClient::AdminPointsSystemBadge]
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 AdminPointsSystemBadge 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,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TrophyApiClient
4
+ # The points system status.
5
+ class AdminPointsSystemStatus
6
+ ACTIVE = "active"
7
+ ARCHIVED = "archived"
8
+ end
9
+ end