trophy_api_client 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cdaf3a518aec65ea9ac8a42cca90ad82ce2f3883499544dd997a6c7537191b1
4
- data.tar.gz: 5ce1d3525b1f2b512aef8d4f6e9978af1a873278e91eec1b01e1cc71a8b76528
3
+ metadata.gz: 53980f53595d29d00f98c8417ae38f192c42eb899139036238aff75acd9a8b5a
4
+ data.tar.gz: fd0a8b34d06eea9ea76d68278384a6dff6189543d8288679b8965632ac3f8bde
5
5
  SHA512:
6
- metadata.gz: dc32ea029c845b7a474ccae57aa445bb92d6878cc676f87fce0dd8909258490cc47eb2fea9d6f3bb0b09703018a8fa9ffb7a4075922ded2d015146008ca38772
7
- data.tar.gz: 044214ba0e7b581eecfc9534289e41d594dc445abde62ef3de33290206296f5c667491869a5fec27c86f4d9c5fa2f3c8982038b4cdedb22450989f2cc3ef2a37
6
+ metadata.gz: a05179e86d3577f0ac681e87434b3c8260bd46de6f0233b69a65afc2802330fe6421c5cdb5f54e7dad967c7528381b9cd66291f9de833f38c2161430e8aba87a
7
+ data.tar.gz: 8821f372ad08068762223ba56af83134916e901f653988ce816626cbdf5f39c403be07d99f9736bab53a8f8621e531742a3c241219030b453642941ca120cd13
data/lib/gemconfig.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module TrophyApiClient
4
4
  module Gemconfig
5
- VERSION = "1.10.0"
5
+ VERSION = "1.12.0"
6
6
  AUTHORS = ["Trophy Labs, Inc"].freeze
7
7
  EMAIL = ""
8
8
  SUMMARY = "Ruby library for the Trophy API."
@@ -3,8 +3,6 @@
3
3
  require_relative "../../requests"
4
4
  require_relative "../types/bulk_streak_response"
5
5
  require "json"
6
- require_relative "types/streaks_rankings_request_type"
7
- require_relative "../types/streak_ranking_user"
8
6
  require "async"
9
7
 
10
8
  module TrophyApiClient
@@ -53,42 +51,6 @@ module TrophyApiClient
53
51
  TrophyApiClient::BulkStreakResponseItem.from_json(json_object: item)
54
52
  end
55
53
  end
56
-
57
- # Get the top users by streak length (active or longest).
58
- #
59
- # @param limit [Integer] Number of users to return. Must be between 1 and 100.
60
- # @param type [TrophyApiClient::Streaks::StreaksRankingsRequestType] Whether to rank users by active streaks or longest streaks ever achieved.
61
- # @param request_options [TrophyApiClient::RequestOptions]
62
- # @return [Array<TrophyApiClient::StreakRankingUser>]
63
- # @example
64
- # api = TrophyApiClient::Client.new(
65
- # base_url: "https://api.example.com",
66
- # environment: TrophyApiClient::Environment::PRODUCTION,
67
- # api_key: "YOUR_API_KEY"
68
- # )
69
- # api.streaks.rankings(limit: 1, type: ACTIVE)
70
- def rankings(limit: nil, type: nil, request_options: nil)
71
- response = @request_client.conn.get do |req|
72
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
73
- req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
74
- req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
75
- req.headers = {
76
- **(req.headers || {}),
77
- **@request_client.get_headers,
78
- **(request_options&.additional_headers || {})
79
- }.compact
80
- req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit, "type": type }.compact
81
- unless request_options.nil? || request_options&.additional_body_parameters.nil?
82
- req.body = { **(request_options&.additional_body_parameters || {}) }.compact
83
- end
84
- req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/streaks/rankings"
85
- end
86
- parsed_json = JSON.parse(response.body)
87
- parsed_json&.map do |item|
88
- item = item.to_json
89
- TrophyApiClient::StreakRankingUser.from_json(json_object: item)
90
- end
91
- end
92
54
  end
93
55
 
