Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
aa669fe
feat(api)!: define shared model ConversionRateConfig
stainless-app[bot] Sep 2, 2025
394af82
feat(api): api update
stainless-app[bot] Sep 2, 2025
3bd8a47
feat: extract minimum composite to type
stainless-app[bot] Sep 3, 2025
d7dd0b8
chore(internal): codegen related update
stainless-app[bot] Sep 3, 2025
bc6c8f9
feat(api): api update
stainless-app[bot] Sep 3, 2025
246283d
feat(api): api update
stainless-app[bot] Sep 5, 2025
8e3ac4b
feat(api): api update
stainless-app[bot] Sep 10, 2025
be80854
feat(api): api update
stainless-app[bot] Sep 12, 2025
b89ea6d
feat(api): api update
stainless-app[bot] Sep 16, 2025
cafba93
feat: expose response headers for both streams and errors
stainless-app[bot] Sep 17, 2025
c7d1331
chore: do not install brew dependencies in ./scripts/bootstrap by def…
stainless-app[bot] Sep 19, 2025
343fa0b
feat(api): api update
stainless-app[bot] Sep 19, 2025
9538971
perf: faster code formatting
stainless-app[bot] Sep 25, 2025
58f092f
fix(internal): use null byte as file separator in the fast formatting…
stainless-app[bot] Sep 26, 2025
984b6ad
fix: shorten multipart boundary sep to less than RFC specificed max l…
stainless-app[bot] Sep 26, 2025
6566897
chore: allow fast-format to use bsd sed as well
stainless-app[bot] Sep 26, 2025
aefe58f
fix: always send `filename=...` for multipart requests where a file i…
stainless-app[bot] Sep 29, 2025
83a6ffd
feat(api): api update
stainless-app[bot] Sep 29, 2025
b9d5318
codegen metadata
stainless-app[bot] Sep 29, 2025
a4faf55
fix: coroutine leaks from connection pool
stainless-app[bot] Sep 30, 2025
fca9129
release: 1.12.0
stainless-app[bot] Sep 30, 2025
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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.11.2"
".": "1.12.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 118
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-4f31d46f5ba187fc4d702c9f9f1573dacb891edbd086f935707578d7c4f5fed8.yml
openapi_spec_hash: 25b1019f20a47b8af665aae5f8fd0025
config_hash: d8a0d696f3250ab096fac87b6b0eab53
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ab79d1df8310a4fc3089fcf814f9fb00c7341acc254aafe34479af0f871d244b.yml
openapi_spec_hash: 9416d6718ca4eeb3c20790187348b5b0
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# Changelog

## 1.12.0 (2025-09-30)

