trophy_api_client 1.0.29 → 1.0.30

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/trophy_api_client/achievements/client.rb +2 -2
  4. data/lib/trophy_api_client/leaderboards/client.rb +9 -5
  5. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +186 -0
  6. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item_status.rb +12 -0
  7. data/lib/trophy_api_client/metrics/client.rb +2 -2
  8. data/lib/trophy_api_client/streaks/client.rb +2 -2
  9. data/lib/trophy_api_client/types/achievement_completion_response.rb +9 -11
  10. data/lib/trophy_api_client/types/achievement_completion_response_achievement.rb +171 -0
  11. data/lib/trophy_api_client/types/achievement_response.rb +5 -19
  12. data/lib/trophy_api_client/types/achievement_with_stats_response.rb +9 -23
  13. data/lib/trophy_api_client/types/bulk_streak_response_item.rb +4 -6
  14. data/lib/trophy_api_client/types/completed_achievement_response.rb +7 -21
  15. data/lib/trophy_api_client/types/event_response.rb +10 -10
  16. data/lib/trophy_api_client/types/get_user_points_response.rb +21 -4
  17. data/lib/trophy_api_client/types/leaderboard_response.rb +8 -16
  18. data/lib/trophy_api_client/types/leaderboard_response_run_unit.rb +11 -0
  19. data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +17 -16
  20. data/lib/trophy_api_client/types/{leaderboard_response_status.rb → leaderboard_response_with_rankings_status.rb} +1 -1
  21. data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +11 -19
  22. data/lib/trophy_api_client/types/metric_event_points_response.rb +24 -8
  23. data/lib/trophy_api_client/types/metric_event_streak_response.rb +4 -4
  24. data/lib/trophy_api_client/types/points_award.rb +6 -6
  25. data/lib/trophy_api_client/types/points_range.rb +14 -16
  26. data/lib/trophy_api_client/types/points_system_response.rb +10 -1
  27. data/lib/trophy_api_client/types/points_trigger.rb +30 -11
  28. data/lib/trophy_api_client/types/points_trigger_response.rb +39 -22
  29. data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +9 -0
  30. data/lib/trophy_api_client/types/points_trigger_response_type.rb +2 -0
  31. data/lib/trophy_api_client/types/points_trigger_time_unit.rb +9 -0
  32. data/lib/trophy_api_client/types/points_trigger_type.rb +2 -0
  33. data/lib/trophy_api_client/types/updated_user.rb +11 -11
  34. data/lib/trophy_api_client/types/upserted_user.rb +12 -12
  35. data/lib/trophy_api_client/types/user.rb +18 -18
  36. data/lib/trophy_api_client/types/user_leaderboard_response.rb +8 -28
  37. data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +208 -0
  38. data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +212 -0
  39. data/lib/trophy_api_client/types/webhooks_achievement_completed_payload.rb +84 -0
  40. data/lib/trophy_api_client/types/webhooks_leaderboard_changed_payload.rb +71 -0
  41. data/lib/trophy_api_client/types/webhooks_leaderboard_finished_payload.rb +71 -0
  42. data/lib/trophy_api_client/types/webhooks_leaderboard_rank_changed_payload.rb +85 -0
  43. data/lib/trophy_api_client/types/webhooks_leaderboard_started_payload.rb +71 -0
  44. data/lib/trophy_api_client/types/webhooks_points_changed_payload.rb +84 -0
  45. data/lib/trophy_api_client/types/webhooks_streak_extended_payload.rb +84 -0
  46. data/lib/trophy_api_client/types/webhooks_streak_freeze_consumed_payload.rb +85 -0
  47. data/lib/trophy_api_client/types/webhooks_streak_freeze_earned_payload.rb +85 -0
  48. data/lib/trophy_api_client/types/webhooks_streak_lost_payload.rb +78 -0
  49. data/lib/trophy_api_client/types/webhooks_streak_started_payload.rb +84 -0
  50. data/lib/trophy_api_client/users/client.rb +25 -17
  51. data/lib/trophy_api_client/version.rb +1 -1
  52. data/lib/types_export.rb +20 -1
  53. metadata +21 -2
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "leaderboard_response_status"
4
3
  require_relative "leaderboard_response_rank_by"
