Skip to content

Commit 8355d5e

Browse files
feat(api): manual updates
1 parent 87416c4 commit 8355d5e

12 files changed

Lines changed: 67 additions & 67 deletions

File tree

.github/workflows/publish-gem.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
bash ./bin/publish-gem
2828
env:
2929
# `RUBYGEMS_HOST` is only required for private gem repositories, not https://rubygems.org
30-
RUBYGEMS_HOST: ${{ secrets.BROWSERBASE_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
31-
GEM_HOST_API_KEY: ${{ secrets.BROWSERBASE_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}
30+
RUBYGEMS_HOST: ${{ secrets.STAGEHAND_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
31+
GEM_HOST_API_KEY: ${{ secrets.STAGEHAND_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}

.github/workflows/release-doctor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21-
RUBYGEMS_HOST: ${{ secrets.BROWSERBASE_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
22-
GEM_HOST_API_KEY: ${{ secrets.BROWSERBASE_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}
21+
RUBYGEMS_HOST: ${{ secrets.STAGEHAND_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
22+
GEM_HOST_API_KEY: ${{ secrets.STAGEHAND_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-0c12f985340be2a9287e8e01ff8733f7f2d02e019149d1ae95f1a8f8798c6690.yml
33
openapi_spec_hash: efb79934e1dc63763dd4e8493b825273
4-
config_hash: 905fc70fd4344c8631aab6754bffd883
4+
config_hash: 1de7cb9bd4dc46fe3e20b637bc534908

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2025 Browserbase
189+
Copyright 2025 Stagehand
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Browserbase Ruby API library
1+
# Stagehand Ruby API library
22

3-
The Browserbase Ruby library provides convenient access to the Browserbase REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/browserbase/stagehand-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
3+
The Stagehand Ruby library provides convenient access to the Stagehand REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/browserbase/stagehand-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
44

55
It is generated with [Stainless](https://www.stainless.com/).
66

77
## Documentation
88

99
Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/stagehand).
1010

11-
The REST API documentation can be found on [browserbase.com](https://browserbase.com).
11+
The REST API documentation can be found on [docs.stagehand.dev](https://docs.stagehand.dev).
1212

1313
## Installation
1414

@@ -28,12 +28,12 @@ gem "stagehand", "~> 0.0.1"
2828
require "bundler/setup"
2929
require "stagehand"
3030

31-
browserbase = Stagehand::Client.new(
31+
stagehand = Stagehand::Client.new(
3232
api_key: ENV["STAGEHAND_API_KEY"], # This is the default and can be omitted
3333
environment: "dev" # or "production" | "local"; defaults to "production"
3434
)
3535

36-
response = browserbase.sessions.start(env: "LOCAL")
36+
response = stagehand.sessions.start(env: "LOCAL")
3737

3838
puts(response.available)
3939
```
@@ -44,7 +44,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
4444

4545
```ruby
4646
begin
47-
session = browserbase.sessions.start(env: "LOCAL")
47+
session = stagehand.sessions.start(env: "LOCAL")
4848
rescue Stagehand::Errors::APIConnectionError => e
4949
puts("The server could not be reached")
5050
puts(e.cause) # an underlying Exception, likely raised within `net/http`
@@ -82,12 +82,12 @@ You can use the `max_retries` option to configure or disable this:
8282

8383
```ruby
8484
# Configure the default for all requests:
85-
browserbase = Stagehand::Client.new(
85+
stagehand = Stagehand::Client.new(
8686
max_retries: 0 # default is 2
8787
)
8888

8989
# Or, configure per-request:
90-
browserbase.sessions.start(env: "LOCAL", request_options: {max_retries: 5})
90+
stagehand.sessions.start(env: "LOCAL", request_options: {max_retries: 5})
9191
```
9292

9393
### Timeouts
@@ -96,12 +96,12 @@ By default, requests will time out after 60 seconds. You can use the timeout opt
9696

9797
```ruby
9898
# Configure the default for all requests:
99-
browserbase = Stagehand::Client.new(
99+
stagehand = Stagehand::Client.new(
100100
timeout: nil # default is 60
101101
)
102102

103103
# Or, configure per-request:
104-
browserbase.sessions.start(env: "LOCAL", request_options: {timeout: 5})
104+
stagehand.sessions.start(env: "LOCAL", request_options: {timeout: 5})
105105
```
106106

107107
On timeout, `Stagehand::Errors::APITimeoutError` is raised.
@@ -132,7 +132,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
132132

133133
```ruby
134134
response =
135-
browserbase.sessions.start(
135+
stagehand.sessions.start(
136136
env: "LOCAL",
137137
request_options: {
138138
extra_query: {my_query_parameter: value},
@@ -179,18 +179,18 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
179179
You can provide typesafe request parameters like so:
180180

181181
```ruby
182-
browserbase.sessions.start(env: "LOCAL")
182+
stagehand.sessions.start(env: "LOCAL")
183183
```
184184

185185
Or, equivalently:
186186

187187
```ruby
188188
# Hashes work, but are not typesafe:
189-
browserbase.sessions.start(env: "LOCAL")
189+
stagehand.sessions.start(env: "LOCAL")
190190

191191
# You can also splat a full Params class:
192192
params = Stagehand::SessionStartParams.new(env: "LOCAL")
193-
browserbase.sessions.start(**params)
193+
stagehand.sessions.start(**params)
194194
```
195195

196196
### Enums
@@ -209,13 +209,13 @@ Enum parameters have a "relaxed" type, so you can either pass in enum constants
209209

210210
```ruby
211211
# Using the enum constants preserves the tagged type information:
212-
browserbase.sessions.act(
212+
stagehand.sessions.act(
213213
x_stream_response: Stagehand::SessionActParams::XStreamResponse::TRUE,
214214
#
215215
)
216216

217217
# Literal values are also permissible:
218-
browserbase.sessions.act(
218+
stagehand.sessions.act(
219219
x_stream_response: :true,
220220
#
221221
)

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by Browserbase, please follow the respective company's security reporting guidelines.
19+
or products provided by Stagehand, please follow the respective company's security reporting guidelines.
2020

2121
---
2222

lib/stagehand/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Client < Stagehand::Internal::Transport::BaseClient
5353
# - `local` corresponds to `http://localhost:5000/v1`
5454
#
5555
# @param base_url [String, nil] Override the default base URL for the API, e.g.,
56-
# `"https://api.example.com/v2/"`. Defaults to `ENV["BROWSERBASE_BASE_URL"]`
56+
# `"https://api.example.com/v2/"`. Defaults to `ENV["STAGEHAND_BASE_URL"]`
5757
#
5858
# @param max_retries [Integer] Max number of retries to attempt after a failed retryable request.
5959
#
@@ -65,7 +65,7 @@ class Client < Stagehand::Internal::Transport::BaseClient
6565
def initialize(
6666
api_key: ENV["STAGEHAND_API_KEY"],
6767
environment: nil,
68-
base_url: ENV["BROWSERBASE_BASE_URL"],
68+
base_url: ENV["STAGEHAND_BASE_URL"],
6969
max_retries: self.class::DEFAULT_MAX_RETRIES,
7070
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
7171
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,

rbi/stagehand/client.rbi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ module Stagehand
5555
# - `local` corresponds to `http://localhost:5000/v1`
5656
environment: nil,
5757
# Override the default base URL for the API, e.g.,
58-
# `"https://api.example.com/v2/"`. Defaults to `ENV["BROWSERBASE_BASE_URL"]`
59-
base_url: ENV["BROWSERBASE_BASE_URL"],
58+
# `"https://api.example.com/v2/"`. Defaults to `ENV["STAGEHAND_BASE_URL"]`
59+
base_url: ENV["STAGEHAND_BASE_URL"],
6060
# Max number of retries to attempt after a failed retryable request.
6161
max_retries: Stagehand::Client::DEFAULT_MAX_RETRIES,
6262
timeout: Stagehand::Client::DEFAULT_TIMEOUT_IN_SECONDS,

stagehand.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ require_relative "lib/stagehand/version"
55
Gem::Specification.new do |s|
66
s.name = "stagehand"
77
s.version = Stagehand::VERSION
8-
s.summary = "Ruby library to access the Browserbase API"
9-
s.authors = ["Browserbase"]
8+
s.summary = "Ruby library to access the Stagehand API"
9+
s.authors = ["Stagehand"]
1010
s.email = ""
1111
s.homepage = "https://gemdocs.org/gems/stagehand"
1212
s.metadata["homepage_uri"] = s.homepage

test/stagehand/client_test.rb

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ def test_raises_on_missing_non_nullable_opts
4444
def test_client_default_request_default_retry_attempts
4545
stub_request(:post, "http://localhost/sessions/start").to_return_json(status: 500, body: {})
4646

47-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
47+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
4848

4949
assert_raises(Stagehand::Errors::InternalServerError) do
50-
browserbase.sessions.start(env: :LOCAL)
50+
stagehand.sessions.start(env: :LOCAL)
5151
end
5252

5353
assert_requested(:any, /./, times: 3)
@@ -56,10 +56,10 @@ def test_client_default_request_default_retry_attempts
5656
def test_client_given_request_default_retry_attempts
5757
stub_request(:post, "http://localhost/sessions/start").to_return_json(status: 500, body: {})
5858

59-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 3)
59+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 3)
6060

6161
assert_raises(Stagehand::Errors::InternalServerError) do
62-
browserbase.sessions.start(env: :LOCAL)
62+
stagehand.sessions.start(env: :LOCAL)
6363
end
6464

6565
assert_requested(:any, /./, times: 4)
@@ -68,10 +68,10 @@ def test_client_given_request_default_retry_attempts
6868
def test_client_default_request_given_retry_attempts
6969
stub_request(:post, "http://localhost/sessions/start").to_return_json(status: 500, body: {})
7070

71-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
71+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
7272

7373
assert_raises(Stagehand::Errors::InternalServerError) do
74-
browserbase.sessions.start(env: :LOCAL, request_options: {max_retries: 3})
74+
stagehand.sessions.start(env: :LOCAL, request_options: {max_retries: 3})
7575
end
7676

7777
assert_requested(:any, /./, times: 4)
@@ -80,10 +80,10 @@ def test_client_default_request_given_retry_attempts
8080
def test_client_given_request_given_retry_attempts
8181
stub_request(:post, "http://localhost/sessions/start").to_return_json(status: 500, body: {})
8282

83-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 3)
83+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 3)
8484

8585
assert_raises(Stagehand::Errors::InternalServerError) do
86-
browserbase.sessions.start(env: :LOCAL, request_options: {max_retries: 4})
86+
stagehand.sessions.start(env: :LOCAL, request_options: {max_retries: 4})
8787
end
8888

8989
assert_requested(:any, /./, times: 5)
@@ -96,10 +96,10 @@ def test_client_retry_after_seconds
9696
body: {}
9797
)
9898

99-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 1)
99+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 1)
100100

101101
assert_raises(Stagehand::Errors::InternalServerError) do
102-
browserbase.sessions.start(env: :LOCAL)
102+
stagehand.sessions.start(env: :LOCAL)
103103
end
104104

105105
assert_requested(:any, /./, times: 2)
@@ -113,11 +113,11 @@ def test_client_retry_after_date
113113
body: {}
114114
)
115115

116-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 1)
116+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 1)
117117

118118
assert_raises(Stagehand::Errors::InternalServerError) do
119119
Thread.current.thread_variable_set(:time_now, Time.now)
120-
browserbase.sessions.start(env: :LOCAL)
120+
stagehand.sessions.start(env: :LOCAL)
121121
Thread.current.thread_variable_set(:time_now, nil)
122122
end
123123

@@ -132,10 +132,10 @@ def test_client_retry_after_ms
132132
body: {}
133133
)
134134

135-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 1)
135+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key", max_retries: 1)
136136

137137
assert_raises(Stagehand::Errors::InternalServerError) do
138-
browserbase.sessions.start(env: :LOCAL)
138+
stagehand.sessions.start(env: :LOCAL)
139139
end
140140

141141
assert_requested(:any, /./, times: 2)
@@ -145,10 +145,10 @@ def test_client_retry_after_ms
145145
def test_retry_count_header
146146
stub_request(:post, "http://localhost/sessions/start").to_return_json(status: 500, body: {})
147147

148-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
148+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
149149

150150
assert_raises(Stagehand::Errors::InternalServerError) do
151-
browserbase.sessions.start(env: :LOCAL)
151+
stagehand.sessions.start(env: :LOCAL)
152152
end
153153

154154
3.times do
@@ -159,10 +159,10 @@ def test_retry_count_header
159159
def test_omit_retry_count_header
160160
stub_request(:post, "http://localhost/sessions/start").to_return_json(status: 500, body: {})
161161

162-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
162+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
163163

164164
assert_raises(Stagehand::Errors::InternalServerError) do
165-
browserbase.sessions.start(
165+
stagehand.sessions.start(
166166
env: :LOCAL,
167167
request_options: {extra_headers: {"x-stainless-retry-count" => nil}}
168168
)
@@ -176,10 +176,10 @@ def test_omit_retry_count_header
176176
def test_overwrite_retry_count_header
177177
stub_request(:post, "http://localhost/sessions/start").to_return_json(status: 500, body: {})
178178

179-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
179+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
180180

181181
assert_raises(Stagehand::Errors::InternalServerError) do
182-
browserbase.sessions.start(
182+
stagehand.sessions.start(
183183
env: :LOCAL,
184184
request_options: {extra_headers: {"x-stainless-retry-count" => "42"}}
185185
)
@@ -199,10 +199,10 @@ def test_client_redirect_307
199199
headers: {"location" => "/redirected"}
200200
)
201201

202-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
202+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
203203

204204
assert_raises(Stagehand::Errors::APIConnectionError) do
205-
browserbase.sessions.start(env: :LOCAL, request_options: {extra_headers: {}})
205+
stagehand.sessions.start(env: :LOCAL, request_options: {extra_headers: {}})
206206
end
207207

208208
recorded, = WebMock::RequestRegistry.instance.requested_signatures.hash.first
@@ -228,10 +228,10 @@ def test_client_redirect_303
228228
headers: {"location" => "/redirected"}
229229
)
230230

231-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
231+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
232232

233233
assert_raises(Stagehand::Errors::APIConnectionError) do
234-
browserbase.sessions.start(env: :LOCAL, request_options: {extra_headers: {}})
234+
stagehand.sessions.start(env: :LOCAL, request_options: {extra_headers: {}})
235235
end
236236

237237
assert_requested(:get, "http://localhost/redirected", times: Stagehand::Client::MAX_REDIRECTS) do
@@ -252,10 +252,10 @@ def test_client_redirect_auth_keep_same_origin
252252
headers: {"location" => "/redirected"}
253253
)
254254

255-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
255+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
256256

257257
assert_raises(Stagehand::Errors::APIConnectionError) do
258-
browserbase.sessions.start(
258+
stagehand.sessions.start(
259259
env: :LOCAL,
260260
request_options: {extra_headers: {"authorization" => "Bearer xyz"}}
261261
)
@@ -282,10 +282,10 @@ def test_client_redirect_auth_strip_cross_origin
282282
headers: {"location" => "https://example.com/redirected"}
283283
)
284284

285-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
285+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
286286

287287
assert_raises(Stagehand::Errors::APIConnectionError) do
288-
browserbase.sessions.start(
288+
stagehand.sessions.start(
289289
env: :LOCAL,
290290
request_options: {extra_headers: {"authorization" => "Bearer xyz"}}
291291
)
@@ -300,9 +300,9 @@ def test_client_redirect_auth_strip_cross_origin
300300
def test_default_headers
301301
stub_request(:post, "http://localhost/sessions/start").to_return_json(status: 200, body: {})
302302

303-
browserbase = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
303+
stagehand = Stagehand::Client.new(base_url: "http://localhost", api_key: "My API Key")
304304

305-
browserbase.sessions.start(env: :LOCAL)
305+
stagehand.sessions.start(env: :LOCAL)
306306

307307
assert_requested(:any, /./) do |req|
308308
headers = req.headers.transform_keys(&:downcase).fetch_values("accept", "content-type")

0 commit comments

Comments
 (0)