trophy_api_client 1.0.29 → 1.0.31

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/trophy_api_client/achievements/client.rb +20 -12
  4. data/lib/trophy_api_client/leaderboards/client.rb +25 -11
  5. data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +194 -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/points/client.rb +4 -4
  9. data/lib/trophy_api_client/streaks/client.rb +2 -2
  10. data/lib/trophy_api_client/types/achievement_completion_response.rb +9 -11
  11. data/lib/trophy_api_client/types/achievement_completion_response_achievement.rb +171 -0
  12. data/lib/trophy_api_client/types/achievement_response.rb +5 -19
  13. data/lib/trophy_api_client/types/achievement_with_stats_response.rb +9 -23
  14. data/lib/trophy_api_client/types/bulk_streak_response_item.rb +4 -6
  15. data/lib/trophy_api_client/types/completed_achievement_response.rb +7 -21
  16. data/lib/trophy_api_client/types/event_response.rb +10 -10
  17. data/lib/trophy_api_client/types/get_user_points_response.rb +21 -4
  18. data/lib/trophy_api_client/types/leaderboard_response.rb +16 -16
  19. data/lib/trophy_api_client/types/leaderboard_response_run_unit.rb +11 -0
  20. data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +25 -16
  21. data/lib/trophy_api_client/types/{leaderboard_response_status.rb → leaderboard_response_with_rankings_status.rb} +1 -1
  22. data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +29 -19
  23. data/lib/trophy_api_client/types/metric_event_points_response.rb +24 -8
  24. data/lib/trophy_api_client/types/metric_event_streak_response.rb +4 -4
  25. data/lib/trophy_api_client/types/points_award.rb +6 -6
  26. data/lib/trophy_api_client/types/points_range.rb +14 -16
  27. data/lib/trophy_api_client/types/points_system_response.rb +10 -1
  28. data/lib/trophy_api_client/types/points_trigger.rb +30 -11
  29. data/lib/trophy_api_client/types/points_trigger_response.rb +39 -22
  30. data/lib/trophy_api_client/types/points_trigger_response_time_unit.rb +9 -0
  31. data/lib/trophy_api_client/types/points_trigger_response_type.rb +2 -0
  32. data/lib/trophy_api_client/types/points_trigger_time_unit.rb +9 -0
  33. data/lib/trophy_api_client/types/points_trigger_type.rb +2 -0
  34. data/lib/trophy_api_client/types/updated_user.rb +11 -11
  35. data/lib/trophy_api_client/types/upserted_user.rb +12 -12
  36. data/lib/trophy_api_client/types/user.rb +18 -18
  37. data/lib/trophy_api_client/types/user_leaderboard_response.rb +16 -28
  38. data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +216 -0
  39. data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +220 -0
  40. data/lib/trophy_api_client/types/webhooks_achievement_completed_payload.rb +84 -0
  41. data/lib/trophy_api_client/types/webhooks_leaderboard_changed_payload.rb +71 -0
  42. data/lib/trophy_api_client/types/webhooks_leaderboard_finished_payload.rb +71 -0
  43. data/lib/trophy_api_client/types/webhooks_leaderboard_rank_changed_payload.rb +85 -0
  44. data/lib/trophy_api_client/types/webhooks_leaderboard_started_payload.rb +71 -0
  45. data/lib/trophy_api_client/types/webhooks_points_changed_payload.rb +84 -0
  46. data/lib/trophy_api_client/types/webhooks_streak_extended_payload.rb +84 -0
  47. data/lib/trophy_api_client/types/webhooks_streak_freeze_consumed_payload.rb +85 -0
  48. data/lib/trophy_api_client/types/webhooks_streak_freeze_earned_payload.rb +85 -0
  49. data/lib/trophy_api_client/types/webhooks_streak_lost_payload.rb +78 -0
  50. data/lib/trophy_api_client/types/webhooks_streak_started_payload.rb +84 -0
  51. data/lib/trophy_api_client/users/client.rb +25 -17
  52. data/lib/trophy_api_client/version.rb +1 -1
  53. data/lib/types_export.rb +20 -1
  54. metadata +21 -2
@@ -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
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "points_trigger_response_type"
4
4
  require_relative "points_trigger_response_status"
