Skip to content

Commit 77b4175

Browse files
Automatically update Ruby SDK
1 parent abec420 commit 77b4175

10 files changed

Lines changed: 156 additions & 4 deletions

File tree

‎.fern/metadata.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cliVersion": "5.62.0",
33
"generatorName": "fernapi/fern-ruby-sdk",
44
"generatorVersion": "1.13.2",
5-
"originGitCommit": "a26ab659060cc5cbecdc6795eb97b136e2694cdd",
5+
"originGitCommit": "19712978734e8ed2f50ee8914cc8ff1f3a01c459",
66
"originGitCommitIsDirty": false,
77
"invokedBy": "ci",
88
"ciProvider": "github"

‎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.24.0"
5+
VERSION = "1.25.0"
66
AUTHORS = ["Trophy Labs, Inc"].freeze
77
EMAIL = ""
88
SUMMARY = "Ruby library for the Trophy API."

‎lib/trophy.rb‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@
301301
require_relative "trophy/types/update_points_systems_request"
302302
require_relative "trophy/types/update_points_systems_response"
303303
require_relative "trophy/types/delete_points_systems_response"
304+
require_relative "trophy/types/admin_environment"
305+
require_relative "trophy/types/list_environments_response"
304306
require_relative "trophy/types/admin_tenant_status"
305307
require_relative "trophy/types/admin_tenant"
306308
require_relative "trophy/types/list_tenants_response"
@@ -358,6 +360,7 @@
358360
require_relative "trophy/admin/settings/types/update_admin_settings_request"
359361
require_relative "trophy/admin/application_api_keys/client"
360362
require_relative "trophy/admin/application_api_keys/types/application_api_keys_delete_request"
363+
require_relative "trophy/admin/environments/client"
361364
require_relative "trophy/admin/tenants/client"
362365
require_relative "trophy/admin/tenants/types/tenants_list_request"
363366
require_relative "trophy/admin/tenants/types/tenants_delete_request"

‎lib/trophy/admin/client.rb‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ def application_api_keys
4949
@application_api_keys ||= Trophy::Admin::ApplicationApiKeys::Client.new(client: @client, base_url: @base_url, environment: @environment)
5050
end
5151

52+
# @return [Trophy::Environments::Client]
53+
def environments
54+
@environments ||= Trophy::Admin::Environments::Client.new(client: @client, base_url: @base_url, environment: @environment)
55+
end
56+
5257
# @return [Trophy::Tenants::Client]
5358
def tenants
5459
@tenants ||= Trophy::Admin::Tenants::Client.new(client: @client, base_url: @base_url, environment: @environment)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# frozen_string_literal: true
2+
3+
module Trophy
4+
module Admin
5+
module Environments
6+
class Client
7+
# @param client [Trophy::Internal::Http::RawClient]
8+
# @param base_url [String, nil]
9+
# @param environment [Hash[Symbol, String], nil]
10+
#
11+
# @return [void]
12+
def initialize(client:, base_url: nil, environment: nil)
13+
@client = client
14+
@base_url = base_url
15+
@environment = environment
16+
end
17+
18+
# List active environments.
19+
#
20+
# @param request_options [Hash]
21+
# @param _params [Hash]
22+
# @option request_options [String] :base_url
23+
# @option request_options [Hash{String => Object}] :additional_headers
24+
# @option request_options [Hash{String => Object}] :additional_query_parameters
25+
# @option request_options [Hash{String => Object}] :additional_body_parameters
26+
# @option request_options [Integer] :timeout_in_seconds
27+
#
28+
# @return [Array[Trophy::Types::AdminEnvironment]]
29+
def list(request_options: {}, **_params)
30+
request = Trophy::Internal::JSON::Request.new(
31+
base_url: request_options[:base_url] || @base_url || @environment&.dig(:admin),
32+
method: "GET",
33+
path: "environments",
34+
request_options: request_options
35+
)
36+
begin
37+
response = @client.send(request)
38+
rescue Net::HTTPRequestTimeout
39+
raise Trophy::Errors::TimeoutError
40+
end
41+
code = response.code.to_i
42+
if code.between?(200, 299)
43+
Trophy::Types::ListEnvironmentsResponse.load(response.body)
44+
else
45+
error_class = Trophy::Errors::ResponseError.subclass_for_code(code)
46+
raise error_class.new(response.body, code: code)
47+
end
48+
end
49+
end
50+
end
51+
end
52+
end

‎lib/trophy/client.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Client
99
# @param max_retries [Integer]
1010
#
1111
# @return [void]
12-
def initialize(api_key:, base_url: nil, environment: Trophy::Environment::PRODUCTION, sdk_version: "1.24.0", max_retries: 2)
12+
def initialize(api_key:, base_url: nil, environment: Trophy::Environment::PRODUCTION, sdk_version: "1.25.0", max_retries: 2)
1313
@base_url = base_url
1414
@environment = environment
1515

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# frozen_string_literal: true
2+
3+
module Trophy
4+
module Types
5+
# An active environment in the organisation.
6+
class AdminEnvironment < Internal::Types::Model
7+
field :name, -> { String }, optional: false, nullable: false
8+
9+
field :key, -> { String }, optional: false, nullable: false
10+
11+
field :priority, -> { Integer }, optional: false, nullable: false
12+
end
13+
end
14+
end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
3+
module Trophy
4+
module Types
5+
module ListEnvironmentsResponse
6+
# ListEnvironmentsResponse is an alias for Array
7+
8+
# @option str [String]
9+
#
10+
# @return [untyped]
11+
def self.load(str)
12+
::JSON.parse(str)
13+
end
14+
15+
# @option value [untyped]
16+
#
17+
# @return [String]
18+
def self.dump(value)
19+
::JSON.generate(value)
20+
end
21+
end
22+
end
23+
end

‎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.24.0"
2+
VERSION = "1.25.0"
33
end

‎reference.md‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,6 +3811,61 @@ client.admin.application_api_keys.delete(ids: ["550e8400-e29b-41d4-a716-44665544
38113811
</dl>
38123812

38133813

3814+
</dd>
3815+
</dl>
3816+
</details>
3817+
3818+
## Admin Environments
3819+
<details><summary><code>client.admin.environments.<a href="/lib/trophy/admin/environments/client.rb">list</a>() -> Internal::Types::Array[Trophy::Types::AdminEnvironment]</code></summary>
3820+
<dl>
3821+
<dd>
3822+
3823+
#### 📝 Description
3824+
3825+
<dl>
3826+
<dd>
3827+
3828+
<dl>
3829+
<dd>
3830+
3831+
List active environments.
3832+
</dd>
3833+
</dl>
3834+
</dd>
3835+
</dl>
3836+
3837+
#### 🔌 Usage
3838+
3839+
<dl>
3840+
<dd>
3841+
3842+
<dl>
3843+
<dd>
3844+
3845+
```ruby
3846+
client.admin.environments.list
3847+
```
3848+
</dd>
3849+
</dl>
3850+
</dd>
3851+
</dl>
3852+
3853+
#### ⚙️ Parameters
3854+
3855+
<dl>
3856+
<dd>
3857+
3858+
<dl>
3859+
<dd>
3860+
3861+
**request_options:** `Trophy::Admin::Environments::RequestOptions`
3862+
3863+
</dd>
3864+
</dl>
3865+
</dd>
3866+
</dl>
3867+
3868+
38143869
</dd>
38153870
</dl>
38163871
</details>

0 commit comments

Comments
 (0)