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
  •  
  •  
  •  
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.38"
".": "0.1.0-alpha.39"
}
5 changes: 3 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Layout/LineLength:
AllowedPatterns:
- "^\\s*#.*$"
- ^require(_relative)?
- "Orb::Internal::Type::BaseModel$"
- "^\\s*[A-Z0-9_]+ = :"
- "Orb::(Models|Resources|Test)::"
Max: 110

Expand Down Expand Up @@ -109,8 +111,7 @@ Metrics/MethodLength:
Enabled: false

Metrics/ModuleLength:
Exclude:
- "**/*.rbi"
Enabled: false

Metrics/ParameterLists:
Enabled: false
Expand Down
1 change: 1 addition & 0 deletions .solargraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include:
- 'Rakefile'
- 'examples/**/*.rb'
- 'lib/**/*.rb'
- 'test/orb-billing/resource_namespaces.rb'
- 'test/orb-billing/test_helper.rb'
exclude:
- 'rbi/**/*'
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-95a3d7780935a38e0cf076d4ad2d68bd1a5641bced8398d972db2e92751d364a.yml
openapi_spec_hash: 9ebe818c4ad4f2d9c4e473b5192d7544
config_hash: 3dc5bc1df028fc7301fb2ada9846f038
configured_endpoints: 106
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-e8dad7eee5621fe2ba948dfd00dabf170d9d92ce615a9f04b0f546f4d8bf39ba.yml
openapi_spec_hash: 3f6a98e3a1b3a47acebd67a960090ebf
config_hash: 7e523cf79552b8936bd772f2e1025e5f
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.1.0-alpha.39 (2025-04-07)

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

### Features