Full Changelog: [v1.11.2...v1.12.0](https://github.com/orbcorp/orb-ruby/compare/v1.11.2...v1.12.0)

### ⚠ BREAKING CHANGES

* **api:** define shared model ConversionRateConfig

### Features

* **api:** api update ([83a6ffd](https://github.com/orbcorp/orb-ruby/commit/83a6ffda9613b6571029f01235d673d179294c94))
* **api:** api update ([343fa0b](https://github.com/orbcorp/orb-ruby/commit/343fa0b8a9a724b73f8abe5e9de34795f232e065))
* **api:** api update ([b89ea6d](https://github.com/orbcorp/orb-ruby/commit/b89ea6d10a12909e77c76617d11068ade5cf6fc8))
* **api:** api update ([be80854](https://github.com/orbcorp/orb-ruby/commit/be80854305b7dd24350c0a955de536d37233bc35))
* **api:** api update ([8e3ac4b](https://github.com/orbcorp/orb-ruby/commit/8e3ac4b248b2aca6ac6d5360f34be8521b05bc83))
* **api:** api update ([246283d](https://github.com/orbcorp/orb-ruby/commit/246283dc41fd3d9b128ac44ccd8550ae7b987578))
* **api:** api update ([bc6c8f9](https://github.com/orbcorp/orb-ruby/commit/bc6c8f9914220783adeb80fa6a9eb87d009fa58d))
* **api:** api update ([394af82](https://github.com/orbcorp/orb-ruby/commit/394af826a5ba3cd462447304c8ec659038e67617))
* **api:** define shared model ConversionRateConfig ([aa669fe](https://github.com/orbcorp/orb-ruby/commit/aa669fef9079dbac856be83d56cabd826e3c47c0))
* expose response headers for both streams and errors ([cafba93](https://github.com/orbcorp/orb-ruby/commit/cafba93f8798a84815c9c9d1183327e498cb6b95))
* extract minimum composite to type ([3bd8a47](https://github.com/orbcorp/orb-ruby/commit/3bd8a47a7c0601ccb9c43b472131562319a59e51))


### Bug Fixes

* always send `filename=...` for multipart requests where a file is expected ([aefe58f](https://github.com/orbcorp/orb-ruby/commit/aefe58f92b1296aa30172ce8206f84723a3a326c))
* coroutine leaks from connection pool ([a4faf55](https://github.com/orbcorp/orb-ruby/commit/a4faf55a381bcdaae01f0a22cd8922038af38f69))
* **internal:** use null byte as file separator in the fast formatting script ([58f092f](https://github.com/orbcorp/orb-ruby/commit/58f092f32214ae8deb17db5e002f10fafd60378e))
* shorten multipart boundary sep to less than RFC specificed max length ([984b6ad](https://github.com/orbcorp/orb-ruby/commit/984b6ad403302ab97275136e145dce322ce82e9b))


### Performance Improvements

* faster code formatting ([9538971](https://github.com/orbcorp/orb-ruby/commit/95389713d7c3b97ec3cf0963b86211d5fba72fe4))


### Chores

* allow fast-format to use bsd sed as well ([6566897](https://github.com/orbcorp/orb-ruby/commit/6566897b0797bdbad69e21ed05d97f4ce1509f07))
* do not install brew dependencies in ./scripts/bootstrap by default ([c7d1331](https://github.com/orbcorp/orb-ruby/commit/c7d13317194914b406f35048eb198c715e3645da))
* **internal:** codegen related update ([d7dd0b8](https://github.com/orbcorp/orb-ruby/commit/d7dd0b8380fd9ec066388c3327ed16fdba9f7fa6))

## 1.11.2 (2025-08-29)

Full Changelog: [v1.11.1...v1.11.2](https://github.com/orbcorp/orb-ruby/compare/v1.11.1...v1.11.2)
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-billing (1.11.2)
orb-billing (1.12.0)
connection_pool

GEM
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "orb-billing", "~> 1.11.2"
gem "orb-billing", "~> 1.12.0"
```

<!-- x-release-please-end -->
Expand Down
28 changes: 20 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ tapioca = "sorbet/tapioca"
examples = "examples"
ignore_file = ".ignore"

FILES_ENV = "FORMAT_FILE"

CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc/], *FileList["*.gem"], ignore_file)

CLOBBER.push(*%w[sorbet/rbi/annotations/ sorbet/rbi/gems/], tapioca)
Expand All @@ -38,6 +40,14 @@ end
xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")}

filtered = ->(ext, dirs) do
if ENV.key?(FILES_ENV)
%w[sed -E -n -e] << "/\\.#{ext}$/p" << "--" << ENV.fetch(FILES_ENV)
else
(%w[find] + dirs + %w[-type f -and -name]) << "*.#{ext}" << "-print0"
end
end

desc("Lint `*.rb(i)`")
multitask(:"lint:rubocop") do
find = %w[find ./lib ./test ./rbi ./examples -type f -and ( -name *.rb -or -name *.rbi ) -print0]
Expand All @@ -52,24 +62,26 @@ multitask(:"lint:rubocop") do
sh("#{find.shelljoin} | #{lint.shelljoin}")
end

norm_lines = %w[tr -- \n \0].shelljoin

desc("Format `*.rb`")
multitask(:"format:rb") do
# while `syntax_tree` is much faster than `rubocop`, `rubocop` is the only formatter with full syntax support
find = %w[find ./lib ./test ./examples -type f -and -name *.rb -print0]
files = filtered["rb", %w[./lib ./test ./examples]]
fmt = xargs + %w[rubocop --fail-level F --autocorrect --format simple --]
sh("#{find.shelljoin} | #{fmt.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}")
end

desc("Format `*.rbi`")
multitask(:"format:rbi") do
find = %w[find ./rbi -type f -and -name *.rbi -print0]
files = filtered["rbi", %w[./rbi]]
fmt = xargs + %w[stree write --]
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}")
sh(ruby_opt, "#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}")
end

desc("Format `*.rbs`")
multitask(:"format:rbs") do
find = %w[find ./sig -type f -name *.rbs -print0]
files = filtered["rbs", %w[./sig]]
inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? ["-i", ""] : %w[-i]
uuid = SecureRandom.uuid

Expand Down Expand Up @@ -98,13 +110,13 @@ multitask(:"format:rbs") do
success = false

# transform class aliases to type aliases, which syntax tree has no trouble with
sh("#{find.shelljoin} | #{pre.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{pre.shelljoin}")
# run syntax tree to format `*.rbs` files
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}") do
sh(ruby_opt, "#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}") do
success = _1
end
# transform type aliases back to class aliases
sh("#{find.shelljoin} | #{pst.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{pst.shelljoin}")

# always run post-processing to remove comment marker
fail unless success
Expand Down
20 changes: 3 additions & 17 deletions lib/orb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@
require_relative "orb/models/billing_cycle_anchor_configuration"
require_relative "orb/models/billing_cycle_configuration"
require_relative "orb/models/billing_cycle_relative_date"
require_relative "orb/models/bps_config"
require_relative "orb/models/bps_tier"
require_relative "orb/models/bulk_bps_config"
require_relative "orb/models/bulk_bps_tier"
require_relative "orb/models/bulk_config"
require_relative "orb/models/bulk_tier"
require_relative "orb/models/changed_subscription_resources"
Expand Down Expand Up @@ -234,8 +230,6 @@
require_relative "orb/models/new_avalara_tax_configuration"
require_relative "orb/models/new_billing_cycle_configuration"
require_relative "orb/models/new_dimensional_price_configuration"
require_relative "orb/models/new_floating_bps_price"
require_relative "orb/models/new_floating_bulk_bps_price"
require_relative "orb/models/new_floating_bulk_price"
require_relative "orb/models/new_floating_bulk_with_proration_price"
require_relative "orb/models/new_floating_cumulative_grouped_bulk_price"
Expand All @@ -248,12 +242,12 @@
require_relative "orb/models/new_floating_matrix_with_allocation_price"
require_relative "orb/models/new_floating_matrix_with_display_name_price"
require_relative "orb/models/new_floating_max_group_tiered_package_price"
require_relative "orb/models/new_floating_minimum_composite_price"
require_relative "orb/models/new_floating_package_price"
require_relative "orb/models/new_floating_package_with_allocation_price"
require_relative "orb/models/new_floating_scalable_matrix_with_tiered_pricing_price"
require_relative "orb/models/new_floating_scalable_matrix_with_unit_pricing_price"
require_relative "orb/models/new_floating_threshold_total_amount_price"
require_relative "orb/models/new_floating_tiered_bps_price"
require_relative "orb/models/new_floating_tiered_package_price"
require_relative "orb/models/new_floating_tiered_package_with_minimum_price"
require_relative "orb/models/new_floating_tiered_price"
Expand All @@ -265,8 +259,6 @@
require_relative "orb/models/new_maximum"
require_relative "orb/models/new_minimum"
require_relative "orb/models/new_percentage_discount"
require_relative "orb/models/new_plan_bps_price"
require_relative "orb/models/new_plan_bulk_bps_price"
require_relative "orb/models/new_plan_bulk_price"
require_relative "orb/models/new_plan_bulk_with_proration_price"
require_relative "orb/models/new_plan_cumulative_grouped_bulk_price"
Expand All @@ -279,24 +271,21 @@
require_relative "orb/models/new_plan_matrix_with_allocation_price"
require_relative "orb/models/new_plan_matrix_with_display_name_price"
require_relative "orb/models/new_plan_max_group_tiered_package_price"
require_relative "orb/models/new_plan_minimum_composite_price"
require_relative "orb/models/new_plan_package_price"
require_relative "orb/models/new_plan_package_with_allocation_price"
require_relative "orb/models/new_plan_scalable_matrix_with_tiered_pricing_price"
require_relative "orb/models/new_plan_scalable_matrix_with_unit_pricing_price"
require_relative "orb/models/new_plan_threshold_total_amount_price"
require_relative "orb/models/new_plan_tiered_bps_price"
require_relative "orb/models/new_plan_tiered_package_price"
require_relative "orb/models/new_plan_tiered_package_with_minimum_price"
require_relative "orb/models/new_plan_tiered_price"
require_relative "orb/models/new_plan_tiered_with_minimum_price"
require_relative "orb/models/new_plan_tier_with_proration_price"
require_relative "orb/models/new_plan_unit_price"
require_relative "orb/models/new_plan_unit_with_percent_price"
require_relative "orb/models/new_plan_unit_with_proration_price"
require_relative "orb/models/new_reporting_configuration"
require_relative "orb/models/new_sphere_configuration"
require_relative "orb/models/new_subscription_bps_price"
require_relative "orb/models/new_subscription_bulk_bps_price"
require_relative "orb/models/new_subscription_bulk_price"
require_relative "orb/models/new_subscription_bulk_with_proration_price"
require_relative "orb/models/new_subscription_cumulative_grouped_bulk_price"
Expand All @@ -309,17 +298,16 @@
require_relative "orb/models/new_subscription_matrix_with_allocation_price"
require_relative "orb/models/new_subscription_matrix_with_display_name_price"
require_relative "orb/models/new_subscription_max_group_tiered_package_price"
require_relative "orb/models/new_subscription_minimum_composite_price"
require_relative "orb/models/new_subscription_package_price"
require_relative "orb/models/new_subscription_package_with_allocation_price"
require_relative "orb/models/new_subscription_scalable_matrix_with_tiered_pricing_price"
require_relative "orb/models/new_subscription_scalable_matrix_with_unit_pricing_price"
require_relative "orb/models/new_subscription_threshold_total_amount_price"
require_relative "orb/models/new_subscription_tiered_bps_price"
require_relative "orb/models/new_subscription_tiered_package_price"
require_relative "orb/models/new_subscription_tiered_package_with_minimum_price"
require_relative "orb/models/new_subscription_tiered_price"
require_relative "orb/models/new_subscription_tiered_with_minimum_price"
require_relative "orb/models/new_subscription_tier_with_proration_price"
require_relative "orb/models/new_subscription_unit_price"
require_relative "orb/models/new_subscription_unit_with_percent_price"
require_relative "orb/models/new_subscription_unit_with_proration_price"
Expand Down Expand Up @@ -395,8 +383,6 @@
require_relative "orb/models/tax_amount"
require_relative "orb/models/threshold"
require_relative "orb/models/tier"
require_relative "orb/models/tier_config"
require_relative "orb/models/tiered_bps_config"
require_relative "orb/models/tiered_config"
require_relative "orb/models/tiered_conversion_rate_config"
require_relative "orb/models/tier_sub_line_item"
Expand Down
36 changes: 25 additions & 11 deletions lib/orb/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,25 @@ class APIError < Orb::Errors::Error
# @return [Integer, nil]
attr_accessor :status

# @return [Hash{String=>String}, nil]
attr_accessor :headers

# @return [Object, nil]
attr_accessor :body

# @api private
#
# @param url [URI::Generic]
# @param status [Integer, nil]
# @param headers [Hash{String=>String}, nil]
# @param body [Object, nil]
# @param request [nil]
# @param response [nil]
# @param message [String, nil]
def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil)
def initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil)
@url = url
@status = status
@headers = headers
@body = body
@request = request
@response = response
Expand All @@ -74,13 +79,15 @@ class APIConnectionError < Orb::Errors::APIError
#
# @param url [URI::Generic]
# @param status [nil]
# @param headers [Hash{String=>String}, nil]
# @param body [nil]
# @param request [nil]
# @param response [nil]
# @param message [String, nil]
def initialize(
url:,
status: nil,
headers: nil,
body: nil,
request: nil,
response: nil,
Expand All @@ -95,13 +102,15 @@ class APITimeoutError < Orb::Errors::APIConnectionError
#
# @param url [URI::Generic]
# @param status [nil]
# @param headers [Hash{String=>String}, nil]
# @param body [nil]
# @param request [nil]
# @param response [nil]
# @param message [String, nil]
def initialize(
url:,
status: nil,
headers: nil,
body: nil,
request: nil,
response: nil,
Expand All @@ -116,22 +125,25 @@ class APIStatusError < Orb::Errors::APIError
#
# @param url [URI::Generic]
# @param status [Integer]
# @param headers [Hash{String=>String}, nil]
# @param body [Object, nil]
# @param request [nil]
# @param response [nil]
# @param message [String, nil]
#
# @return [self]
def self.for(url:, status:, body:, request:, response:, message: nil)
def self.for(url:, status:, headers:, body:, request:, response:, message: nil)
key = Orb::Internal::Util.dig(body, :type)
kwargs = {
url: url,
status: status,
body: body,
request: request,
response: response,
message: message
}
kwargs =
{
url: url,
status: status,
headers: headers,
body: body,
request: request,
response: response,
message: message
}

case [status, key]
in [400, Orb::Errors::ConstraintViolation::TYPE]
Expand Down Expand Up @@ -187,15 +199,17 @@ def self.for(url:, status:, body:, request:, response:, message: nil)
#
# @param url [URI::Generic]
# @param status [Integer]
# @param headers [Hash{String=>String}, nil]
# @param body [Object, nil]
# @param request [nil]
# @param response [nil]
# @param message [String, nil]
def initialize(url:, status:, body:, request:, response:, message: nil)
def initialize(url:, status:, headers:, body:, request:, response:, message: nil)
message ||= {url: url.to_s, status: status, body: body}
super(
url: url,
status: status,
headers: headers,
body: body,
request: request,
response: response,
Expand Down
17 changes: 10 additions & 7 deletions lib/orb/file_part.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ def to_json(*a) = read.to_json(*a)
def to_yaml(*a) = read.to_yaml(*a)

# @param content [Pathname, StringIO, IO, String]
# @param filename [String, nil]
# @param filename [Pathname, String, nil]
# @param content_type [String, nil]
def initialize(content, filename: nil, content_type: nil)
@content = content
@content_type = content_type
@filename =
case content
in Pathname
filename.nil? ? content.basename.to_path : ::File.basename(filename)
case [filename, (@content = content)]
in [String | Pathname, _]
::File.basename(filename)
in [nil, Pathname]
content.basename.to_path
in [nil, IO]
content.to_path
else
filename.nil? ? nil : ::File.basename(filename)
filename
end
@content_type = content_type
end
end
end
Loading
Loading