Skip to content

Commit 69d9248

Browse files
Automatically update Ruby SDK
1 parent 9ca1a61 commit 69d9248

7 files changed

Lines changed: 16 additions & 178 deletions

File tree

lib/gemconfig.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module TrophyApiClient
44
module Gemconfig
5-
VERSION = "1.11.0"
5+
VERSION = "1.12.0"
66
AUTHORS = ["Trophy Labs, Inc"].freeze
77
EMAIL = ""
88
SUMMARY = "Ruby library for the Trophy API."

lib/trophy_api_client/streaks/client.rb

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
require_relative "../../requests"
44
require_relative "../types/bulk_streak_response"
55
require "json"
6-
require_relative "types/streaks_rankings_request_type"
7-
require_relative "../types/streak_ranking_user"
86
require "async"
97

108
module TrophyApiClient
@@ -53,42 +51,6 @@ def list(user_ids: nil, request_options: nil)
5351
TrophyApiClient::BulkStreakResponseItem.from_json(json_object: item)
5452
end
5553
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
9254
end
9355

9456
class AsyncStreaksClient
@@ -138,43 +100,5 @@ def list(user_ids: nil, request_options: nil)
138100
end
139101
end
140102
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
179103
end
180104
end

lib/trophy_api_client/streaks/types/streaks_rankings_request_type.rb

Lines changed: 0 additions & 10 deletions
This file was deleted.

lib/trophy_api_client/types/streak_ranking_user.rb

Lines changed: 0 additions & 75 deletions
This file was deleted.

lib/trophy_api_client/types/streak_response.rb

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22

3+
require "date"
34
require_relative "streak_response_streak_history_item"
45
require_relative "streak_frequency"
56
require "ostruct"
@@ -8,12 +9,12 @@
89
module TrophyApiClient
910
# An object representing the user's streak.
1011
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
1115
# @return [Array<TrophyApiClient::StreakResponseStreakHistoryItem>] A list of the user's past streak periods up through the current period. Each
1216
# period includes the start and end dates and the length of the streak.
1317
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
1718
# @return [Integer] The length of the user's current streak.
1819
attr_reader :length
1920
# @return [TrophyApiClient::StreakFrequency] The frequency of the streak.
@@ -46,10 +47,10 @@ class StreakResponse
4647

4748
OMIT = Object.new
4849

50+
# @param extended [DateTime] The timestamp the streak was most recently extended. Null if the streak is not
51+
# active.
4952
# @param streak_history [Array<TrophyApiClient::StreakResponseStreakHistoryItem>] A list of the user's past streak periods up through the current period. Each
5053
# 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.
5354
# @param length [Integer] The length of the user's current streak.
5455
# @param frequency [TrophyApiClient::StreakFrequency] The frequency of the streak.
5556
# @param started [String] The date the streak started.
@@ -66,10 +67,10 @@ class StreakResponse
6667
# the organization has enabled streak freeze auto-earn.
6768
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
6869
# @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,
7071
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
7374
@length = length
7475
@frequency = frequency
7576
@started = started if started != OMIT
@@ -82,8 +83,8 @@ def initialize(length:, frequency:, streak_history: OMIT, rank: OMIT, started: O
8283
@freeze_auto_earn_amount = freeze_auto_earn_amount if freeze_auto_earn_amount != OMIT
8384
@additional_properties = additional_properties
8485
@_field_set = {
86+
"extended": extended,
8587
"streakHistory": streak_history,
86-
"rank": rank,
8788
"length": length,
8889
"frequency": frequency,
8990
"started": started,
@@ -106,11 +107,11 @@ def initialize(length:, frequency:, streak_history: OMIT, rank: OMIT, started: O
106107
def self.from_json(json_object:)
107108
struct = JSON.parse(json_object, object_class: OpenStruct)
108109
parsed_json = JSON.parse(json_object)
110+
extended = (DateTime.parse(parsed_json["extended"]) unless parsed_json["extended"].nil?)
109111
streak_history = parsed_json["streakHistory"]&.map do |item|
110112
item = item.to_json
111113
TrophyApiClient::StreakResponseStreakHistoryItem.from_json(json_object: item)
112114
end
113-
rank = parsed_json["rank"]
114115
length = parsed_json["length"]
115116
frequency = parsed_json["frequency"]
116117
started = parsed_json["started"]
@@ -122,8 +123,8 @@ def self.from_json(json_object:)
122123
freeze_auto_earn_interval = parsed_json["freezeAutoEarnInterval"]
123124
freeze_auto_earn_amount = parsed_json["freezeAutoEarnAmount"]
124125
new(
126+
extended: extended,
125127
streak_history: streak_history,
126-
rank: rank,
127128
length: length,
128129
frequency: frequency,
129130
started: started,
@@ -152,8 +153,8 @@ def to_json(*_args)
152153
# @param obj [Object]
153154
# @return [Void]
154155
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.")
157158
obj.length.is_a?(Integer) != false || raise("Passed value for field obj.length is not the expected type, validation failed.")
158159
obj.frequency.is_a?(TrophyApiClient::StreakFrequency) != false || raise("Passed value for field obj.frequency is not the expected type, validation failed.")
159160
obj.started&.is_a?(String) != false || raise("Passed value for field obj.started is not the expected type, validation failed.")

lib/trophy_api_client/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module MyGem
2-
VERSION = "1.11.0"
2+
VERSION = "1.12.0"
33
end

lib/types_export.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
require_relative "trophy_api_client/users/types/users_metric_event_summary_response_item"
55
require_relative "trophy_api_client/users/types/users_points_event_summary_request_aggregation"
66
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"
87
require_relative "trophy_api_client/leaderboards/types/leaderboards_all_response_item_status"
98
require_relative "trophy_api_client/leaderboards/types/leaderboards_all_response_item"
109
require_relative "trophy_api_client/admin/streaks/types/restore_streaks_request_users_item"
@@ -79,7 +78,6 @@
7978
require_relative "trophy_api_client/types/points_range"
8079
require_relative "trophy_api_client/types/points_summary_response"
8180
require_relative "trophy_api_client/types/points_system_response"
82-
require_relative "trophy_api_client/types/streak_ranking_user"
8381
require_relative "trophy_api_client/types/leaderboard_ranking"
8482
require_relative "trophy_api_client/types/leaderboard_event"
8583
require_relative "trophy_api_client/types/user_leaderboard_response"

0 commit comments

Comments
 (0)