trophy_api_client 1.0.38 → 1.0.40

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gemconfig.rb +1 -1
  3. data/lib/trophy_api_client/admin/streaks/client.rb +11 -8
  4. data/lib/trophy_api_client/admin/streaks/types/restore_streaks_request_users_item.rb +59 -0
  5. data/lib/trophy_api_client/types/achievement_completion_response.rb +5 -5
  6. data/lib/trophy_api_client/types/achievement_response.rb +35 -5
  7. data/lib/trophy_api_client/types/{achievement_with_stats_response_event_attribute.rb → achievement_response_event_attribute.rb} +5 -7
  8. data/lib/trophy_api_client/types/{achievement_with_stats_response_user_attributes_item.rb → achievement_response_user_attributes_item.rb} +5 -6
  9. data/lib/trophy_api_client/types/achievement_with_stats_response.rb +35 -35
  10. data/lib/trophy_api_client/types/bulk_streak_response_item.rb +10 -6
  11. data/lib/trophy_api_client/types/event_response.rb +4 -4
  12. data/lib/trophy_api_client/types/metric_response.rb +4 -4
  13. data/lib/trophy_api_client/types/user.rb +4 -4
  14. data/lib/trophy_api_client/types/{achievement_completion_response_achievement.rb → user_achievement_response.rb} +40 -72
  15. data/lib/trophy_api_client/types/{completed_achievement_response.rb → user_achievement_with_stats_response.rb} +40 -40
  16. data/lib/trophy_api_client/types/webhooks_achievement_completed_payload.rb +5 -5
  17. data/lib/trophy_api_client/types/wrapped_activity_period.rb +4 -4
  18. data/lib/trophy_api_client/types/wrapped_entire_year.rb +4 -4
  19. data/lib/trophy_api_client/types/wrapped_most_active_day.rb +4 -4
  20. data/lib/trophy_api_client/types/wrapped_most_active_month.rb +4 -4
  21. data/lib/trophy_api_client/types/wrapped_most_active_week.rb +4 -4
  22. data/lib/trophy_api_client/users/client.rb +5 -5
  23. data/lib/trophy_api_client/version.rb +1 -1
  24. data/lib/types_export.rb +5 -4
  25. metadata +6 -5
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "metric_status"
4
- require_relative "completed_achievement_response"
4
+ require_relative "user_achievement_response"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -17,7 +17,7 @@ module TrophyApiClient
17
17
  attr_reader :status
18
18
  # @return [Float] The user's current total for the metric.
19
19
  attr_reader :current
20
- # @return [Array<TrophyApiClient::CompletedAchievementResponse>] A list of the metric's achievements and the user's progress towards each.
20
+ # @return [Array<TrophyApiClient::UserAchievementResponse>] A list of the metric's achievements and the user's progress towards each.
21
21
  attr_reader :achievements
22
22
  # @return [OpenStruct] Additional properties unmapped to the current class definition
23
23
  attr_reader :additional_properties
@@ -32,7 +32,7 @@ module TrophyApiClient
32
32
  # @param name [String] The name of the metric.
33
33
  # @param status [TrophyApiClient::MetricStatus] The status of the metric.
34
34
  # @param current [Float] The user's current total for the metric.
35
- # @param achievements [Array<TrophyApiClient::CompletedAchievementResponse>] A list of the metric's achievements and the user's progress towards each.
35
+ # @param achievements [Array<TrophyApiClient::UserAchievementResponse>] A list of the metric's achievements and the user's progress towards each.
36
36
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
37
37
  # @return [TrophyApiClient::MetricResponse]
38
38
  def initialize(id:, key:, name:, status:, current:, achievements:, additional_properties: nil)
@@ -67,7 +67,7 @@ module TrophyApiClient
67
67
  current = parsed_json["current"]
68
68
  achievements = parsed_json["achievements"]&.map do |item|
69
69
  item = item.to_json
70
- TrophyApiClient::CompletedAchievementResponse.from_json(json_object: item)
70
+ TrophyApiClient::UserAchievementResponse.from_json(json_object: item)
71
71
  end