5
+ require_relative "points_trigger_response_time_unit"
5
6
  require_relative "points_trigger_response_user_attributes_item"
6
7
  require_relative "points_trigger_response_event_attribute"
7
8
  require "date"
@@ -14,7 +15,7 @@ module TrophyApiClient
14
15
  attr_reader :id
15
16
  # @return [TrophyApiClient::PointsTriggerResponseType] The type of trigger.
16
17
  attr_reader :type
17
- # @return [Float] The points awarded by this trigger.
18
+ # @return [Integer] The points awarded by this trigger.
18
19
  attr_reader :points
19
20
  # @return [TrophyApiClient::PointsTriggerResponseStatus] The status of the trigger.
20
21
  attr_reader :status
@@ -24,10 +25,10 @@ module TrophyApiClient
24
25
  # @return [String] The unique ID of the metric associated with this trigger, if the trigger is a
25
26
  # metric.
26
27
  attr_reader :metric_id
27
- # @return [Float] The amount that a user must increase the metric to earn the points, if the
28
+ # @return [Integer] The amount that a user must increase the metric to earn the points, if the
28
29
  # trigger is a metric.
29
30
  attr_reader :metric_threshold
30
- # @return [Float] The number of consecutive streak periods that a user must complete to earn the
31
+ # @return [Integer] The number of consecutive streak periods that a user must complete to earn the
31
32
  # points, if the trigger is a streak.
32
33
  attr_reader :streak_length_threshold
33
34
  # @return [String] The name of the metric associated with this trigger, if the trigger is a metric.
@@ -35,6 +36,10 @@ module TrophyApiClient
35
36
  # @return [String] The name of the achievement associated with this trigger, if the trigger is an
36
37
  # achievement.
37
38
  attr_reader :achievement_name
39
+ # @return [TrophyApiClient::PointsTriggerResponseTimeUnit] The time unit of the trigger, if the trigger is a time interval.
40
+ attr_reader :time_unit
41
+ # @return [Integer] The interval of the trigger in the time unit, if the trigger is a time interval.
42
+ attr_reader :time_interval
38
43
  # @return [Array<TrophyApiClient::PointsTriggerResponseUserAttributesItem>] User attribute filters that must be met for this trigger to activate. Only
39
44
  # present if the trigger has user attribute filters configured.
40
45
  attr_reader :user_attributes
@@ -55,19 +60,21 @@ module TrophyApiClient
55
60
 
56
61
  # @param id [String] The unique ID of the trigger.
57
62
  # @param type [TrophyApiClient::PointsTriggerResponseType] The type of trigger.
58
- # @param points [Float] The points awarded by this trigger.
63
+ # @param points [Integer] The points awarded by this trigger.
59
64
  # @param status [TrophyApiClient::PointsTriggerResponseStatus] The status of the trigger.
60
65
  # @param achievement_id [String] The unique ID of the achievement associated with this trigger, if the trigger is
61
66
  # an achievement.
62
67
  # @param metric_id [String] The unique ID of the metric associated with this trigger, if the trigger is a
63
68
  # metric.
64
- # @param metric_threshold [Float] The amount that a user must increase the metric to earn the points, if the
69
+ # @param metric_threshold [Integer] The amount that a user must increase the metric to earn the points, if the
65
70
  # trigger is a metric.
66
- # @param streak_length_threshold [Float] The number of consecutive streak periods that a user must complete to earn the
71
+ # @param streak_length_threshold [Integer] The number of consecutive streak periods that a user must complete to earn the
67
72
  # points, if the trigger is a streak.
68
73
  # @param metric_name [String] The name of the metric associated with this trigger, if the trigger is a metric.
69
74
  # @param achievement_name [String] The name of the achievement associated with this trigger, if the trigger is an
70
75
  # achievement.
76
+ # @param time_unit [TrophyApiClient::PointsTriggerResponseTimeUnit] The time unit of the trigger, if the trigger is a time interval.
77
+ # @param time_interval [Integer] The interval of the trigger in the time unit, if the trigger is a time interval.
71
78
  # @param user_attributes [Array<TrophyApiClient::PointsTriggerResponseUserAttributesItem>] User attribute filters that must be met for this trigger to activate. Only
72
79
  # present if the trigger has user attribute filters configured.