94
56
  class AsyncStreaksClient
@@ -138,43 +100,5 @@ module TrophyApiClient
138
100
  end
139
101
  end
140
102
  end
141
-
142
- # Get the top users by streak length (active or longest).
143
- #
144
- # @param limit [Integer] Number of users to return. Must be between 1 and 100.
145
- # @param type [TrophyApiClient::Streaks::StreaksRankingsRequestType] Whether to rank users by active streaks or longest streaks ever achieved.
146
- # @param request_options [TrophyApiClient::RequestOptions]
147
- # @return [Array<TrophyApiClient::StreakRankingUser>]
148
- # @example
149
- # api = TrophyApiClient::Client.new(
150
- # base_url: "https://api.example.com",
151
- # environment: TrophyApiClient::Environment::PRODUCTION,
152
- # api_key: "YOUR_API_KEY"
153
- # )
154
- # api.streaks.rankings(limit: 1, type: ACTIVE)
155
- def rankings(limit: nil, type: nil, request_options: nil)
156
- Async do
157
- response = @request_client.conn.get do |req|
158
- req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
159
- req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
160
- req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
161
- req.headers = {
162
- **(req.headers || {}),
163
- **@request_client.get_headers,
164
- **(request_options&.additional_headers || {})
165
- }.compact
166
- req.params = { **(request_options&.additional_query_parameters || {}), "limit": limit, "type": type }.compact
167
- unless request_options.nil? || request_options&.additional_body_parameters.nil?
168
- req.body = { **(request_options&.additional_body_parameters || {}) }.compact
169
- end
170
- req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/streaks/rankings"
171
- end
172
- parsed_json = JSON.parse(response.body)
173
- parsed_json&.map do |item|
174
- item = item.to_json
175
- TrophyApiClient::StreakRankingUser.from_json(json_object: item)
176
- end
177
- end
178
- end
179
103
  end
180
104
  end
@@ -5,9 +5,12 @@ require "ostruct"
5
5
  require "json"
6
6
 
7
7
  module TrophyApiClient
8
- # A leaderboard event representing a change in a user's rank or value.
8
+ # A daily leaderboard snapshot entry representing the user's rank/value state and
9
+ # the previous persisted state.
9
10
  class LeaderboardEvent
10
- # @return [DateTime] The timestamp when the event occurred.
11
+ # @return [String] The leaderboard snapshot date in YYYY-MM-DD format.
12
+ attr_reader :date
13
+ # @return [DateTime] Deprecated ISO timestamp for the snapshot day boundary. Use `date` instead.
11
14
  attr_reader :timestamp
12
15
  # @return [Integer] The user's rank before this event, or null if they were not on the leaderboard.
13
16
  attr_reader :previous_rank
@@ -27,7 +30,8 @@ module TrophyApiClient
27
30
 
28
31
  OMIT = Object.new
29
32
 
30
- # @param timestamp [DateTime] The timestamp when the event occurred.
33
+ # @param date [String] The leaderboard snapshot date in YYYY-MM-DD format.
34
+ # @param timestamp [DateTime] Deprecated ISO timestamp for the snapshot day boundary. Use `date` instead.
31
35
  # @param previous_rank [Integer] The user's rank before this event, or null if they were not on the leaderboard.
32
36
  # @param rank [Integer] The user's rank after this event, or null if they are no longer on the
33
37
  # leaderboard.
@@ -36,15 +40,17 @@ module TrophyApiClient
36
40
  # leaderboard.
37
41
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
38
42
  # @return [TrophyApiClient::LeaderboardEvent]