4
+ require_relative "leaderboard_response_run_unit"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -16,7 +16,7 @@ module TrophyApiClient
16
16
  # @return [Integer] The user's rank in the leaderboard before the event, or null if the user was not
17
17
  # on the leaderboard before the event.
18
18
  attr_reader :previous_rank
19
- # @return [Float] The minimum value required to enter the leaderboard according to its current
19
+ # @return [Integer] The minimum value required to enter the leaderboard according to its current
20
20
  # rankings.
21
21
  attr_reader :threshold
22
22
  # @return [String] The unique ID of the leaderboard.
@@ -25,8 +25,6 @@ module TrophyApiClient
25
25
  attr_reader :name
26
26
  # @return [String] The unique key used to reference the leaderboard in APIs.
27
27
  attr_reader :key
28
- # @return [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
29
- attr_reader :status
30
28
  # @return [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
31
29
  attr_reader :rank_by
32
30
  # @return [String] The key of the metric to rank by, if rankBy is 'metric'.
@@ -43,7 +41,7 @@ module TrophyApiClient
43
41
  attr_reader :start
44
42
  # @return [Integer] The maximum number of participants in the leaderboard.
45
43
  attr_reader :max_participants
46
- # @return [String] The repetition type for recurring leaderboards, or null for one-time
44
+ # @return [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
47
45
  # leaderboards.
48
46
  attr_reader :run_unit
49
47
  # @return [Integer] The interval between repetitions, relative to the start date and repetition
@@ -63,12 +61,11 @@ module TrophyApiClient
63
61
  # leaderboard.
64
62
  # @param previous_rank [Integer] The user's rank in the leaderboard before the event, or null if the user was not
65
63
  # on the leaderboard before the event.
66
- # @param threshold [Float] The minimum value required to enter the leaderboard according to its current
64
+ # @param threshold [Integer] The minimum value required to enter the leaderboard according to its current
67
65
  # rankings.
68
66
  # @param id [String] The unique ID of the leaderboard.
69
67
  # @param name [String] The user-facing name of the leaderboard.
70
68
  # @param key [String] The unique key used to reference the leaderboard in APIs.
71
- # @param status [TrophyApiClient::LeaderboardResponseStatus] The status of the leaderboard.
72
69
  # @param rank_by [TrophyApiClient::LeaderboardResponseRankBy] What the leaderboard ranks by.
73
70
  # @param metric_key [String] The key of the metric to rank by, if rankBy is 'metric'.
74
71
  # @param metric_name [String] The name of the metric to rank by, if rankBy is 'metric'.
@@ -77,14 +74,14 @@ module TrophyApiClient
77
74
  # @param description [String] The user-facing description of the leaderboard.
78
75
  # @param start [String] The start date of the leaderboard in YYYY-MM-DD format.
79
76
  # @param max_participants [Integer] The maximum number of participants in the leaderboard.
80
- # @param run_unit [String] The repetition type for recurring leaderboards, or null for one-time
77
+ # @param run_unit [TrophyApiClient::LeaderboardResponseRunUnit] The repetition type for recurring leaderboards, or null for one-time
81
78
  # leaderboards.
82
79
  # @param run_interval [Integer] The interval between repetitions, relative to the start date and repetition
83
80
  # type.
84
81
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
85
82
  # @return [TrophyApiClient::MetricEventLeaderboardResponse]
86
- def initialize(threshold:, id:, name:, key:, rank_by:, start:, max_participants:, run_interval:, end_: OMIT, rank: OMIT, previous_rank: OMIT, status: OMIT,
87
- metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, description: OMIT, run_unit: OMIT, additional_properties: nil)
83
+ def initialize(threshold:, id:, name:, key:, rank_by:, description:, start:, max_participants:, run_interval:, end_: OMIT, rank: OMIT, previous_rank: OMIT,
84
+ metric_key: OMIT, metric_name: OMIT, points_system_key: OMIT, points_system_name: OMIT, run_unit: OMIT, additional_properties: nil)
88
85
  @end_ = end_ if end_ != OMIT