73
80
  # @param event_attribute [TrophyApiClient::PointsTriggerResponseEventAttribute] Event attribute filter that must be met for this trigger to activate. Only
@@ -76,22 +83,24 @@ module TrophyApiClient
76
83
  # @param updated [DateTime] The date and time the trigger was last updated, in ISO 8601 format.
77
84
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
78
85
  # @return [TrophyApiClient::PointsTriggerResponse]
79
- def initialize(id: OMIT, type: OMIT, points: OMIT, status: OMIT, achievement_id: OMIT, metric_id: OMIT,
80
- metric_threshold: OMIT, streak_length_threshold: OMIT, metric_name: OMIT, achievement_name: OMIT, user_attributes: OMIT, event_attribute: OMIT, created: OMIT, updated: OMIT, additional_properties: nil)
81
- @id = id if id != OMIT
82
- @type = type if type != OMIT
83
- @points = points if points != OMIT
84
- @status = status if status != OMIT
86
+ def initialize(id:, type:, points:, status:, created:, updated:, achievement_id: OMIT, metric_id: OMIT, metric_threshold: OMIT,
87
+ streak_length_threshold: OMIT, metric_name: OMIT, achievement_name: OMIT, time_unit: OMIT, time_interval: OMIT, user_attributes: OMIT, event_attribute: OMIT, additional_properties: nil)
88
+ @id = id
89
+ @type = type
90
+ @points = points
91
+ @status = status
85
92
  @achievement_id = achievement_id if achievement_id != OMIT
86
93
  @metric_id = metric_id if metric_id != OMIT
87
94
  @metric_threshold = metric_threshold if metric_threshold != OMIT
88
95
  @streak_length_threshold = streak_length_threshold if streak_length_threshold != OMIT
89
96
  @metric_name = metric_name if metric_name != OMIT
90
97
  @achievement_name = achievement_name if achievement_name != OMIT
98
+ @time_unit = time_unit if time_unit != OMIT
99
+ @time_interval = time_interval if time_interval != OMIT
91
100
  @user_attributes = user_attributes if user_attributes != OMIT
92
101
  @event_attribute = event_attribute if event_attribute != OMIT
93
- @created = created if created != OMIT
94
- @updated = updated if updated != OMIT
102
+ @created = created
103
+ @updated = updated
95
104
  @additional_properties = additional_properties
