Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ jobs:

- name: Run tests
run: ./scripts/test

2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.26"
".": "0.1.0-alpha.27"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-979330185e8fda7b2bc2440075fe81c66132fc87ff3c548e93dd05db35ba3172.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-aeb94d91af916dbff0132ee7c4501df9223609b19fef0398a1a495e7a432ee36.yml
2 changes: 2 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
--markup markdown
--exclude /rbi
--exclude /sig
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## 0.1.0-alpha.27 (2025-03-14)

Full Changelog: [v0.1.0-alpha.26...v0.1.0-alpha.27](https://github.com/orbcorp/orb-ruby/compare/v0.1.0-alpha.26...v0.1.0-alpha.27)

### ⚠ BREAKING CHANGES

* remove unreachable properties ([#159](https://github.com/orbcorp/orb-ruby/issues/159))

### Features

* support jsonl uploads ([#158](https://github.com/orbcorp/orb-ruby/issues/158)) ([1859c05](https://github.com/orbcorp/orb-ruby/commit/1859c05fc738cd31ca79a550c7d62ec2bb75e8ce))


### Bug Fixes

* remove unreachable properties ([#159](https://github.com/orbcorp/orb-ruby/issues/159)) ([9df3b18](https://github.com/orbcorp/orb-ruby/commit/9df3b182dfdc9182f8b6ea2f9673520f2f9450c1))


### Chores

* **api:** correctly support ExternalCustomerID array filter on Subscriptions.List ([#157](https://github.com/orbcorp/orb-ruby/issues/157)) ([5eac667](https://github.com/orbcorp/orb-ruby/commit/5eac66704bf01cf68e277eee50ae5ee9d62cc730))
* improve rbi typedef for page classes ([#154](https://github.com/orbcorp/orb-ruby/issues/154)) ([bfdeb0d](https://github.com/orbcorp/orb-ruby/commit/bfdeb0d60063461b2e4f1e5357a6d1227dfd47e1))
* **internal:** codegen related update ([#153](https://github.com/orbcorp/orb-ruby/issues/153)) ([9351bfa](https://github.com/orbcorp/orb-ruby/commit/9351bfa48cacf7ee3ba254920d8ba711760b651a))
* **internal:** codegen related update ([#155](https://github.com/orbcorp/orb-ruby/issues/155)) ([e7a9137](https://github.com/orbcorp/orb-ruby/commit/e7a913713378f7fc95c60c0dae1deebc4aafa137))
* **internal:** version bump ([#150](https://github.com/orbcorp/orb-ruby/issues/150)) ([db96109](https://github.com/orbcorp/orb-ruby/commit/db96109a5b6d706f6719f3b07e5478d005dcd394))
* remove stale thread local checks ([#152](https://github.com/orbcorp/orb-ruby/issues/152)) ([ff62da0](https://github.com/orbcorp/orb-ruby/commit/ff62da08426e3d52d7b2b8c602e19c951cf89d8f))
* sdk internal updates ([#156](https://github.com/orbcorp/orb-ruby/issues/156)) ([1c988cb](https://github.com/orbcorp/orb-ruby/commit/1c988cb0b9c9f687ce9ae7dfaf4865bbbe313a5e))

## 0.1.0-alpha.26 (2025-03-12)

Full Changelog: [v0.1.0-alpha.25...v0.1.0-alpha.26](https://github.com/orbcorp/orb-ruby/compare/v0.1.0-alpha.25...v0.1.0-alpha.26)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
orb (0.1.0.pre.alpha.26)
orb (0.1.0.pre.alpha.27)
connection_pool

GEM
Expand Down
1 change: 1 addition & 0 deletions lib/orb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require "etc"
require "json"
require "net/http"
require "pathname"
require "rbconfig"
require "securerandom"
require "set"
Expand Down
35 changes: 11 additions & 24 deletions lib/orb/base_client.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# frozen_string_literal: true

module Orb
# @private
# @api private
#
# @abstract
#
class BaseClient
# from whatwg fetch spec
MAX_REDIRECTS = 20
Expand All @@ -21,12 +20,11 @@ class BaseClient
# rubocop:enable Style/MutableConstant

class << self
# @private
# @api private
#
# @param req [Hash{Symbol=>Object}]
#
# @raise [ArgumentError]
#
def validate!(req)
keys = [:method, :path, :query, :headers, :body, :unwrap, :page, :stream, :model, :options]
case req
Expand All @@ -41,13 +39,12 @@ def validate!(req)
end
end

# @private
# @api private
#
# @param status [Integer]
# @param headers [Hash{String=>String}, Net::HTTPHeader]
#
# @return [Boolean]
#
def should_retry?(status, headers:)
coerced = Orb::Util.coerce_boolean(headers["x-should-retry"])
case [coerced, status]
Expand All @@ -65,7 +62,7 @@ def should_retry?(status, headers:)
end
end

# @private
# @api private
#
# @param request [Hash{Symbol=>Object}] .
#
Expand All @@ -86,7 +83,6 @@ def should_retry?(status, headers:)
# @param response_headers [Hash{String=>String}, Net::HTTPHeader]
#
# @return [Hash{Symbol=>Object}]
#
def follow_redirect(request, status:, response_headers:)
method, url, headers = request.fetch_values(:method, :url, :headers)
location =
Expand Down Expand Up @@ -130,12 +126,11 @@ def follow_redirect(request, status:, response_headers:)
end
end

# @private
#
# @api private
# @return [Orb::PooledNetRequester]
attr_accessor :requester

# @private
# @api private
#
# @param base_url [String]
# @param timeout [Float]
Expand All @@ -144,7 +139,6 @@ def follow_redirect(request, status:, response_headers:)
# @param max_retry_delay [Float]
# @param headers [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}]
# @param idempotency_header [String, nil]
#
def initialize(
base_url:,
timeout: 0.0,
Expand All @@ -171,19 +165,17 @@ def initialize(
@max_retry_delay = max_retry_delay
end

# @private
# @api private
#
# @return [Hash{String=>String}]
#
private def auth_headers = {}

# @private
# @api private
#
# @return [String]
#
private def generate_idempotency_key = "stainless-ruby-retry-#{SecureRandom.uuid}"

# @private
# @api private
#
# @param req [Hash{Symbol=>Object}] .
#
Expand Down Expand Up @@ -220,7 +212,6 @@ def initialize(
# @option opts [Float, nil] :timeout
#
# @return [Hash{Symbol=>Object}]
#
private def build_request(req, opts)
method, uninterpolated_path = req.fetch_values(:method, :path)

Expand Down Expand Up @@ -271,13 +262,12 @@ def initialize(
}
end

# @private
# @api private
#
# @param headers [Hash{String=>String}]
# @param retry_count [Integer]
#
# @return [Float]
#
private def retry_delay(headers, retry_count:)
# Non-standard extension
span = Float(headers["retry-after-ms"], exception: false)&.then { _1 / 1000 }
Expand All @@ -298,7 +288,7 @@ def initialize(
(@initial_retry_delay * scale * jitter).clamp(0, @max_retry_delay)
end

# @private
# @api private
#
# @param request [Hash{Symbol=>Object}] .
#
Expand All @@ -322,7 +312,6 @@ def initialize(
#
# @raise [Orb::APIError]
# @return [Array(Integer, Net::HTTPResponse, Enumerable)]
#
private def send_request(request, redirect_count:, retry_count:, send_retry_header:)
url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
input = {**request.except(:timeout), deadline: Orb::Util.monotonic_secs + timeout}
Expand Down Expand Up @@ -424,7 +413,6 @@ def initialize(
#
# @raise [Orb::APIError]
# @return [Object]
#
def request(req)
self.class.validate!(req)
model = req.fetch(:model) { Orb::Unknown }
Expand Down Expand Up @@ -455,7 +443,6 @@ def request(req)
end

# @return [String]
#
def inspect
# rubocop:disable Layout/LineLength
base_url = Orb::Util.unparse_uri(@base_url)
Expand Down
Loading
Loading