trophy_api_client 1.10.0 → 1.11.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85edf38a9fc0522a22a62f4e7ad27600c2e1b7376c0fc951d67f2ce590a8fe93
|
|
4
|
+
data.tar.gz: a5306d1ea30e6ead932faa97c59ca02dca59106e4364c5e715ff45c319913b36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9aaf222f94a5076cd95a0c58285b989557211d858804472ac0742cb17afccf1ebd94c77b637d9cfd3381915c9f9df758a05787ae17a0de57403bdd8747c0c9e
|
|
7
|
+
data.tar.gz: 0bc86ae13782e710a68162a51a7be4e56f7f83bdae39083343d9b9e6b60dad9e3ff7ef1a017ff1ec72a39cd5e104ede0358979d78dd48077dc0c5e7f03883ea2
|
data/lib/gemconfig.rb
CHANGED
|
@@ -5,9 +5,12 @@ require "ostruct"
|
|
|
5
5
|
require "json"
|
|
6
6
|
|
|
7
7
|
module TrophyApiClient
|
|
8
|
-
# A leaderboard
|
|
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 [
|
|
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
|
|
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
|
|
43
|
+
def initialize(date:, timestamp:, previous_rank: OMIT, rank: OMIT, previous_value: OMIT, value: OMIT,
|
|
40
44
|
additional_properties: nil)
|
|
41
|
-
@
|
|
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.
|
|
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.")
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|