trophy_api_client 1.0.25 → 1.0.27
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: 0e3484d45e81c35f161702f00ad9dcce297343027a21629217ef081124a9dbcb
|
4
|
+
data.tar.gz: df935734b5f6622d7423a8cdef76e89527e6619b1a137d33e00f0ca951ddfba9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb346f1ca9fbc7c6eb7e18d5f85157d4bb8c50a999f846dbcd8f78256ddb66847cd8ea0fb32ba048ceafe1ef03e4dd2c34eb207a504d71bf657af760e0f8be87
|
7
|
+
data.tar.gz: 3d5393f945486bbb12fa88e6ea2e1e9eddb2009dab7e2350f9086042f6e1a6be1d75015457a4621e0e14a73851f0d2db4c2bd14adfb63729fa5566fb1ac1d30c
|
data/lib/gemconfig.rb
CHANGED
@@ -8,7 +8,7 @@ module TrophyApiClient
|
|
8
8
|
# A leaderboard event representing a change in a user's rank or value.
|
9
9
|
class LeaderboardEvent
|
10
10
|
# @return [DateTime] The timestamp when the event occurred.
|
11
|
-
attr_reader :
|
11
|
+
attr_reader :timestamp
|
12
12
|
# @return [Integer] The user's rank before this event, or null if they were not on the leaderboard.
|
13
13
|
attr_reader :previous_rank
|
14
14
|
# @return [Integer] The user's rank after this event, or null if they are no longer on the
|
@@ -27,7 +27,7 @@ module TrophyApiClient
|
|
27
27
|
|
28
28
|
OMIT = Object.new
|
29
29
|
|
30
|
-
# @param
|
30
|
+
# @param timestamp [DateTime] The timestamp when the event occurred.
|
31
31
|
# @param previous_rank [Integer] The user's rank before this event, or null if they were not on the leaderboard.
|
32
32
|
# @param rank [Integer] The user's rank after this event, or null if they are no longer on the
|
33
33
|
# leaderboard.
|
@@ -36,16 +36,16 @@ module TrophyApiClient
|
|
36
36
|
# leaderboard.
|
37
37
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
38
38
|
# @return [TrophyApiClient::LeaderboardEvent]
|
39
|
-
def initialize(
|
39
|
+
def initialize(timestamp: OMIT, previous_rank: OMIT, rank: OMIT, previous_value: OMIT, value: OMIT,
|
40
40
|
additional_properties: nil)
|
41
|
-
@
|
41
|
+
@timestamp = timestamp if timestamp != OMIT
|
42
42
|
@previous_rank = previous_rank if previous_rank != OMIT
|
43
43
|
@rank = rank if rank != OMIT
|
44
44
|
@previous_value = previous_value if previous_value != OMIT
|
45
45
|
@value = value if value != OMIT
|
46
46
|
@additional_properties = additional_properties
|
47
47
|
@_field_set = {
|
48
|
-
"
|
48
|
+
"timestamp": timestamp,
|
49
49
|
"previousRank": previous_rank,
|
50
50
|
"rank": rank,
|
51
51
|
"previousValue": previous_value,
|
@@ -62,13 +62,13 @@ module TrophyApiClient
|
|
62
62
|
def self.from_json(json_object:)
|
63
63
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
64
64
|
parsed_json = JSON.parse(json_object)
|
65
|
-
|
65
|
+
timestamp = (DateTime.parse(parsed_json["timestamp"]) unless parsed_json["timestamp"].nil?)
|
66
66
|
previous_rank = parsed_json["previousRank"]
|
67
67
|
rank = parsed_json["rank"]
|
68
68
|
previous_value = parsed_json["previousValue"]
|
69
69
|
value = parsed_json["value"]
|
70
70
|
new(
|
71
|
-
|
71
|
+
timestamp: timestamp,
|
72
72
|
previous_rank: previous_rank,
|
73
73
|
rank: rank,
|
74
74
|
previous_value: previous_value,
|
@@ -91,7 +91,7 @@ module TrophyApiClient
|
|
91
91
|
# @param obj [Object]
|
92
92
|
# @return [Void]
|
93
93
|
def self.validate_raw(obj:)
|
94
|
-
obj.
|
94
|
+
obj.timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
|
95
95
|
obj.previous_rank&.is_a?(Integer) != false || raise("Passed value for field obj.previous_rank is not the expected type, validation failed.")
|
96
96
|
obj.rank&.is_a?(Integer) != false || raise("Passed value for field obj.rank is not the expected type, validation failed.")
|
97
97
|
obj.previous_value&.is_a?(Integer) != false || raise("Passed value for field obj.previous_value is not the expected type, validation failed.")
|
@@ -463,12 +463,12 @@ module TrophyApiClient
|
|
463
463
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
464
464
|
# api_key: "YOUR_API_KEY"
|
465
465
|
# )
|
466
|
-
# api.users.
|
466
|
+
# api.users.leaderboard(
|
467
467
|
# id: "user-123",
|
468
468
|
# key: "weekly-words",
|
469
469
|
# run: "2025-01-15"
|
470
470
|
# )
|
471
|
-
def
|
471
|
+
def leaderboard(id:, key:, run: nil, request_options: nil)
|
472
472
|
response = @request_client.conn.get do |req|
|
473
473
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
474
474
|
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
@@ -955,12 +955,12 @@ module TrophyApiClient
|
|
955
955
|
# environment: TrophyApiClient::Environment::DEFAULT,
|
956
956
|
# api_key: "YOUR_API_KEY"
|
957
957
|
# )
|
958
|
-
# api.users.
|
958
|
+
# api.users.leaderboard(
|
959
959
|
# id: "user-123",
|
960
960
|
# key: "weekly-words",
|
961
961
|
# run: "2025-01-15"
|
962
962
|
# )
|
963
|
-
def
|
963
|
+
def leaderboard(id:, key:, run: nil, request_options: nil)
|
964
964
|
Async do
|
965
965
|
response = @request_client.conn.get do |req|
|
966
966
|
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|