39
- def initialize(timestamp: OMIT, previous_rank: OMIT, rank: OMIT, previous_value: OMIT, value: OMIT,
43
+ def initialize(date:, timestamp:, previous_rank: OMIT, rank: OMIT, previous_value: OMIT, value: OMIT,
40
44
  additional_properties: nil)
41
- @timestamp = timestamp if timestamp != OMIT
45
+ @date = date
46
+ @timestamp = timestamp
42
47
  @previous_rank = previous_rank if previous_rank != OMIT
43
48
  @rank = rank if rank != OMIT
44
49
  @previous_value = previous_value if previous_value != OMIT
45
50
  @value = value if value != OMIT
46
51
  @additional_properties = additional_properties
47
52
  @_field_set = {
53
+ "date": date,
48
54
  "timestamp": timestamp,
49
55
  "previousRank": previous_rank,
50
56
  "rank": rank,
@@ -62,12 +68,14 @@ module TrophyApiClient
62
68
  def self.from_json(json_object:)
63
69
  struct = JSON.parse(json_object, object_class: OpenStruct)
64
70
  parsed_json = JSON.parse(json_object)
71
+ date = parsed_json["date"]
65
72
  timestamp = (DateTime.parse(parsed_json["timestamp"]) unless parsed_json["timestamp"].nil?)
66
73
  previous_rank = parsed_json["previousRank"]
67
74
  rank = parsed_json["rank"]
68
75
  previous_value = parsed_json["previousValue"]
69
76
  value = parsed_json["value"]
70
77
  new(
78
+ date: date,
71
79
  timestamp: timestamp,
72
80
  previous_rank: previous_rank,
73
81
  rank: rank,
@@ -91,7 +99,8 @@ module TrophyApiClient
91
99
  # @param obj [Object]
92
100
  # @return [Void]
93
101
  def self.validate_raw(obj:)
94
- obj.timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
102
+ obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
103
+ obj.timestamp.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
95
104
  obj.previous_rank&.is_a?(Integer) != false || raise("Passed value for field obj.previous_rank is not the expected type, validation failed.")
96
105
  obj.rank&.is_a?(Integer) != false || raise("Passed value for field obj.rank is not the expected type, validation failed.")
97
106
  obj.previous_value&.is_a?(Integer) != false || raise("Passed value for field obj.previous_value is not the expected type, validation failed.")
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "date"
3
4
  require_relative "streak_response_streak_history_item"
4
5
  require_relative "streak_frequency"
5
6
  require "ostruct"
@@ -8,12 +9,12 @@ require "json"
8
9
  module TrophyApiClient
9
10
  # An object representing the user's streak.
10
11
  class StreakResponse
12
+ # @return [DateTime] The timestamp the streak was most recently extended. Null if the streak is not
13
+ # active.
14
+ attr_reader :extended
11
15
  # @return [Array<TrophyApiClient::StreakResponseStreakHistoryItem>] A list of the user's past streak periods up through the current period. Each
12
16
  # period includes the start and end dates and the length of the streak.
13
17
  attr_reader :streak_history
14
- # @return [Integer] Deprecated. The user's rank across all users. Null if the user has no active
15
- # streak.
16
- attr_reader :rank
17
18
  # @return [Integer] The length of the user's current streak.
18
19
  attr_reader :length
19
20
  # @return [TrophyApiClient::StreakFrequency] The frequency of the streak.
@@ -46,10 +47,10 @@ module TrophyApiClient
46
47
 
47
48
  OMIT = Object.new
48
49
 
50
+ # @param extended [DateTime] The timestamp the streak was most recently extended. Null if the streak is not
51
+ # active.
49
52
  # @param streak_history [Array<TrophyApiClient::StreakResponseStreakHistoryItem>] A list of the user's past streak periods up through the current period. Each
50
53
  # period includes the start and end dates and the length of the streak.
51
- # @param rank [Integer] Deprecated. The user's rank across all users. Null if the user has no active
52
- # streak.
53
54
  # @param length [Integer] The length of the user's current streak.
54
55
  # @param frequency [TrophyApiClient::StreakFrequency] The frequency of the streak.
55
56
  # @param started [String] The date the streak started.
@@ -66,10 +67,10 @@ module TrophyApiClient
66
67
  # the organization has enabled streak freeze auto-earn.
67
68
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
68
69
  # @return [TrophyApiClient::StreakResponse]
69
- def initialize(length:, frequency:, streak_history: OMIT, rank: OMIT, started: OMIT, period_start: OMIT,
70
+ def initialize(streak_history:, length:, frequency:, extended: OMIT, started: OMIT, period_start: OMIT,
70
71
  period_end: OMIT, expires: OMIT, freezes: OMIT, max_freezes: OMIT, freeze_auto_earn_interval: OMIT, freeze_auto_earn_amount: OMIT, additional_properties: nil)
71
- @streak_history = streak_history if streak_history != OMIT
72
- @rank = rank if rank != OMIT
72
+ @extended = extended if extended != OMIT
73
+ @streak_history = streak_history
73
74
  @length = length
74
75
  @frequency = frequency
75
76
  @started = started if started != OMIT
@@ -82,8 +83,8 @@ module TrophyApiClient
82
83
  @freeze_auto_earn_amount = freeze_auto_earn_amount if freeze_auto_earn_amount != OMIT
83
84
  @additional_properties = additional_properties
84
85
  @_field_set = {
86
+ "extended": extended,
85
87
  "streakHistory": streak_history,
86
- "rank": rank,
87
88
  "length": length,
88
89
  "frequency": frequency,
89
90
  "started": started,
@@ -106,11 +107,11 @@ module TrophyApiClient
106
107
  def self.from_json(json_object:)
107
108
  struct = JSON.parse(json_object, object_class: OpenStruct)
108
109
  parsed_json = JSON.parse(json_object)
110
+ extended = (DateTime.parse(parsed_json["extended"]) unless parsed_json["extended"].nil?)
109
111
  streak_history = parsed_json["streakHistory"]&.map do |item|
110
112
  item = item.to_json
111
113
  TrophyApiClient::StreakResponseStreakHistoryItem.from_json(json_object: item)
112
114
  end
113
- rank = parsed_json["rank"]
114
115
  length = parsed_json["length"]
115
116
  frequency = parsed_json["frequency"]
116
117
  started = parsed_json["started"]
@@ -122,8 +123,8 @@ module TrophyApiClient
122
123
  freeze_auto_earn_interval = parsed_json["freezeAutoEarnInterval"]
123
124
  freeze_auto_earn_amount = parsed_json["freezeAutoEarnAmount"]
124
125
  new(
126
+ extended: extended,
125
127
  streak_history: streak_history,
126
- rank: rank,
127
128
  length: length,
128
129
  frequency: frequency,
129
130
  started: started,
@@ -152,8 +153,8 @@ module TrophyApiClient
152
153
  # @param obj [Object]
153
154
  # @return [Void]
154
155
  def self.validate_raw(obj:)
155
- obj.streak_history&.is_a?(Array) != false || raise("Passed value for field obj.streak_history is not the expected type, validation failed.")
156
- obj.rank&.is_a?(Integer) != false || raise("Passed value for field obj.rank is not the expected type, validation failed.")
156
+ obj.extended&.is_a?(DateTime) != false || raise("Passed value for field obj.extended is not the expected type, validation failed.")
157
+ obj.streak_history.is_a?(Array) != false || raise("Passed value for field obj.streak_history is not the expected type, validation failed.")
157
158
  obj.length.is_a?(Integer) != false || raise("Passed value for field obj.length is not the expected type, validation failed.")
158
159
  obj.frequency.is_a?(TrophyApiClient::StreakFrequency) != false || raise("Passed value for field obj.frequency is not the expected type, validation failed.")
159
160
  obj.started&.is_a?(String) != false || raise("Passed value for field obj.started is not the expected type, validation failed.")
@@ -9,7 +9,7 @@ require "json"
9
9
  module TrophyApiClient
10
10
  # A user's data for a specific leaderboard including rank, value, and history.
11
11
  class UserLeaderboardResponseWithHistory
12
- # @return [Array<TrophyApiClient::LeaderboardEvent>] An array of events showing the user's rank and value changes over time.
12
+ # @return [Array<TrophyApiClient::LeaderboardEvent>] An array of daily change events showing the user's rank and value over time.
13
13
  attr_reader :history
14
14
  # @return [Integer] The user's current rank in this leaderboard. Null if the user is not on the
15
15
  # leaderboard.
@@ -60,7 +60,7 @@ module TrophyApiClient
60
60
 
61
61
  OMIT = Object.new
62
62
 
63
- # @param history [Array<TrophyApiClient::LeaderboardEvent>] An array of events showing the user's rank and value changes over time.
63
+ # @param history [Array<TrophyApiClient::LeaderboardEvent>] An array of daily change events showing the user's rank and value over time.
64
64
  # @param rank [Integer] The user's current rank in this leaderboard. Null if the user is not on the
65
65
  # leaderboard.
66
66
  # @param value [Integer] The user's current value in this leaderboard. Null if the user is not on the
@@ -582,13 +582,13 @@ module TrophyApiClient
582
582
  end
583
583
  end
584
584
 
585
- # Get a user's rank, value, and history for a specific leaderboard.
585
+ # Get a user's rank, value, and daily ranking history for a specific leaderboard.
586
586
  #
587
587
  # @param id [String] The user's ID in your database.
588
588
  # @param key [String] Unique key of the leaderboard as set when created.
589
589
  # @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
590
590
  # run.
591
- # @param num_events [Integer] The number of events to return in the history array.
591
+ # @param num_events [Integer] The number of days to return in the leaderboard history for the user.
592
592
  # @param request_options [TrophyApiClient::RequestOptions]
593
593
  # @return [TrophyApiClient::UserLeaderboardResponseWithHistory]
594
594
  # @example
@@ -1252,13 +1252,13 @@ module TrophyApiClient
1252
1252
  end
1253
1253
  end
1254
1254
 
1255
- # Get a user's rank, value, and history for a specific leaderboard.
1255
+ # Get a user's rank, value, and daily ranking history for a specific leaderboard.
1256
1256
  #
1257
1257
  # @param id [String] The user's ID in your database.
1258
1258
  # @param key [String] Unique key of the leaderboard as set when created.
1259
1259
  # @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
1260
1260
  # run.
1261
- # @param num_events [Integer] The number of events to return in the history array.
1261
+ # @param num_events [Integer] The number of days to return in the leaderboard history for the user.
1262
1262
  # @param request_options [TrophyApiClient::RequestOptions]
1263
1263
  # @return [TrophyApiClient::UserLeaderboardResponseWithHistory]
1264
1264
  # @example
@@ -1,3 +1,3 @@
1
1
  module MyGem
2
- VERSION = "1.10.0"
2
+ VERSION = "1.12.0"
3
3
  end
data/lib/types_export.rb CHANGED
@@ -4,7 +4,6 @@ require_relative "trophy_api_client/users/types/users_metric_event_summary_reque
4
4
  require_relative "trophy_api_client/users/types/users_metric_event_summary_response_item"
5
5
  require_relative "trophy_api_client/users/types/users_points_event_summary_request_aggregation"
6
6
  require_relative "trophy_api_client/users/types/users_points_event_summary_response_item"
7
- require_relative "trophy_api_client/streaks/types/streaks_rankings_request_type"
8
7
  require_relative "trophy_api_client/leaderboards/types/leaderboards_all_response_item_status"
9
8
  require_relative "trophy_api_client/leaderboards/types/leaderboards_all_response_item"
10
9
  require_relative "trophy_api_client/admin/streaks/types/restore_streaks_request_users_item"
@@ -79,7 +78,6 @@ require_relative "trophy_api_client/types/event_response"
79
78
  require_relative "trophy_api_client/types/points_range"
80
79
  require_relative "trophy_api_client/types/points_summary_response"
81
80
  require_relative "trophy_api_client/types/points_system_response"
82
- require_relative "trophy_api_client/types/streak_ranking_user"
83
81
  require_relative "trophy_api_client/types/leaderboard_ranking"
84
82
  require_relative "trophy_api_client/types/leaderboard_event"
85
83
  require_relative "trophy_api_client/types/user_leaderboard_response"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trophy_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trophy Labs, Inc
@@ -120,7 +120,6 @@ files:
120
120
  - lib/trophy_api_client/metrics/client.rb
121
121
  - lib/trophy_api_client/points/client.rb
122
122
  - lib/trophy_api_client/streaks/client.rb
123
- - lib/trophy_api_client/streaks/types/streaks_rankings_request_type.rb
124
123
  - lib/trophy_api_client/types/achievement_completion_response.rb
125
124
  - lib/trophy_api_client/types/achievement_response.rb
126
125
  - lib/trophy_api_client/types/achievement_response_event_attribute.rb
@@ -272,7 +271,6 @@ files:
272
271
  - lib/trophy_api_client/types/points_trigger_user_attributes_item.rb
273
272
  - lib/trophy_api_client/types/restore_streaks_response.rb
274
273
  - lib/trophy_api_client/types/streak_frequency.rb
275
- - lib/trophy_api_client/types/streak_ranking_user.rb
276
274
  - lib/trophy_api_client/types/streak_response.rb
277
275
  - lib/trophy_api_client/types/streak_response_streak_history_item.rb
278
276
  - lib/trophy_api_client/types/update_attribute_request_item.rb
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module TrophyApiClient
4
- class Streaks
5
- class StreaksRankingsRequestType
6
- ACTIVE = "active"
7
- LONGEST = "longest"
8
- end
9
- end
10
- end
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "ostruct"
4
- require "json"
5
-
6
- module TrophyApiClient
7
- # A user with their streak length in the rankings.
8
- class StreakRankingUser
9
- # @return [String] The ID of the user.
10
- attr_reader :user_id
11
- # @return [String] The name of the user. May be null if no name is set.
12
- attr_reader :name
13
- # @return [Integer] The user's streak length (active or longest depending on query parameter).
14
- attr_reader :streak_length
15
- # @return [OpenStruct] Additional properties unmapped to the current class definition
16
- attr_reader :additional_properties
17
- # @return [Object]
18
- attr_reader :_field_set
19
- protected :_field_set
20
-
21
- OMIT = Object.new
22
-
23
- # @param user_id [String] The ID of the user.
24
- # @param name [String] The name of the user. May be null if no name is set.
25
- # @param streak_length [Integer] The user's streak length (active or longest depending on query parameter).
26
- # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
- # @return [TrophyApiClient::StreakRankingUser]
28
- def initialize(user_id:, streak_length:, name: OMIT, additional_properties: nil)
29
- @user_id = user_id
30
- @name = name if name != OMIT
31
- @streak_length = streak_length
32
- @additional_properties = additional_properties
33
- @_field_set = { "userId": user_id, "name": name, "streakLength": streak_length }.reject do |_k, v|
34
- v == OMIT
35
- end
36
- end
37
-
38
- # Deserialize a JSON object to an instance of StreakRankingUser
39
- #
40
- # @param json_object [String]
41
- # @return [TrophyApiClient::StreakRankingUser]
42
- def self.from_json(json_object:)
43
- struct = JSON.parse(json_object, object_class: OpenStruct)
44
- parsed_json = JSON.parse(json_object)
45
- user_id = parsed_json["userId"]
46
- name = parsed_json["name"]
47
- streak_length = parsed_json["streakLength"]
48
- new(
49
- user_id: user_id,
50
- name: name,
51
- streak_length: streak_length,
52
- additional_properties: struct
53
- )
54
- end
55
-
56
- # Serialize an instance of StreakRankingUser to a JSON object
57
- #
58
- # @return [String]
59
- def to_json(*_args)
60
- @_field_set&.to_json
61
- end
62
-
63
- # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
- # hash and check each fields type against the current object's property
65
- # definitions.
66
- #
67
- # @param obj [Object]
68
- # @return [Void]
69
- def self.validate_raw(obj:)
70
- obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
71
- obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
72
- obj.streak_length.is_a?(Integer) != false || raise("Passed value for field obj.streak_length is not the expected type, validation failed.")
73
- end
74
- end
75
- end