96
105
  @_field_set = {
97
106
  "id": id,
@@ -104,6 +113,8 @@ module TrophyApiClient
104
113
  "streakLengthThreshold": streak_length_threshold,
105
114
  "metricName": metric_name,
106
115
  "achievementName": achievement_name,
116
+ "timeUnit": time_unit,
117
+ "timeInterval": time_interval,
107
118
  "userAttributes": user_attributes,
108
119
  "eventAttribute": event_attribute,
109
120
  "created": created,
@@ -130,6 +141,8 @@ module TrophyApiClient
130
141
  streak_length_threshold = parsed_json["streakLengthThreshold"]
131
142
  metric_name = parsed_json["metricName"]
132
143
  achievement_name = parsed_json["achievementName"]
144
+ time_unit = parsed_json["timeUnit"]
145
+ time_interval = parsed_json["timeInterval"]
133
146
  user_attributes = parsed_json["userAttributes"]&.map do |item|
134
147
  item = item.to_json
135
148
  TrophyApiClient::PointsTriggerResponseUserAttributesItem.from_json(json_object: item)
@@ -153,6 +166,8 @@ module TrophyApiClient
153
166
  streak_length_threshold: streak_length_threshold,
154
167
  metric_name: metric_name,
155
168
  achievement_name: achievement_name,
169
+ time_unit: time_unit,
170
+ time_interval: time_interval,
156
171
  user_attributes: user_attributes,
157
172
  event_attribute: event_attribute,
158
173
  created: created,
@@ -175,20 +190,22 @@ module TrophyApiClient
175
190
  # @param obj [Object]
176
191
  # @return [Void]
177
192
  def self.validate_raw(obj:)
178
- obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
179
- obj.type&.is_a?(TrophyApiClient::PointsTriggerResponseType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
180
- obj.points&.is_a?(Float) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
181
- obj.status&.is_a?(TrophyApiClient::PointsTriggerResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
193
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
194
+ obj.type.is_a?(TrophyApiClient::PointsTriggerResponseType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
195
+ obj.points.is_a?(Integer) != false || raise("Passed value for field obj.points is not the expected type, validation failed.")
196
+ obj.status.is_a?(TrophyApiClient::PointsTriggerResponseStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
182
197
  obj.achievement_id&.is_a?(String) != false || raise("Passed value for field obj.achievement_id is not the expected type, validation failed.")
183
198
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
184
- obj.metric_threshold&.is_a?(Float) != false || raise("Passed value for field obj.metric_threshold is not the expected type, validation failed.")
185
- obj.streak_length_threshold&.is_a?(Float) != false || raise("Passed value for field obj.streak_length_threshold is not the expected type, validation failed.")
199
+ obj.metric_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.metric_threshold is not the expected type, validation failed.")
200
+ obj.streak_length_threshold&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length_threshold is not the expected type, validation failed.")
186
201
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
187
202
  obj.achievement_name&.is_a?(String) != false || raise("Passed value for field obj.achievement_name is not the expected type, validation failed.")
203
+ obj.time_unit&.is_a?(TrophyApiClient::PointsTriggerResponseTimeUnit) != false || raise("Passed value for field obj.time_unit is not the expected type, validation failed.")
204
+ obj.time_interval&.is_a?(Integer) != false || raise("Passed value for field obj.time_interval is not the expected type, validation failed.")
188
205
  obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
189
206
  obj.event_attribute.nil? || TrophyApiClient::PointsTriggerResponseEventAttribute.validate_raw(obj: obj.event_attribute)
190
- obj.created&.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
191
- obj.updated&.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
207
+ obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
208
+ obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
192
209
  end
193
210
  end
194
211
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TrophyApiClient
4
+ # The time unit of the trigger, if the trigger is a time interval.
5
+ class PointsTriggerResponseTimeUnit
6
+ HOUR = "hour"
7
+ DAY = "day"
8
+ end
9
+ end
@@ -6,5 +6,7 @@ module TrophyApiClient
6
6
  METRIC = "metric"
7
7
  ACHIEVEMENT = "achievement"
8
8
  STREAK = "streak"
9
+ TIME = "time"
10
+ USER_CREATION = "user_creation"
9
11
  end
10
12
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TrophyApiClient
4
+ # If the trigger has type 'time', the unit of time after which to award points
5
+ class PointsTriggerTimeUnit
6
+ HOUR = "hour"
7
+ DAY = "day"
8
+ end
9
+ end
@@ -6,5 +6,7 @@ module TrophyApiClient
6
6
  METRIC = "metric"
7
7
  ACHIEVEMENT = "achievement"
8
8
  STREAK = "streak"
9
+ TIME = "time"
10
+ USER_CREATION = "user_creation"
9
11
  end
10
12
  end
@@ -38,14 +38,14 @@ module TrophyApiClient
38
38
  # up in the Trophy dashboard.
39
39
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
40
40
  # @return [TrophyApiClient::UpdatedUser]
41
- def initialize(email: OMIT, name: OMIT, tz: OMIT, device_tokens: OMIT, subscribe_to_emails: OMIT, attributes: OMIT,
41
+ def initialize(email:, name:, device_tokens:, subscribe_to_emails:, attributes:, tz: OMIT,
42
42
  additional_properties: nil)
43
- @email = email if email != OMIT
44
- @name = name if name != OMIT
43
+ @email = email
44
+ @name = name
45
45
  @tz = tz if tz != OMIT
46
- @device_tokens = device_tokens if device_tokens != OMIT
47
- @subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
48
- @attributes = attributes if attributes != OMIT
46
+ @device_tokens = device_tokens
47
+ @subscribe_to_emails = subscribe_to_emails
48
+ @attributes = attributes
49
49
  @additional_properties = additional_properties
50
50
  @_field_set = {
51
51
  "email": email,
@@ -97,12 +97,12 @@ module TrophyApiClient
97
97
  # @param obj [Object]
98
98
  # @return [Void]
99
99
  def self.validate_raw(obj:)
100
- obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
101
- obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
100
+ obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
101
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
102
102
  obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
103
- obj.device_tokens&.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
104
- obj.subscribe_to_emails&.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
105
- obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
103
+ obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
104
+ obj.subscribe_to_emails.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
105
+ obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
106
106
  end
107
107
  end
108
108
  end
@@ -41,15 +41,15 @@ module TrophyApiClient
41
41
  # up in the Trophy dashboard.
42
42
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
43
43
  # @return [TrophyApiClient::UpsertedUser]
44
- def initialize(id:, email: OMIT, name: OMIT, tz: OMIT, device_tokens: OMIT, subscribe_to_emails: OMIT,
45
- attributes: OMIT, additional_properties: nil)
44
+ def initialize(id:, email:, name:, device_tokens:, subscribe_to_emails:, attributes:, tz: OMIT,
45
+ additional_properties: nil)
46
46
  @id = id
47
- @email = email if email != OMIT
48
- @name = name if name != OMIT
47
+ @email = email
48
+ @name = name
49
49
  @tz = tz if tz != OMIT
50
- @device_tokens = device_tokens if device_tokens != OMIT
51
- @subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
52
- @attributes = attributes if attributes != OMIT
50
+ @device_tokens = device_tokens
51
+ @subscribe_to_emails = subscribe_to_emails
52
+ @attributes = attributes
53
53
  @additional_properties = additional_properties
54
54
  @_field_set = {
55
55
  "id": id,
@@ -105,12 +105,12 @@ module TrophyApiClient
105
105
  # @return [Void]
106
106
  def self.validate_raw(obj:)
107
107
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
108
- obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
109
- obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
108
+ obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
109
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
110
110
  obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
111
- obj.device_tokens&.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
112
- obj.subscribe_to_emails&.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
113
- obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
111
+ obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
112
+ obj.subscribe_to_emails.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
113
+ obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
114
114
  end
115
115
  end
116
116
  end
@@ -53,18 +53,18 @@ module TrophyApiClient
53
53
  # up in the Trophy dashboard.
54
54
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
55
55
  # @return [TrophyApiClient::User]
56
- def initialize(id:, control: OMIT, created: OMIT, updated: OMIT, email: OMIT, name: OMIT, tz: OMIT,
57
- device_tokens: OMIT, subscribe_to_emails: OMIT, attributes: OMIT, additional_properties: nil)
58
- @control = control if control != OMIT
59
- @created = created if created != OMIT
60
- @updated = updated if updated != OMIT
56
+ def initialize(control:, created:, updated:, id:, email:, name:, device_tokens:, subscribe_to_emails:, attributes:,
57
+ tz: OMIT, additional_properties: nil)
58
+ @control = control
59
+ @created = created
60
+ @updated = updated
61
61
  @id = id
62
- @email = email if email != OMIT
63
- @name = name if name != OMIT
62
+ @email = email
63
+ @name = name
64
64
  @tz = tz if tz != OMIT
65
- @device_tokens = device_tokens if device_tokens != OMIT
66
- @subscribe_to_emails = subscribe_to_emails if subscribe_to_emails != OMIT
67
- @attributes = attributes if attributes != OMIT
65
+ @device_tokens = device_tokens
66
+ @subscribe_to_emails = subscribe_to_emails
67
+ @attributes = attributes
68
68
  @additional_properties = additional_properties
69
69
  @_field_set = {
70
70
  "control": control,
@@ -128,16 +128,16 @@ module TrophyApiClient
128
128
  # @param obj [Object]
129
129
  # @return [Void]
130
130
  def self.validate_raw(obj:)
131
- obj.control&.is_a?(Boolean) != false || raise("Passed value for field obj.control is not the expected type, validation failed.")
132
- obj.created&.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
133
- obj.updated&.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
131
+ obj.control.is_a?(Boolean) != false || raise("Passed value for field obj.control is not the expected type, validation failed.")
132
+ obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
133
+ obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
134
134
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
135
- obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
136
- obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
135
+ obj.email.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
136
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
137
137
  obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
138
- obj.device_tokens&.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
139
- obj.subscribe_to_emails&.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
140
- obj.attributes&.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
138
+ obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
139
+ obj.subscribe_to_emails.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
140
+ obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
141
141
  end
142
142
  end
143
143
  end