89
86
  @rank = rank if rank != OMIT
90
87
  @previous_rank = previous_rank if previous_rank != OMIT
@@ -92,13 +89,12 @@ module TrophyApiClient
92
89
  @id = id
93
90
  @name = name
94
91
  @key = key
95
- @status = status if status != OMIT
96
92
  @rank_by = rank_by
97
93
  @metric_key = metric_key if metric_key != OMIT
98
94
  @metric_name = metric_name if metric_name != OMIT
99
95
  @points_system_key = points_system_key if points_system_key != OMIT
100
96
  @points_system_name = points_system_name if points_system_name != OMIT
101
- @description = description if description != OMIT
97
+ @description = description
102
98
  @start = start
103
99
  @max_participants = max_participants
104
100
  @run_unit = run_unit if run_unit != OMIT
@@ -112,7 +108,6 @@ module TrophyApiClient
112
108
  "id": id,
113
109
  "name": name,
114
110
  "key": key,
115
- "status": status,
116
111
  "rankBy": rank_by,
117
112
  "metricKey": metric_key,
118
113
  "metricName": metric_name,
@@ -142,7 +137,6 @@ module TrophyApiClient
142
137
  id = parsed_json["id"]
143
138
  name = parsed_json["name"]
144
139
  key = parsed_json["key"]
145
- status = parsed_json["status"]
146
140
  rank_by = parsed_json["rankBy"]
147
141
  metric_key = parsed_json["metricKey"]
148
142
  metric_name = parsed_json["metricName"]
@@ -161,7 +155,6 @@ module TrophyApiClient
161
155
  id: id,
162
156
  name: name,
163
157
  key: key,
164
- status: status,
165
158
  rank_by: rank_by,
166
159
  metric_key: metric_key,
167
160
  metric_name: metric_name,
@@ -193,20 +186,19 @@ module TrophyApiClient
193
186
  obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
194
187
  obj.rank&.is_a?(Integer) != false || raise("Passed value for field obj.rank is not the expected type, validation failed.")
195
188
  obj.previous_rank&.is_a?(Integer) != false || raise("Passed value for field obj.previous_rank is not the expected type, validation failed.")
