Skip to content

Commit 59fb348

Browse files
chore: order client variables by "importance" (#200)
1 parent 70d35b6 commit 59fb348

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/orb/client.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ class Client < Orb::Transport::BaseClient
7171

7272
# Creates and returns a new client for interacting with the API.
7373
#
74-
# @param base_url [String, nil] Override the default base URL for the API, e.g., `"https://api.example.com/v2/"`
75-
#
7674
# @param api_key [String, nil] Defaults to `ENV["ORB_API_KEY"]`
7775
#
76+
# @param base_url [String, nil] Override the default base URL for the API, e.g., `"https://api.example.com/v2/"`
77+
#
7878
# @param max_retries [Integer] Max number of retries to attempt after a failed retryable request.
7979
#
8080
# @param timeout [Float]
@@ -85,8 +85,8 @@ class Client < Orb::Transport::BaseClient
8585
#
8686
# @param idempotency_header [String]
8787
def initialize(
88-
base_url: nil,
8988
api_key: ENV["ORB_API_KEY"],
89+
base_url: nil,
9090
max_retries: DEFAULT_MAX_RETRIES,
9191
timeout: DEFAULT_TIMEOUT_IN_SECONDS,
9292
initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,
@@ -96,7 +96,7 @@ def initialize(
9696
base_url ||= "https://api.withorb.com/v1"
9797

9898
if api_key.nil?
99-
raise ArgumentError.new("api_key is required")
99+
raise ArgumentError.new("api_key is required, and can be set via environ: \"ORB_API_KEY\"")
100100
end
101101

102102
@api_key = api_key.to_s

rbi/lib/orb/client.rbi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ module Orb
6363
# Creates and returns a new client for interacting with the API.
6464
sig do
6565
params(
66-
base_url: T.nilable(String),
6766
api_key: T.nilable(String),
67+
base_url: T.nilable(String),
6868
max_retries: Integer,
6969
timeout: Float,
7070
initial_retry_delay: Float,
@@ -74,10 +74,10 @@ module Orb
7474
.returns(T.attached_class)
7575
end
7676
def self.new(
77-
# Override the default base URL for the API, e.g., `"https://api.example.com/v2/"`
78-
base_url: nil,
7977
# Defaults to `ENV["ORB_API_KEY"]`
8078
api_key: ENV["ORB_API_KEY"],
79+
# Override the default base URL for the API, e.g., `"https://api.example.com/v2/"`
80+
base_url: nil,
8181
# Max number of retries to attempt after a failed retryable request.
8282
max_retries: DEFAULT_MAX_RETRIES,
8383
timeout: DEFAULT_TIMEOUT_IN_SECONDS,

sig/orb/client.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ module Orb
4141
private def auth_headers: -> ::Hash[String, String]
4242

4343
def initialize: (
44-
?base_url: String?,
4544
?api_key: String?,
45+
?base_url: String?,
4646
?max_retries: Integer,
4747
?timeout: Float,
4848
?initial_retry_delay: Float,

0 commit comments

Comments
 (0)