* **api:** api update ([#237](https://github.com/orbcorp/orb-ruby/issues/237)) ([0bb6400](https://github.com/orbcorp/orb-ruby/commit/0bb6400deb4cb2ab6959e45ca9a53bc51e040d7a))


### Chores

* always fold up method bodies in sorbet type definitions ([#233](https://github.com/orbcorp/orb-ruby/issues/233)) ([af4a884](https://github.com/orbcorp/orb-ruby/commit/af4a884f3c7eab12b9688cfd3c6d412cbae5bd58))
* **internal:** codegen related update ([#236](https://github.com/orbcorp/orb-ruby/issues/236)) ([8cf1bc4](https://github.com/orbcorp/orb-ruby/commit/8cf1bc47517a9262cbd58bf8c915b6a94b77cc96))
* **internal:** more concise handling of parameter naming conflicts ([#235](https://github.com/orbcorp/orb-ruby/issues/235)) ([ad10a69](https://github.com/orbcorp/orb-ruby/commit/ad10a69558d15218af07ce8c34d234d2ff0946bc))
* **internal:** rubocop rules ([#232](https://github.com/orbcorp/orb-ruby/issues/232)) ([6220144](https://github.com/orbcorp/orb-ruby/commit/62201445cab0f60cb1be36da6196da0fe7787d9b))
* **internal:** version bump ([#230](https://github.com/orbcorp/orb-ruby/issues/230)) ([d5e0113](https://github.com/orbcorp/orb-ruby/commit/d5e01130d014493b793d03f8e19033aa906ab07b))
* update yard comment formatting ([#234](https://github.com/orbcorp/orb-ruby/issues/234)) ([6211751](https://github.com/orbcorp/orb-ruby/commit/6211751f1f0c0aac4440d5d4faf76752a5e50acd))

## 0.1.0-alpha.38 (2025-04-05)

Full Changelog: [v0.1.0-alpha.37...v0.1.0-alpha.38](https://github.com/orbcorp/orb-ruby/compare/v0.1.0-alpha.37...v0.1.0-alpha.38)
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 (0.1.0.pre.alpha.37)
orb-billing (0.1.0.pre.alpha.38)
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", "~> 0.1.0.pre.alpha.37"
gem "orb-billing", "~> 0.1.0.pre.alpha.38"
```

<!-- x-release-please-end -->
Expand Down
7 changes: 7 additions & 0 deletions lib/orb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@
require_relative "orb/models/subscription"
require_relative "orb/models/subscription_cancel_params"
require_relative "orb/models/subscription_cancel_response"
require_relative "orb/models/subscription_change_apply_params"
require_relative "orb/models/subscription_change_apply_response"
require_relative "orb/models/subscription_change_cancel_params"
require_relative "orb/models/subscription_change_cancel_response"
require_relative "orb/models/subscription_change_retrieve_params"
require_relative "orb/models/subscription_change_retrieve_response"
require_relative "orb/models/subscription_create_params"
require_relative "orb/models/subscription_create_response"
require_relative "orb/models/subscription_fetch_costs_params"
Expand Down Expand Up @@ -243,5 +249,6 @@
require_relative "orb/resources/plans/external_plan_id"
require_relative "orb/resources/prices"
require_relative "orb/resources/prices/external_price_id"
require_relative "orb/resources/subscription_changes"
require_relative "orb/resources/subscriptions"
require_relative "orb/resources/top_level"
4 changes: 4 additions & 0 deletions lib/orb/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class Client < Orb::Internal::Transport::BaseClient
# @return [Orb::Resources::DimensionalPriceGroups]
attr_reader :dimensional_price_groups

# @return [Orb::Resources::SubscriptionChanges]
attr_reader :subscription_changes

# @api private
#
# @return [Hash{String=>String}]
Expand Down Expand Up @@ -124,6 +127,7 @@ def initialize(
@subscriptions = Orb::Resources::Subscriptions.new(client: self)
@alerts = Orb::Resources::Alerts.new(client: self)
@dimensional_price_groups = Orb::Resources::DimensionalPriceGroups.new(client: self)
@subscription_changes = Orb::Resources::SubscriptionChanges.new(client: self)
end
end
end
2 changes: 1 addition & 1 deletion lib/orb/internal/transport/base_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def initialize(
end

# Execute the request specified by `req`. This is the method that all resource
# methods call into.
# methods call into.
#
# @overload request(method, path, query: {}, headers: {}, body: nil, unwrap: nil, page: nil, stream: nil, model: Orb::Internal::Type::Unknown, options: {})
#
Expand Down
2 changes: 1 addition & 1 deletion lib/orb/internal/transport/pooled_net_requester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Transport
# @api private
class PooledNetRequester
# from the golang stdlib
# https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49
# https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49
KEEP_ALIVE_TIMEOUT = 30

class << self
Expand Down
31 changes: 14 additions & 17 deletions lib/orb/internal/type/base_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class << self
# @api private
#
# Assumes superclass fields are totally defined before fields are accessed /
# defined on subclasses.
# defined on subclasses.
#
# @return [Hash{Symbol=>Hash{Symbol=>Object}}]
def known_fields
Expand Down Expand Up @@ -143,7 +143,7 @@ def optional(name_sym, type_info, spec = {})
# @api private
#
# `request_only` attributes not excluded from `.#coerce` when receiving responses
# even if well behaved servers should not send them
# even if well behaved servers should not send them
#
# @param blk [Proc]
private def request_only(&blk)
Expand Down Expand Up @@ -258,7 +258,6 @@ def dump(value)
return super
end

is_param = singleton_class <= Orb::Internal::Type::RequestParameters::Converter
acc = {}

coerced.each do |key, val|
Expand All @@ -267,21 +266,19 @@ def dump(value)
in nil
acc.store(name, super(val))
else
mode, type_fn = field.fetch_values(:mode, :type_fn)
api_name, mode, type_fn = field.fetch_values(:api_name, :mode, :type_fn)
case mode
in :coerce
next
else
target = type_fn.call
api_name = is_param ? name : field.fetch(:api_name)
acc.store(api_name, Orb::Internal::Type::Converter.dump(target, val))
end
end
end

known_fields.each do |name, field|
mode, const = field.fetch_values(:mode, :const)
api_name = is_param ? name : field.fetch(:api_name)
known_fields.each_value do |field|
api_name, mode, const = field.fetch_values(:api_name, :mode, :const)
next if mode == :coerce || acc.key?(api_name) || const == Orb::Internal::OMIT
acc.store(api_name, const)
end
Expand All @@ -291,11 +288,11 @@ def dump(value)
end

# Returns the raw value associated with the given key, if found. Otherwise, nil is
# returned.
# returned.
#
# It is valid to lookup keys that are not in the API spec, for example to access
# undocumented features. This method does not parse response data into
# higher-level types. Lookup by anything other than a Symbol is an ArgumentError.
# It is valid to lookup keys that are not in the API spec, for example to access
# undocumented features. This method does not parse response data into
# higher-level types. Lookup by anything other than a Symbol is an ArgumentError.
#
# @param key [Symbol]
#
Expand All @@ -310,12 +307,12 @@ def [](key)

# Returns a Hash of the data underlying this object. O(1)
#
# Keys are Symbols and values are the raw values from the response. The return
# value indicates which values were ever set on the object. i.e. there will be a
# key in this hash if they ever were, even if the set value was nil.
# Keys are Symbols and values are the raw values from the response. The return
# value indicates which values were ever set on the object. i.e. there will be a
# key in this hash if they ever were, even if the set value was nil.
#
# This method is not recursive. The returned value is shared by the object, so it
# should not be mutated.
# This method is not recursive. The returned value is shared by the object, so it
# should not be mutated.
#
# @return [Hash{Symbol=>Object}]
def to_h = @data
Expand Down
42 changes: 20 additions & 22 deletions lib/orb/internal/type/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Orb
module Internal
module Type
# rubocop:disable Metrics/ModuleLength
# @api private
module Converter
# rubocop:disable Lint/UnusedMethodArgument
Expand Down Expand Up @@ -76,37 +75,37 @@ def type_info(spec)
#
# Based on `target`, transform `value` into `target`, to the extent possible:
#
# 1. if the given `value` conforms to `target` already, return the given `value`
# 2. if it's possible and safe to convert the given `value` to `target`, then the
# converted value
# 3. otherwise, the given `value` unaltered
# 1. if the given `value` conforms to `target` already, return the given `value`
# 2. if it's possible and safe to convert the given `value` to `target`, then the
# converted value
# 3. otherwise, the given `value` unaltered
#
# The coercion process is subject to improvement between minor release versions.
# See https://docs.pydantic.dev/latest/concepts/unions/#smart-mode
# The coercion process is subject to improvement between minor release versions.
# See https://docs.pydantic.dev/latest/concepts/unions/#smart-mode
#
# @param target [Orb::Internal::Type::Converter, Class]
#
# @param value [Object]
#
# @param state [Hash{Symbol=>Object}] The `strictness` is one of `true`, `false`, or `:strong`. This informs the
# coercion strategy when we have to decide between multiple possible conversion
# targets:
# coercion strategy when we have to decide between multiple possible conversion
# targets:
#
# - `true`: the conversion must be exact, with minimum coercion.
# - `false`: the conversion can be approximate, with some coercion.
# - `:strong`: the conversion must be exact, with no coercion, and raise an error
# if not possible.
# - `true`: the conversion must be exact, with minimum coercion.
# - `false`: the conversion can be approximate, with some coercion.
# - `:strong`: the conversion must be exact, with no coercion, and raise an error
# if not possible.
#
# The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For
# any given conversion attempt, the exactness will be updated based on how closely
# the value recursively matches the target type:
# The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For
# any given conversion attempt, the exactness will be updated based on how closely
# the value recursively matches the target type:
#
# - `yes`: the value can be converted to the target type with minimum coercion.
# - `maybe`: the value can be converted to the target type with some reasonable
# coercion.
# - `no`: the value cannot be converted to the target type.
# - `yes`: the value can be converted to the target type with minimum coercion.
# - `maybe`: the value can be converted to the target type with some reasonable
# coercion.
# - `no`: the value cannot be converted to the target type.
#
# See implementation below for more details.
# See implementation below for more details.
#
# @option state [Boolean, :strong] :strictness
#
Expand Down Expand Up @@ -218,7 +217,6 @@ def dump(target, value)
end
end
end
# rubocop:enable Metrics/ModuleLength
end
end
end
16 changes: 8 additions & 8 deletions lib/orb/internal/type/enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ module Type
# @api private
#
# A value from among a specified list of options. OpenAPI enum values map to Ruby
# values in the SDK as follows:
# values in the SDK as follows:
#
# 1. boolean => true | false
# 2. integer => Integer
# 3. float => Float
# 4. string => Symbol
# 1. boolean => true | false
# 2. integer => Integer
# 3. float => Float
# 4. string => Symbol
#
# We can therefore convert string values to Symbols, but can't convert other
# values safely.
# We can therefore convert string values to Symbols, but can't convert other
# values safely.
#
# @example
# # `billing_cycle_relative_date` is a `Orb::Models::BillingCycleRelativeDate`
Expand Down Expand Up @@ -66,7 +66,7 @@ def ==(other)
# @api private
#
# Unlike with primitives, `Enum` additionally validates that the value is a member
# of the enum.
# of the enum.
#
# @param value [String, Symbol, Object]
#
Expand Down
6 changes: 1 addition & 5 deletions lib/orb/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module Orb
module Internal
# rubocop:disable Metrics/ModuleLength

# @api private
module Util
# @api private
Expand Down Expand Up @@ -154,7 +152,7 @@ class << self
# @api private
#
# Recursively merge one hash with another. If the values at a given key are not
# both hashes, just take the new value.
# both hashes, just take the new value.
#
# @param values [Array<Object>]
#
Expand Down Expand Up @@ -694,7 +692,5 @@ def decode_sse(lines)
end
end
end

# rubocop:enable Metrics/ModuleLength
end
end
Loading
Loading