55require "json"
66
77module 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.
910 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.
1114 attr_reader :timestamp
1215 # @return [Integer] The user's rank before this event, or null if they were not on the leaderboard.
1316 attr_reader :previous_rank
@@ -27,7 +30,8 @@ class LeaderboardEvent
2730
2831 OMIT = Object . new
2932
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.
3135 # @param previous_rank [Integer] The user's rank before this event, or null if they were not on the leaderboard.
3236 # @param rank [Integer] The user's rank after this event, or null if they are no longer on the
3337 # leaderboard.
@@ -36,15 +40,17 @@ class LeaderboardEvent
3640 # leaderboard.
3741 # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
3842 # @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 ,
4044 additional_properties : nil )
41- @timestamp = timestamp if timestamp != OMIT
45+ @date = date
46+ @timestamp = timestamp
4247 @previous_rank = previous_rank if previous_rank != OMIT
4348 @rank = rank if rank != OMIT
4449 @previous_value = previous_value if previous_value != OMIT
4550 @value = value if value != OMIT
4651 @additional_properties = additional_properties
4752 @_field_set = {
53+ "date" : date ,
4854 "timestamp" : timestamp ,
4955 "previousRank" : previous_rank ,
5056 "rank" : rank ,
@@ -62,12 +68,14 @@ def initialize(timestamp: OMIT, previous_rank: OMIT, rank: OMIT, previous_value:
6268 def self . from_json ( json_object :)
6369 struct = JSON . parse ( json_object , object_class : OpenStruct )
6470 parsed_json = JSON . parse ( json_object )
71+ date = parsed_json [ "date" ]
6572 timestamp = ( DateTime . parse ( parsed_json [ "timestamp" ] ) unless parsed_json [ "timestamp" ] . nil? )
6673 previous_rank = parsed_json [ "previousRank" ]
6774 rank = parsed_json [ "rank" ]
6875 previous_value = parsed_json [ "previousValue" ]
6976 value = parsed_json [ "value" ]
7077 new (
78+ date : date ,
7179 timestamp : timestamp ,
7280 previous_rank : previous_rank ,
7381 rank : rank ,
@@ -91,7 +99,8 @@ def to_json(*_args)
9199 # @param obj [Object]
92100 # @return [Void]
93101 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." )
95104 obj . previous_rank &.is_a? ( Integer ) != false || raise ( "Passed value for field obj.previous_rank is not the expected type, validation failed." )
96105 obj . rank &.is_a? ( Integer ) != false || raise ( "Passed value for field obj.rank is not the expected type, validation failed." )
97106 obj . previous_value &.is_a? ( Integer ) != false || raise ( "Passed value for field obj.previous_value is not the expected type, validation failed." )
0 commit comments