72
72
  new(
73
73
  id: id,
@@ -51,13 +51,13 @@ module TrophyApiClient
51
51
  # @param updated [DateTime] The date and time the user was last updated, in ISO 8601 format.
52
52
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
53
53
  # @return [TrophyApiClient::User]
54
- def initialize(id:, device_tokens:, subscribe_to_emails:, attributes:, control:, created:, updated:, email: OMIT,
55
- name: OMIT, tz: OMIT, additional_properties: nil)
54
+ def initialize(id:, subscribe_to_emails:, attributes:, control:, created:, updated:, email: OMIT, name: OMIT,
55
+ tz: OMIT, device_tokens: OMIT, additional_properties: nil)
56
56
  @id = id
57
57
  @email = email if email != OMIT
58
58
  @name = name if name != OMIT
59
59
  @tz = tz if tz != OMIT
60
- @device_tokens = device_tokens
60
+ @device_tokens = device_tokens if device_tokens != OMIT
61
61
  @subscribe_to_emails = subscribe_to_emails
62
62
  @attributes = attributes
63
63
  @control = control
@@ -130,7 +130,7 @@ module TrophyApiClient
130
130
  obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
131
131
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
132
132
  obj.tz&.is_a?(String) != false || raise("Passed value for field obj.tz is not the expected type, validation failed.")
133
- obj.device_tokens.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
133
+ obj.device_tokens&.is_a?(Array) != false || raise("Passed value for field obj.device_tokens is not the expected type, validation failed.")
134
134
  obj.subscribe_to_emails.is_a?(Boolean) != false || raise("Passed value for field obj.subscribe_to_emails is not the expected type, validation failed.")
135
135
  obj.attributes.is_a?(Hash) != false || raise("Passed value for field obj.attributes is not the expected type, validation failed.")
136
136
  obj.control.is_a?(Boolean) != false || raise("Passed value for field obj.control is not the expected type, validation failed.")
@@ -1,30 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "metric_event_streak_response"
4
3
  require "date"
5
- require_relative "achievement_with_stats_response_user_attributes_item"
6
- require_relative "achievement_with_stats_response_event_attribute"
7
4
  require_relative "achievement_response_trigger"
5
+ require_relative "achievement_response_user_attributes_item"
6
+ require_relative "achievement_response_event_attribute"
8
7
  require "ostruct"
9
8
  require "json"
10
9
 
11
10
  module TrophyApiClient
12
- class AchievementCompletionResponseAchievement
13
- # @return [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
14
- attr_reader :current_streak
11
+ class UserAchievementResponse
15
12
  # @return [DateTime] The date and time the achievement was completed, in ISO 8601 format. Null if the
16
13
  # achievement has not been completed.
17
14
  attr_reader :achieved_at
18
- # @return [Integer] The number of users who have completed this achievement.
19
- attr_reader :completions
20
- # @return [Float] The percentage of all users who have completed this achievement.
21
- attr_reader :rarity
22
- # @return [Array<TrophyApiClient::AchievementWithStatsResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
23
- # Only present if the achievement has user attribute filters configured.
24
- attr_reader :user_attributes
25
- # @return [TrophyApiClient::AchievementWithStatsResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
26
- # Only present if the achievement has an event filter configured.
27
- attr_reader :event_attribute
28
15
  # @return [String] The unique ID of the achievement.
29
16
  attr_reader :id
30
17
  # @return [String] The name of this achievement.
@@ -50,6 +37,12 @@ module TrophyApiClient
50
37
  # @return [String] The name of the metric associated with this achievement (only applicable if
51
38
  # trigger = 'metric')
52
39
  attr_reader :metric_name
40
+ # @return [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
41
+ # Only present if the achievement has user attribute filters configured.
42
+ attr_reader :user_attributes
43
+ # @return [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
44
+ # Only present if the achievement has an event filter configured.
45
+ attr_reader :event_attribute
53
46
  # @return [OpenStruct] Additional properties unmapped to the current class definition
54
47
  attr_reader :additional_properties
55
48
  # @return [Object]
@@ -58,15 +51,8 @@ module TrophyApiClient
58
51
 
59
52
  OMIT = Object.new
60
53
 
61
- # @param current_streak [TrophyApiClient::MetricEventStreakResponse] The user's current streak for the metric, if the metric has streaks enabled.
62
54
  # @param achieved_at [DateTime] The date and time the achievement was completed, in ISO 8601 format. Null if the
63
55
  # achievement has not been completed.
64
- # @param completions [Integer] The number of users who have completed this achievement.
65
- # @param rarity [Float] The percentage of all users who have completed this achievement.
66
- # @param user_attributes [Array<TrophyApiClient::AchievementWithStatsResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
67
- # Only present if the achievement has user attribute filters configured.
68
- # @param event_attribute [TrophyApiClient::AchievementWithStatsResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
69
- # Only present if the achievement has an event filter configured.
70
56
  # @param id [String] The unique ID of the achievement.
71
57
  # @param name [String] The name of this achievement.
72
58
  # @param trigger [TrophyApiClient::AchievementResponseTrigger] The trigger of the achievement.
@@ -82,34 +68,30 @@ module TrophyApiClient
82
68
  # trigger = 'metric')
83
69
  # @param metric_name [String] The name of the metric associated with this achievement (only applicable if
84
70
  # trigger = 'metric')
71
+ # @param user_attributes [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
72
+ # Only present if the achievement has user attribute filters configured.
73
+ # @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
74
+ # Only present if the achievement has an event filter configured.
85
75
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
86
- # @return [TrophyApiClient::AchievementCompletionResponseAchievement]
87
- def initialize(completions:, rarity:, id:, name:, trigger:, key:, current_streak: OMIT, achieved_at: OMIT, user_attributes: OMIT,
88
- event_attribute: OMIT, description: OMIT, badge_url: OMIT, streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, additional_properties: nil)
89
- @current_streak = current_streak if current_streak != OMIT
76
+ # @return [TrophyApiClient::UserAchievementResponse]
77
+ def initialize(id:, name:, trigger:, achieved_at: OMIT, description: OMIT, badge_url: OMIT, key: OMIT,
78
+ streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, user_attributes: OMIT, event_attribute: OMIT, additional_properties: nil)
90
79
  @achieved_at = achieved_at if achieved_at != OMIT
91
- @completions = completions
92
- @rarity = rarity
93
- @user_attributes = user_attributes if user_attributes != OMIT
94
- @event_attribute = event_attribute if event_attribute != OMIT
95
80
  @id = id
96
81
  @name = name
97
82
  @trigger = trigger
98
83
  @description = description if description != OMIT
99
84
  @badge_url = badge_url if badge_url != OMIT
100
- @key = key
85
+ @key = key if key != OMIT
101
86
  @streak_length = streak_length if streak_length != OMIT
102
87
  @metric_id = metric_id if metric_id != OMIT
103
88
  @metric_value = metric_value if metric_value != OMIT
104
89
  @metric_name = metric_name if metric_name != OMIT
90
+ @user_attributes = user_attributes if user_attributes != OMIT
91
+ @event_attribute = event_attribute if event_attribute != OMIT
105
92
  @additional_properties = additional_properties
106
93
  @_field_set = {
107
- "currentStreak": current_streak,
108
94
  "achievedAt": achieved_at,
109
- "completions": completions,
110
- "rarity": rarity,
111
- "userAttributes": user_attributes,
112
- "eventAttribute": event_attribute,
113
95
  "id": id,
114
96
  "name": name,
115
97
  "trigger": trigger,
@@ -119,39 +101,22 @@ module TrophyApiClient
119
101
  "streakLength": streak_length,
120
102
  "metricId": metric_id,
121
103
  "metricValue": metric_value,
122
- "metricName": metric_name
104
+ "metricName": metric_name,
105
+ "userAttributes": user_attributes,
106
+ "eventAttribute": event_attribute
123
107
  }.reject do |_k, v|
124
108
  v == OMIT
125
109
  end
126
110
  end
127
111
 
128
- # Deserialize a JSON object to an instance of
129
- # AchievementCompletionResponseAchievement
112
+ # Deserialize a JSON object to an instance of UserAchievementResponse
130
113
  #
131
114
  # @param json_object [String]
132
- # @return [TrophyApiClient::AchievementCompletionResponseAchievement]
115
+ # @return [TrophyApiClient::UserAchievementResponse]
133
116
  def self.from_json(json_object:)
134
117
  struct = JSON.parse(json_object, object_class: OpenStruct)
135
118
  parsed_json = JSON.parse(json_object)
136
- if parsed_json["currentStreak"].nil?
137
- current_streak = nil
138
- else
139
- current_streak = parsed_json["currentStreak"].to_json
140
- current_streak = TrophyApiClient::MetricEventStreakResponse.from_json(json_object: current_streak)
141
- end
142
119
  achieved_at = (DateTime.parse(parsed_json["achievedAt"]) unless parsed_json["achievedAt"].nil?)
143
- completions = parsed_json["completions"]
144
- rarity = parsed_json["rarity"]
145
- user_attributes = parsed_json["userAttributes"]&.map do |item|
146
- item = item.to_json
147
- TrophyApiClient::AchievementWithStatsResponseUserAttributesItem.from_json(json_object: item)
148
- end
149
- if parsed_json["eventAttribute"].nil?
150
- event_attribute = nil
151
- else
152
- event_attribute = parsed_json["eventAttribute"].to_json
153
- event_attribute = TrophyApiClient::AchievementWithStatsResponseEventAttribute.from_json(json_object: event_attribute)
154
- end
155
120
  id = parsed_json["id"]
156
121
  name = parsed_json["name"]
157
122
  trigger = parsed_json["trigger"]
@@ -162,13 +127,18 @@ module TrophyApiClient
162
127
  metric_id = parsed_json["metricId"]
163
128
  metric_value = parsed_json["metricValue"]
164
129
  metric_name = parsed_json["metricName"]
130
+ user_attributes = parsed_json["userAttributes"]&.map do |item|
131
+ item = item.to_json
132
+ TrophyApiClient::AchievementResponseUserAttributesItem.from_json(json_object: item)
133
+ end
134
+ if parsed_json["eventAttribute"].nil?
135
+ event_attribute = nil
136
+ else
137
+ event_attribute = parsed_json["eventAttribute"].to_json
138
+ event_attribute = TrophyApiClient::AchievementResponseEventAttribute.from_json(json_object: event_attribute)
139
+ end
165
140
  new(
166
- current_streak: current_streak,
167
141
  achieved_at: achieved_at,
168
- completions: completions,
169
- rarity: rarity,
170
- user_attributes: user_attributes,
171
- event_attribute: event_attribute,
172
142
  id: id,
173
143
  name: name,
174
144
  trigger: trigger,
@@ -179,12 +149,13 @@ module TrophyApiClient
179
149
  metric_id: metric_id,
180
150
  metric_value: metric_value,
181
151
  metric_name: metric_name,
152
+ user_attributes: user_attributes,
153
+ event_attribute: event_attribute,
182
154
  additional_properties: struct
183
155
  )
184
156
  end
185
157
 
186
- # Serialize an instance of AchievementCompletionResponseAchievement to a JSON
187
- # object
158
+ # Serialize an instance of UserAchievementResponse to a JSON object
188
159
  #
189
160
  # @return [String]
190
161
  def to_json(*_args)
@@ -198,22 +169,19 @@ module TrophyApiClient
198
169
  # @param obj [Object]
199
170
  # @return [Void]
200
171
  def self.validate_raw(obj:)
201
- obj.current_streak.nil? || TrophyApiClient::MetricEventStreakResponse.validate_raw(obj: obj.current_streak)
202
172
  obj.achieved_at&.is_a?(DateTime) != false || raise("Passed value for field obj.achieved_at is not the expected type, validation failed.")
203
- obj.completions.is_a?(Integer) != false || raise("Passed value for field obj.completions is not the expected type, validation failed.")
204
- obj.rarity.is_a?(Float) != false || raise("Passed value for field obj.rarity is not the expected type, validation failed.")
205
- obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
206
- obj.event_attribute.nil? || TrophyApiClient::AchievementWithStatsResponseEventAttribute.validate_raw(obj: obj.event_attribute)
207
173
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
208
174
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
209
175
  obj.trigger.is_a?(TrophyApiClient::AchievementResponseTrigger) != false || raise("Passed value for field obj.trigger is not the expected type, validation failed.")
210
176
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
211
177
  obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
212
- obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
178
+ obj.key&.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
213
179
  obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
214
180
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
215
181
  obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
216
182
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
183
+ obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
184
+ obj.event_attribute.nil? || TrophyApiClient::AchievementResponseEventAttribute.validate_raw(obj: obj.event_attribute)
217
185
  end
218
186
  end
219
187
  end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "date"
4
- require_relative "achievement_with_stats_response_user_attributes_item"
5
- require_relative "achievement_with_stats_response_event_attribute"
6
4
  require_relative "achievement_response_trigger"
5
+ require_relative "achievement_response_user_attributes_item"
6
+ require_relative "achievement_response_event_attribute"
7
7
  require "ostruct"
8
8
  require "json"
9
9
 
10
10
  module TrophyApiClient
11
- class CompletedAchievementResponse
11
+ class UserAchievementWithStatsResponse
12
12
  # @return [DateTime] The date and time the achievement was completed, in ISO 8601 format. Null if the
13
13
  # achievement has not been completed.
14
14
  attr_reader :achieved_at
@@ -16,12 +16,6 @@ module TrophyApiClient
16
16
  attr_reader :completions
17
17
  # @return [Float] The percentage of all users who have completed this achievement.
18
18
  attr_reader :rarity
19
- # @return [Array<TrophyApiClient::AchievementWithStatsResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
20
- # Only present if the achievement has user attribute filters configured.
21
- attr_reader :user_attributes
22
- # @return [TrophyApiClient::AchievementWithStatsResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
23
- # Only present if the achievement has an event filter configured.
24
- attr_reader :event_attribute
25
19
  # @return [String] The unique ID of the achievement.
26
20
  attr_reader :id
27
21
  # @return [String] The name of this achievement.
@@ -47,6 +41,12 @@ module TrophyApiClient
47
41
  # @return [String] The name of the metric associated with this achievement (only applicable if
48
42
  # trigger = 'metric')
49
43
  attr_reader :metric_name
44
+ # @return [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
45
+ # Only present if the achievement has user attribute filters configured.
46
+ attr_reader :user_attributes
47
+ # @return [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
48
+ # Only present if the achievement has an event filter configured.
49
+ attr_reader :event_attribute
50
50
  # @return [OpenStruct] Additional properties unmapped to the current class definition
51
51
  attr_reader :additional_properties
52
52
  # @return [Object]
@@ -59,10 +59,6 @@ module TrophyApiClient
59
59
  # achievement has not been completed.
60
60
  # @param completions [Integer] The number of users who have completed this achievement.
61
61
  # @param rarity [Float] The percentage of all users who have completed this achievement.
62
- # @param user_attributes [Array<TrophyApiClient::AchievementWithStatsResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
63
- # Only present if the achievement has user attribute filters configured.
64
- # @param event_attribute [TrophyApiClient::AchievementWithStatsResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
65
- # Only present if the achievement has an event filter configured.
66
62
  # @param id [String] The unique ID of the achievement.
67
63
  # @param name [String] The name of this achievement.
68
64
  # @param trigger [TrophyApiClient::AchievementResponseTrigger] The trigger of the achievement.
@@ -78,32 +74,34 @@ module TrophyApiClient
78
74
  # trigger = 'metric')
79
75
  # @param metric_name [String] The name of the metric associated with this achievement (only applicable if
80
76
  # trigger = 'metric')
77
+ # @param user_attributes [Array<TrophyApiClient::AchievementResponseUserAttributesItem>] User attribute filters that must be met for this achievement to be completed.
78
+ # Only present if the achievement has user attribute filters configured.
79
+ # @param event_attribute [TrophyApiClient::AchievementResponseEventAttribute] Event attribute filter that must be met for this achievement to be completed.
80
+ # Only present if the achievement has an event filter configured.
81
81
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
82
- # @return [TrophyApiClient::CompletedAchievementResponse]
83
- def initialize(completions:, rarity:, id:, name:, trigger:, key:, achieved_at: OMIT, user_attributes: OMIT,
84
- event_attribute: OMIT, description: OMIT, badge_url: OMIT, streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, additional_properties: nil)
82
+ # @return [TrophyApiClient::UserAchievementWithStatsResponse]
83
+ def initialize(completions:, rarity:, id:, name:, trigger:, achieved_at: OMIT, description: OMIT, badge_url: OMIT,
84
+ key: OMIT, streak_length: OMIT, metric_id: OMIT, metric_value: OMIT, metric_name: OMIT, user_attributes: OMIT, event_attribute: OMIT, additional_properties: nil)
85
85
  @achieved_at = achieved_at if achieved_at != OMIT
86
86
  @completions = completions
87
87
  @rarity = rarity
88
- @user_attributes = user_attributes if user_attributes != OMIT
89
- @event_attribute = event_attribute if event_attribute != OMIT
90
88
  @id = id
91
89
  @name = name
92
90
  @trigger = trigger
93
91
  @description = description if description != OMIT
94
92
  @badge_url = badge_url if badge_url != OMIT
95
- @key = key
93
+ @key = key if key != OMIT
96
94
  @streak_length = streak_length if streak_length != OMIT
97
95
  @metric_id = metric_id if metric_id != OMIT
98
96
  @metric_value = metric_value if metric_value != OMIT
99
97
  @metric_name = metric_name if metric_name != OMIT
98
+ @user_attributes = user_attributes if user_attributes != OMIT
99
+ @event_attribute = event_attribute if event_attribute != OMIT
100
100
  @additional_properties = additional_properties
101
101
  @_field_set = {
102
102
  "achievedAt": achieved_at,
103
103
  "completions": completions,
104
104
  "rarity": rarity,
105
- "userAttributes": user_attributes,
106
- "eventAttribute": event_attribute,
107
105
  "id": id,
108
106
  "name": name,
109
107
  "trigger": trigger,
@@ -113,32 +111,24 @@ module TrophyApiClient
113
111
  "streakLength": streak_length,
114
112
  "metricId": metric_id,
115
113
  "metricValue": metric_value,
116
- "metricName": metric_name
114
+ "metricName": metric_name,
115
+ "userAttributes": user_attributes,
116
+ "eventAttribute": event_attribute
117
117
  }.reject do |_k, v|
118
118
  v == OMIT
119
119
  end
120
120
  end
121
121
 
122
- # Deserialize a JSON object to an instance of CompletedAchievementResponse
122
+ # Deserialize a JSON object to an instance of UserAchievementWithStatsResponse
123
123
  #
124
124
  # @param json_object [String]
125
- # @return [TrophyApiClient::CompletedAchievementResponse]
125
+ # @return [TrophyApiClient::UserAchievementWithStatsResponse]
126
126
  def self.from_json(json_object:)
127
127
  struct = JSON.parse(json_object, object_class: OpenStruct)
128
128
  parsed_json = JSON.parse(json_object)
129
129
  achieved_at = (DateTime.parse(parsed_json["achievedAt"]) unless parsed_json["achievedAt"].nil?)
130
130
  completions = parsed_json["completions"]
131
131
  rarity = parsed_json["rarity"]
132
- user_attributes = parsed_json["userAttributes"]&.map do |item|
133
- item = item.to_json
134
- TrophyApiClient::AchievementWithStatsResponseUserAttributesItem.from_json(json_object: item)
135
- end
136
- if parsed_json["eventAttribute"].nil?
137
- event_attribute = nil
138
- else
139
- event_attribute = parsed_json["eventAttribute"].to_json
140
- event_attribute = TrophyApiClient::AchievementWithStatsResponseEventAttribute.from_json(json_object: event_attribute)
141
- end
142
132
  id = parsed_json["id"]
143
133
  name = parsed_json["name"]
144
134
  trigger = parsed_json["trigger"]
@@ -149,12 +139,20 @@ module TrophyApiClient
149
139
  metric_id = parsed_json["metricId"]
150
140
  metric_value = parsed_json["metricValue"]
151
141
  metric_name = parsed_json["metricName"]
142
+ user_attributes = parsed_json["userAttributes"]&.map do |item|
143
+ item = item.to_json
144
+ TrophyApiClient::AchievementResponseUserAttributesItem.from_json(json_object: item)
145
+ end
146
+ if parsed_json["eventAttribute"].nil?
147
+ event_attribute = nil
148
+ else
149
+ event_attribute = parsed_json["eventAttribute"].to_json
150
+ event_attribute = TrophyApiClient::AchievementResponseEventAttribute.from_json(json_object: event_attribute)
151
+ end
152
152
  new(
153
153
  achieved_at: achieved_at,
154
154
  completions: completions,
155
155
  rarity: rarity,
156
- user_attributes: user_attributes,
157
- event_attribute: event_attribute,
158
156
  id: id,
159
157
  name: name,
160
158
  trigger: trigger,
@@ -165,11 +163,13 @@ module TrophyApiClient
165
163
  metric_id: metric_id,
166
164
  metric_value: metric_value,
167
165
  metric_name: metric_name,
166
+ user_attributes: user_attributes,
167
+ event_attribute: event_attribute,
168
168
  additional_properties: struct
169
169
  )
170
170
  end
171
171
 
172
- # Serialize an instance of CompletedAchievementResponse to a JSON object
172
+ # Serialize an instance of UserAchievementWithStatsResponse to a JSON object
173
173
  #
174
174
  # @return [String]
175
175
  def to_json(*_args)
@@ -186,18 +186,18 @@ module TrophyApiClient
186
186
  obj.achieved_at&.is_a?(DateTime) != false || raise("Passed value for field obj.achieved_at is not the expected type, validation failed.")
187
187
  obj.completions.is_a?(Integer) != false || raise("Passed value for field obj.completions is not the expected type, validation failed.")
188
188
  obj.rarity.is_a?(Float) != false || raise("Passed value for field obj.rarity is not the expected type, validation failed.")
189
- obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
190
- obj.event_attribute.nil? || TrophyApiClient::AchievementWithStatsResponseEventAttribute.validate_raw(obj: obj.event_attribute)
191
189
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
192
190
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
193
191
  obj.trigger.is_a?(TrophyApiClient::AchievementResponseTrigger) != false || raise("Passed value for field obj.trigger is not the expected type, validation failed.")
194
192
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
195
193
  obj.badge_url&.is_a?(String) != false || raise("Passed value for field obj.badge_url is not the expected type, validation failed.")
196
- obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
194
+ obj.key&.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
197
195
  obj.streak_length&.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
198
196
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
199
197
  obj.metric_value&.is_a?(Float) != false || raise("Passed value for field obj.metric_value is not the expected type, validation failed.")
200
198
  obj.metric_name&.is_a?(String) != false || raise("Passed value for field obj.metric_name is not the expected type, validation failed.")
199
+ obj.user_attributes&.is_a?(Array) != false || raise("Passed value for field obj.user_attributes is not the expected type, validation failed.")
200
+ obj.event_attribute.nil? || TrophyApiClient::AchievementResponseEventAttribute.validate_raw(obj: obj.event_attribute)
201
201
  end
202
202
  end
203
203
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "user"
4
- require_relative "completed_achievement_response"
4
+ require_relative "user_achievement_response"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -11,7 +11,7 @@ module TrophyApiClient
11
11
  attr_reader :type
12
12
  # @return [TrophyApiClient::User] The user who completed the achievement.
13
13
  attr_reader :user
14
- # @return [TrophyApiClient::CompletedAchievementResponse] The achievement completion that occurred.
14
+ # @return [TrophyApiClient::UserAchievementResponse] The achievement completion that occurred.
15
15
  attr_reader :achievement
16
16
  # @return [OpenStruct] Additional properties unmapped to the current class definition
17
17
  attr_reader :additional_properties
@@ -23,7 +23,7 @@ module TrophyApiClient
23
23
 
24
24
  # @param type [String] The webhook event type.
25
25
  # @param user [TrophyApiClient::User] The user who completed the achievement.
26
- # @param achievement [TrophyApiClient::CompletedAchievementResponse] The achievement completion that occurred.
26
+ # @param achievement [TrophyApiClient::UserAchievementResponse] The achievement completion that occurred.
27
27
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
28
28
  # @return [TrophyApiClient::WebhooksAchievementCompletedPayload]
29
29
  def initialize(type:, user:, achievement:, additional_properties: nil)
@@ -52,7 +52,7 @@ module TrophyApiClient
52
52
  achievement = nil
53
53
  else
54
54
  achievement = parsed_json["achievement"].to_json
55
- achievement = TrophyApiClient::CompletedAchievementResponse.from_json(json_object: achievement)
55
+ achievement = TrophyApiClient::UserAchievementResponse.from_json(json_object: achievement)
56
56
  end
57
57
  new(
58
58
  type: type,
@@ -78,7 +78,7 @@ module TrophyApiClient
78
78
  def self.validate_raw(obj:)
79
79
  obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
80
80
  TrophyApiClient::User.validate_raw(obj: obj.user)
81
- TrophyApiClient::CompletedAchievementResponse.validate_raw(obj: obj.achievement)
81
+ TrophyApiClient::UserAchievementResponse.validate_raw(obj: obj.achievement)
82
82
  end
83
83
  end
84
84
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "completed_achievement_response"
3
+ require_relative "user_achievement_response"
4
4
  require "ostruct"
5
5
  require "json"
6
6
 
@@ -11,7 +11,7 @@ module TrophyApiClient
11
11
  attr_reader :metrics
12
12
  # @return [Hash{String => TrophyApiClient::WrappedPoints}] The user's points during this period, keyed by points system key.
13
13
  attr_reader :points
14
- # @return [Array<TrophyApiClient::CompletedAchievementResponse>] Achievements completed during this period.
14
+ # @return [Array<TrophyApiClient::UserAchievementResponse>] Achievements completed during this period.
15
15
  attr_reader :achievements
16
16
  # @return [Hash{String => TrophyApiClient::UserLeaderboardResponse}] The user's best leaderboard rankings during this period, keyed by leaderboard
17
17
  # key.
@@ -26,7 +26,7 @@ module TrophyApiClient
26
26
 
27
27
  # @param metrics [Hash{String => TrophyApiClient::WrappedMetric}] The user's metrics during this period, keyed by metric key.
28
28
  # @param points [Hash{String => TrophyApiClient::WrappedPoints}] The user's points during this period, keyed by points system key.
29
- # @param achievements [Array<TrophyApiClient::CompletedAchievementResponse>] Achievements completed during this period.
29
+ # @param achievements [Array<TrophyApiClient::UserAchievementResponse>] Achievements completed during this period.
30
30
  # @param leaderboards [Hash{String => TrophyApiClient::UserLeaderboardResponse}] The user's best leaderboard rankings during this period, keyed by leaderboard
31
31
  # key.
32
32
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
@@ -57,7 +57,7 @@ module TrophyApiClient
57
57
  end
58
58
  achievements = parsed_json["achievements"]&.map do |item|
59
59
  item = item.to_json
60
- TrophyApiClient::CompletedAchievementResponse.from_json(json_object: item)
60
+ TrophyApiClient::UserAchievementResponse.from_json(json_object: item)
61
61
  end
62
62
  leaderboards = parsed_json["leaderboards"]&.transform_values do |value|
63
63
  value = value.to_json
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "wrapped_streak"
4
- require_relative "completed_achievement_response"
4
+ require_relative "user_achievement_response"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -14,7 +14,7 @@ module TrophyApiClient
14
14
  attr_reader :metrics
15
15
  # @return [Hash{String => TrophyApiClient::WrappedPoints}] The user's points during this period, keyed by points system key.
16
16
  attr_reader :points
17
- # @return [Array<TrophyApiClient::CompletedAchievementResponse>] Achievements completed during this period.
17
+ # @return [Array<TrophyApiClient::UserAchievementResponse>] Achievements completed during this period.
18
18
  attr_reader :achievements
19
19
  # @return [Hash{String => TrophyApiClient::UserLeaderboardResponse}] The user's best leaderboard rankings during this period, keyed by leaderboard
20
20
  # key.
@@ -30,7 +30,7 @@ module TrophyApiClient
30
30
  # @param longest_streak [TrophyApiClient::WrappedStreak] The user's longest streak during the year.
31
31
  # @param metrics [Hash{String => TrophyApiClient::WrappedMetric}] The user's metrics during this period, keyed by metric key.
32
32
  # @param points [Hash{String => TrophyApiClient::WrappedPoints}] The user's points during this period, keyed by points system key.
33
- # @param achievements [Array<TrophyApiClient::CompletedAchievementResponse>] Achievements completed during this period.
33
+ # @param achievements [Array<TrophyApiClient::UserAchievementResponse>] Achievements completed during this period.
34
34
  # @param leaderboards [Hash{String => TrophyApiClient::UserLeaderboardResponse}] The user's best leaderboard rankings during this period, keyed by leaderboard
35
35
  # key.
36
36
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
@@ -74,7 +74,7 @@ module TrophyApiClient
74
74
  end
75
75
  achievements = parsed_json["achievements"]&.map do |item|
76
76
  item = item.to_json
77
- TrophyApiClient::CompletedAchievementResponse.from_json(json_object: item)
77
+ TrophyApiClient::UserAchievementResponse.from_json(json_object: item)
78
78
  end
79
79
  leaderboards = parsed_json["leaderboards"]&.transform_values do |value|
80
80
  value = value.to_json
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "completed_achievement_response"
3
+ require_relative "user_achievement_response"
4
4
  require "ostruct"
5
5
  require "json"
6
6
 
@@ -13,7 +13,7 @@ module TrophyApiClient
13
13
  attr_reader :metrics
14
14
  # @return [Hash{String => TrophyApiClient::WrappedPoints}] The user's points during this period, keyed by points system key.
15
15
  attr_reader :points
16
- # @return [Array<TrophyApiClient::CompletedAchievementResponse>] Achievements completed during this period.
16
+ # @return [Array<TrophyApiClient::UserAchievementResponse>] Achievements completed during this period.
17
17
  attr_reader :achievements
18
18
  # @return [Hash{String => TrophyApiClient::UserLeaderboardResponse}] The user's best leaderboard rankings during this period, keyed by leaderboard
19
19
  # key.
@@ -29,7 +29,7 @@ module TrophyApiClient
29
29
  # @param date [String] The date of the most active day in YYYY-MM-DD format.
30
30
  # @param metrics [Hash{String => TrophyApiClient::WrappedMetric}] The user's metrics during this period, keyed by metric key.
31
31
  # @param points [Hash{String => TrophyApiClient::WrappedPoints}] The user's points during this period, keyed by points system key.
32
- # @param achievements [Array<TrophyApiClient::CompletedAchievementResponse>] Achievements completed during this period.
32
+ # @param achievements [Array<TrophyApiClient::UserAchievementResponse>] Achievements completed during this period.
33
33
  # @param leaderboards [Hash{String => TrophyApiClient::UserLeaderboardResponse}] The user's best leaderboard rankings during this period, keyed by leaderboard
34
34
  # key.
35
35
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
@@ -68,7 +68,7 @@ module TrophyApiClient
68
68
  end
69
69
  achievements = parsed_json["achievements"]&.map do |item|
70
70
  item = item.to_json
71
- TrophyApiClient::CompletedAchievementResponse.from_json(json_object: item)
71
+ TrophyApiClient::UserAchievementResponse.from_json(json_object: item)
72
72
  end
73
73
  leaderboards = parsed_json["leaderboards"]&.transform_values do |value|
74
74
  value = value.to_json