196
- obj.threshold.is_a?(Float) != false || raise("Passed value for field obj.threshold is not the expected type, validation failed.")
189
+ obj.threshold.is_a?(Integer) != false || raise("Passed value for field obj.threshold is not the expected type, validation failed.")
197
190
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
198
191
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
199
192
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
200
- obj.status&.is_a?(TrophyApiClient::LeaderboardResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
201
193
  obj.rank_by.is_a?(TrophyApiClient::LeaderboardResponseRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
202
194
  obj.metric_key&.is_a?(String) != false || raise("Passed value for field obj.metric_key is not the expected type, validation failed.")
203
195
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
204
196
  obj.points_system_key&.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.")
205
197
  obj.points_system_name&.is_a?(String) != false || raise("Passed value for field obj.points_system_name is not the expected type, validation failed.")
206
- obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
198
+ obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
207
199
  obj.start.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
208
200
  obj.max_participants.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
209
- obj.run_unit&.is_a?(String) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
201
+ obj.run_unit&.is_a?(TrophyApiClient::LeaderboardResponseRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
210
202
  obj.run_interval.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
211
203
  end
212
204
  end
@@ -6,17 +6,21 @@ require "json"
6
6
 
7
7
  module TrophyApiClient
8
8
  class MetricEventPointsResponse
9
- # @return [Float] The points added by this event.
9
+ # @return [Integer] The points added by this event.
10
10
  attr_reader :added
11
11
  # @return [String] The ID of the points system
12
12
  attr_reader :id
13
+ # @return [String] The key of the points system
14
+ attr_reader :key
13
15
  # @return [String] The name of the points system
14
16
  attr_reader :name
15
17
  # @return [String] The description of the points system
16
18
  attr_reader :description
17
19
  # @return [String] The URL of the badge image for the points system
18
20
  attr_reader :badge_url
19
- # @return [Float] The user's total points
21
+ # @return [Float] The maximum number of points a user can be awarded in this points system
22
+ attr_reader :max_points
23
+ # @return [Integer] The user's total points
20
24
  attr_reader :total
21
25
  # @return [Array<TrophyApiClient::PointsAward>] Array of trigger awards that added points.
22
26
  attr_reader :awards
@@ -28,31 +32,37 @@ module TrophyApiClient
28
32
 
29
33
  OMIT = Object.new
30
34
 
31
- # @param added [Float] The points added by this event.
35
+ # @param added [Integer] The points added by this event.
32
36
  # @param id [String] The ID of the points system
37
+ # @param key [String] The key of the points system
33
38
  # @param name [String] The name of the points system
34
39
  # @param description [String] The description of the points system
35
40
  # @param badge_url [String] The URL of the badge image for the points system
36
- # @param total [Float] The user's total points
41
+ # @param max_points [Float] The maximum number of points a user can be awarded in this points system
42
+ # @param total [Integer] The user's total points
37
43
  # @param awards [Array<TrophyApiClient::PointsAward>] Array of trigger awards that added points.
38
44
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
39
45
  # @return [TrophyApiClient::MetricEventPointsResponse]
40
- def initialize(id:, name:, total:, awards:, added: OMIT, description: OMIT, badge_url: OMIT,
46
+ def initialize(added:, id:, key:, name:, total:, awards:, description: OMIT, badge_url: OMIT, max_points: OMIT,
41
47
  additional_properties: nil)
42
- @added = added if added != OMIT
48
+ @added = added
43
49
  @id = id
50
+ @key = key
44
51
  @name = name
45
52
  @description = description if description != OMIT
46
53
  @badge_url = badge_url if badge_url != OMIT
54
+ @max_points = max_points if max_points != OMIT
47
55
  @total = total
48
56
  @awards = awards
49
57
  @additional_properties = additional_properties
50
58
  @_field_set = {
51
59
  "added": added,
52
60
  "id": id,
61
+ "key": key,
53
62
  "name": name,
54
63
  "description": description,
55
64
  "badgeUrl": badge_url,
65
+ "maxPoints": max_points,
56
66
  "total": total,
57
67
  "awards": awards
58
68
  }.reject do |_k, v|
@@ -69,9 +79,11 @@ module TrophyApiClient
69
79
  parsed_json = JSON.parse(json_object)
70
80
  added = parsed_json["added"]
71
81
  id = parsed_json["id"]
82
+ key = parsed_json["key"]
72
83
  name = parsed_json["name"]
73
84
  description = parsed_json["description"]
74
85
  badge_url = parsed_json["badgeUrl"]
86
+ max_points = parsed_json["maxPoints"]
75
87
  total = parsed_json["total"]
76
88
  awards = parsed_json["awards"]&.map do |item|
77
89
  item = item.to_json
@@ -80,9 +92,11 @@ module TrophyApiClient
80
92
  new(
81
93
  added: added,
82
94
  id: id,
95
+ key: key,
83
96
  name: name,
84
97
  description: description,
85
98
  badge_url: badge_url,
99
+ max_points: max_points,
86
100
  total: total,
87
101
  awards: awards,
88
102
  additional_properties: struct
@@ -103,12 +117,14 @@ module TrophyApiClient
103
117
  # @param obj [Object]
104
118
  # @return [Void]
105
119
  def self.validate_raw(obj:)
106
- obj.added&.is_a?(Float) != false || raise("Passed value for field obj.added is not the expected type, validation failed.")
120
+ obj.added.is_a?(Integer) != false || raise("Passed value for field obj.added is not the expected type, validation failed.")
107
121
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
122
+ obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
108
123
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
109
124
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
110
125
  obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
111
- obj.total.is_a?(Float) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
126
+ obj.max_points&.is_a?(Float) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
127
+ obj.total.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
112
128
  obj.awards.is_a?(Array) != false || raise("Passed value for field obj.awards is not the expected type, validation failed.")
113
129
  end
114
130
  end
@@ -58,9 +58,9 @@ module TrophyApiClient
58
58
  # the organization has enabled streak freeze auto-earn.
59
59
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
60
60
  # @return [TrophyApiClient::MetricEventStreakResponse]
61
- def initialize(length:, frequency:, extended: OMIT, started: OMIT, period_start: OMIT, period_end: OMIT,
62
- expires: OMIT, freezes: OMIT, max_freezes: OMIT, freeze_auto_earn_interval: OMIT, freeze_auto_earn_amount: OMIT, additional_properties: nil)
63
- @extended = extended if extended != OMIT
61
+ def initialize(extended:, length:, frequency:, started: OMIT, period_start: OMIT, period_end: OMIT, expires: OMIT,
62
+ freezes: OMIT, max_freezes: OMIT, freeze_auto_earn_interval: OMIT, freeze_auto_earn_amount: OMIT, additional_properties: nil)
63
+ @extended = extended
64
64
  @length = length
65
65
  @frequency = frequency
66
66
  @started = started if started != OMIT
@@ -137,7 +137,7 @@ module TrophyApiClient
137
137
  # @param obj [Object]
138
138
  # @return [Void]
139
139
  def self.validate_raw(obj:)
140
- obj.extended&.is_a?(Boolean) != false || raise("Passed value for field obj.extended is not the expected type, validation failed.")
140
+ obj.extended.is_a?(Boolean) != false || raise("Passed value for field obj.extended is not the expected type, validation failed.")
141
141
  obj.length.is_a?(Integer) != false || raise("Passed value for field obj.length is not the expected type, validation failed.")
142
142
  obj.frequency.is_a?(TrophyApiClient::StreakFrequency) != false || raise("Passed value for field obj.frequency is not the expected type, validation failed.")
143
143
  obj.started&.is_a?(String) != false || raise("Passed value for field obj.started is not the expected type, validation failed.")
@@ -8,11 +8,11 @@ module TrophyApiClient
8
8
  class PointsAward
9
9
  # @return [String] The ID of the trigger award
10
10
  attr_reader :id
11
- # @return [Float] The points awarded by this trigger
11
+ # @return [Integer] The points awarded by this trigger
12
12
  attr_reader :awarded
13
13
  # @return [String] The date these points were awarded, in ISO 8601 format.
14
14
  attr_reader :date
15
- # @return [Float] The user's total points after this award occurred.
15
+ # @return [Integer] The user's total points after this award occurred.
16
16
  attr_reader :total
17
17
  # @return [TrophyApiClient::PointsTrigger]
18
18
  attr_reader :trigger
@@ -25,9 +25,9 @@ module TrophyApiClient
25
25
  OMIT = Object.new
26
26
 
27
27
  # @param id [String] The ID of the trigger award
28
- # @param awarded [Float] The points awarded by this trigger
28
+ # @param awarded [Integer] The points awarded by this trigger
29
29
  # @param date [String] The date these points were awarded, in ISO 8601 format.
30
- # @param total [Float] The user's total points after this award occurred.
30
+ # @param total [Integer] The user's total points after this award occurred.
31
31
  # @param trigger [TrophyApiClient::PointsTrigger]
32
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
33
33
  # @return [TrophyApiClient::PointsAward]
@@ -91,9 +91,9 @@ module TrophyApiClient
91
91
  # @return [Void]
92
92
  def self.validate_raw(obj:)
93
93
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
94
- obj.awarded&.is_a?(Float) != false || raise("Passed value for field obj.awarded is not the expected type, validation failed.")
94
+ obj.awarded&.is_a?(Integer) != false || raise("Passed value for field obj.awarded is not the expected type, validation failed.")
95
95
  obj.date&.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
96
- obj.total&.is_a?(Float) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
96
+ obj.total&.is_a?(Integer) != false || raise("Passed value for field obj.total is not the expected type, validation failed.")
97
97
  obj.trigger.nil? || TrophyApiClient::PointsTrigger.validate_raw(obj: obj.trigger)
98
98
  end
99
99
  end
@@ -5,11 +5,11 @@ require "json"
5
5
 
6
6
  module TrophyApiClient
7
7
  class PointsRange
8
- # @return [Float] The start of the points range. Inclusive.
8
+ # @return [Integer] The start of the points range. Inclusive.
9
9
  attr_reader :from
10
- # @return [Float] The end of the points range. Inclusive.
10
+ # @return [Integer] The end of the points range. Inclusive.
11
11
  attr_reader :to
12
- # @return [Float] The number of users in this points range.
12
+ # @return [Integer] The number of users in this points range.
13
13
  attr_reader :users
14
14
  # @return [OpenStruct] Additional properties unmapped to the current class definition
15
15
  attr_reader :additional_properties
@@ -19,19 +19,17 @@ module TrophyApiClient
19
19
 
20
20
  OMIT = Object.new
21
21
 
22
- # @param from [Float] The start of the points range. Inclusive.
23
- # @param to [Float] The end of the points range. Inclusive.
24
- # @param users [Float] The number of users in this points range.
22
+ # @param from [Integer] The start of the points range. Inclusive.
23
+ # @param to [Integer] The end of the points range. Inclusive.
24
+ # @param users [Integer] The number of users in this points range.
25
25
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
26
  # @return [TrophyApiClient::PointsRange]
27
- def initialize(from: OMIT, to: OMIT, users: OMIT, additional_properties: nil)
28
- @from = from if from != OMIT
29
- @to = to if to != OMIT
30
- @users = users if users != OMIT
27
+ def initialize(from:, to:, users:, additional_properties: nil)
28
+ @from = from
29
+ @to = to
30
+ @users = users
31
31
  @additional_properties = additional_properties
32
- @_field_set = { "from": from, "to": to, "users": users }.reject do |_k, v|
33
- v == OMIT
34
- end
32
+ @_field_set = { "from": from, "to": to, "users": users }
35
33
  end
36
34
 
37
35
  # Deserialize a JSON object to an instance of PointsRange
@@ -66,9 +64,9 @@ module TrophyApiClient
66
64
  # @param obj [Object]
67
65
  # @return [Void]
68
66
  def self.validate_raw(obj:)
69
- obj.from&.is_a?(Float) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
70
- obj.to&.is_a?(Float) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
71
- obj.users&.is_a?(Float) != false || raise("Passed value for field obj.users is not the expected type, validation failed.")
67
+ obj.from.is_a?(Integer) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
68
+ obj.to.is_a?(Integer) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
69
+ obj.users.is_a?(Integer) != false || raise("Passed value for field obj.users is not the expected type, validation failed.")
72
70
  end
73
71
  end
74
72
  end
@@ -14,6 +14,8 @@ module TrophyApiClient
14
14
  attr_reader :description
15
15
  # @return [String] The URL of the badge image for the points system, if one has been uploaded.
16
16
  attr_reader :badge_url
17
+ # @return [Float] The maximum number of points a user can be awarded in this points system
18
+ attr_reader :max_points
17
19
  # @return [Array<TrophyApiClient::PointsTriggerResponse>] Array of active triggers for this points system.
18
20
  attr_reader :triggers
19
21
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -28,14 +30,17 @@ module TrophyApiClient
28
30
  # @param name [String] The name of the points system.
29
31
  # @param description [String] The description of the points system.
30
32
  # @param badge_url [String] The URL of the badge image for the points system, if one has been uploaded.
33
+ # @param max_points [Float] The maximum number of points a user can be awarded in this points system
31
34
  # @param triggers [Array<TrophyApiClient::PointsTriggerResponse>] Array of active triggers for this points system.
32
35
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
33
36
  # @return [TrophyApiClient::PointsSystemResponse]
34
- def initialize(id:, name:, triggers:, description: OMIT, badge_url: OMIT, additional_properties: nil)
37
+ def initialize(id:, name:, triggers:, description: OMIT, badge_url: OMIT, max_points: OMIT,
38
+ additional_properties: nil)
35
39
  @id = id
36
40
  @name = name
37
41
  @description = description if description != OMIT
38
42
  @badge_url = badge_url if badge_url != OMIT
43
+ @max_points = max_points if max_points != OMIT
39
44
  @triggers = triggers
40
45
  @additional_properties = additional_properties
41
46
  @_field_set = {
@@ -43,6 +48,7 @@ module TrophyApiClient
43
48
  "name": name,
44
49
  "description": description,
45
50
  "badgeUrl": badge_url,
51
+ "maxPoints": max_points,
46
52
  "triggers": triggers
47
53
  }.reject do |_k, v|
48
54
  v == OMIT
@@ -60,6 +66,7 @@ module TrophyApiClient
60
66
  name = parsed_json["name"]
61
67
  description = parsed_json["description"]
62
68
  badge_url = parsed_json["badgeUrl"]
69
+ max_points = parsed_json["maxPoints"]
63
70
  triggers = parsed_json["triggers"]&.map do |item|
64
71
  item = item.to_json
65
72
  TrophyApiClient::PointsTriggerResponse.from_json(json_object: item)
@@ -69,6 +76,7 @@ module TrophyApiClient
69
76
  name: name,
70
77
  description: description,
71
78
  badge_url: badge_url,
79
+ max_points: max_points,
72
80
  triggers: triggers,
73
81
  additional_properties: struct
74
82
  )
@@ -92,6 +100,7 @@ module TrophyApiClient
92
100
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
93
101
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
94
102
  obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
103
+ obj.max_points&.is_a?(Float) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
95
104
  obj.triggers.is_a?(Array) != false || raise("Passed value for field obj.triggers is not the expected type, validation failed.")
96
105
  end
97
106
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "points_trigger_type"
4
+ require_relative "points_trigger_time_unit"
4
5
  require "ostruct"
5
6
  require "json"
6
7
 
@@ -10,18 +11,23 @@ module TrophyApiClient
10
11
  attr_reader :id
11
12
  # @return [TrophyApiClient::PointsTriggerType] The type of trigger
12
13
  attr_reader :type
13
- # @return [Float] The points awarded by this trigger.
14
+ # @return [Integer] The points awarded by this trigger.
14
15
  attr_reader :points
15
16
  # @return [String] If the trigger has type 'metric', the name of the metric
16
17
  attr_reader :metric_name
17
- # @return [Float] If the trigger has type 'metric', the threshold of the metric that triggers the
18
+ # @return [Integer] If the trigger has type 'metric', the threshold of the metric that triggers the
18
19
  # points
19
20
  attr_reader :metric_threshold
20
- # @return [Float] If the trigger has type 'streak', the threshold of the streak that triggers the
21
+ # @return [Integer] If the trigger has type 'streak', the threshold of the streak that triggers the
21
22
  # points
22
23
  attr_reader :streak_length_threshold
23
24
  # @return [String] If the trigger has type 'achievement', the name of the achievement
24
25
  attr_reader :achievement_name
26
+ # @return [TrophyApiClient::PointsTriggerTimeUnit] If the trigger has type 'time', the unit of time after which to award points
27
+ attr_reader :time_unit
28
+ # @return [Integer] If the trigger has type 'time', the numer of units of timeUnit after which to
29
+ # award points
30
+ attr_reader :time_interval
25
31
  # @return [OpenStruct] Additional properties unmapped to the current class definition
26
32
  attr_reader :additional_properties
27
33
  # @return [Object]
@@ -32,17 +38,20 @@ module TrophyApiClient
32
38
 
33
39
  # @param id [String] The ID of the trigger
34
40
  # @param type [TrophyApiClient::PointsTriggerType] The type of trigger
35
- # @param points [Float] The points awarded by this trigger.
41
+ # @param points [Integer] The points awarded by this trigger.
36
42
  # @param metric_name [String] If the trigger has type 'metric', the name of the metric
37
- # @param metric_threshold [Float] If the trigger has type 'metric', the threshold of the metric that triggers the
43
+ # @param metric_threshold [Integer] If the trigger has type 'metric', the threshold of the metric that triggers the
38
44
  # points
39
- # @param streak_length_threshold [Float] If the trigger has type 'streak', the threshold of the streak that triggers the
45
+ # @param streak_length_threshold [Integer] If the trigger has type 'streak', the threshold of the streak that triggers the
40
46
  # points
41
47
  # @param achievement_name [String] If the trigger has type 'achievement', the name of the achievement
48
+ # @param time_unit [TrophyApiClient::PointsTriggerTimeUnit] If the trigger has type 'time', the unit of time after which to award points
49
+ # @param time_interval [Integer] If the trigger has type 'time', the numer of units of timeUnit after which to
50
+ # award points
42
51
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
43
52
  # @return [TrophyApiClient::PointsTrigger]
44
53
  def initialize(id: OMIT, type: OMIT, points: OMIT, metric_name: OMIT, metric_threshold: OMIT,
45
- streak_length_threshold: OMIT, achievement_name: OMIT, additional_properties: nil)
54
+ streak_length_threshold: OMIT, achievement_name: OMIT, time_unit: OMIT, time_interval: OMIT, additional_properties: nil)
46
55
  @id = id if id != OMIT
47
56
  @type = type if type != OMIT
48
57
  @points = points if points != OMIT
@@ -50,6 +59,8 @@ module TrophyApiClient
50
59
  @metric_threshold = metric_threshold if metric_threshold != OMIT
51
60
  @streak_length_threshold = streak_length_threshold if streak_length_threshold != OMIT
52
61
  @achievement_name = achievement_name if achievement_name != OMIT
62
+ @time_unit = time_unit if time_unit != OMIT
63
+ @time_interval = time_interval if time_interval != OMIT
53
64
  @additional_properties = additional_properties
54
65
  @_field_set = {
55
66
  "id": id,
@@ -58,7 +69,9 @@ module TrophyApiClient
58
69
  "metricName": metric_name,
59
70
  "metricThreshold": metric_threshold,
60
71
  "streakLengthThreshold": streak_length_threshold,
61
- "achievementName": achievement_name
72
+ "achievementName": achievement_name,
73
+ "timeUnit": time_unit,
74
+ "timeInterval": time_interval
62
75
  }.reject do |_k, v|
63
76
  v == OMIT
64
77
  end
@@ -78,6 +91,8 @@ module TrophyApiClient
78
91
  metric_threshold = parsed_json["metricThreshold"]
79
92
  streak_length_threshold = parsed_json["streakLengthThreshold"]
80
93
  achievement_name = parsed_json["achievementName"]
94
+ time_unit = parsed_json["timeUnit"]
95
+ time_interval = parsed_json["timeInterval"]
81
96
  new(
82
97
  id: id,
83
98
  type: type,
@@ -86,6 +101,8 @@ module TrophyApiClient
86
101
  metric_threshold: metric_threshold,
87
102
  streak_length_threshold: streak_length_threshold,
88
103
  achievement_name: achievement_name,
104
+ time_unit: time_unit,
105
+ time_interval: time_interval,
89
106
  additional_properties: struct
90
107
  )
91
108
  end
@@ -106,11 +123,13 @@ module TrophyApiClient
106
123
  def self.validate_raw(obj:)
107
124
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
108
125
  obj.type&.is_a?(TrophyApiClient::PointsTriggerType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
109
- obj.points&.is_a?(Float) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
126
+ obj.points&.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
110
127
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
111
- obj.metric_threshold&.is_a?(Float) != false || raise("Passed value for field obj.metric_threshold is not the expected type, validation failed.")
112
- obj.streak_length_threshold&.is_a?(Float) != false || raise("Passed value for field obj.streak_length_threshold is not the expected type, validation failed.")
128
+ obj.metric_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.metric_threshold is not the expected type, validation failed.")
129
+ obj.streak_length_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length_threshold is not the expected type, validation failed.")
113
130
  obj.achievement_name&.is_a?(String) != false || raise("Passed value for field obj.achievement_name is not the expected type, validation failed.")
131
+ obj.time_unit&.is_a?(TrophyApiClient::PointsTriggerTimeUnit) != false || raise("Passed value for field obj.time_unit is not the expected type, validation failed.")
132
+ obj.time_interval&.is_a?(Integer) != false || raise("Passed value for field obj.time_interval is not the expected type, validation failed.")
114
133
  end
115
134
  end
116
135
  end