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
Jump to file
Failed to load files.
Loading
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.24"
".": "0.1.0-alpha.25"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 195
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-27f9f4f9013338a67494704ce9fa855698e5de91ea0600decd52fddcf9b298a2.yml
openapi_spec_hash: 21382ccac2711e76cdc2c1af0e2d6954
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-8f6c4012863716d091d2212f4a079ceb2af3b5b4e776b00aab9b5cba7f452960.yml
openapi_spec_hash: 11c039f345002ae50d39988570ae266e
config_hash: 1619155422217276e2489ae10ce63a25
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.25 (2025-05-20)

Full Changelog: [v0.1.0-alpha.24...v0.1.0-alpha.25](https://github.com/Increase/increase-ruby/compare/v0.1.0-alpha.24...v0.1.0-alpha.25)

### Features

* **api:** api update ([e0ff4dc](https://github.com/Increase/increase-ruby/commit/e0ff4dc3724a0afac1fe6b232f319752dd0503f3))


### Bug Fixes

* correctly instantiate sorbet type aliases for enums and unions ([dbf0949](https://github.com/Increase/increase-ruby/commit/dbf094958b6e2f50f82252018dbc7d44380be1e1))


### Chores

* whitespaces ([67b9c0d](https://github.com/Increase/increase-ruby/commit/67b9c0d67f049bc1db8c0adb32320479aa48b4e5))

## 0.1.0-alpha.24 (2025-05-15)

Full Changelog: [v0.1.0-alpha.23...v0.1.0-alpha.24](https://github.com/Increase/increase-ruby/compare/v0.1.0-alpha.23...v0.1.0-alpha.24)
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:
increase (0.1.0.pre.alpha.24)
increase (0.1.0.pre.alpha.25)
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 "increase", "~> 0.1.0.pre.alpha.24"
gem "increase", "~> 0.1.0.pre.alpha.25"
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target(:lib) do

signature("sig")

YAML.safe_load_file("./manifest.yaml", symbolize_names: true) => { dependencies: }
YAML.safe_load_file("./manifest.yaml", symbolize_names: true) => {dependencies:}
# currently these libraries lack the `*.rbs` annotations required by `steep`
stdlibs = dependencies - %w[English etc net/http rbconfig set stringio]

Expand Down
8 changes: 8 additions & 0 deletions lib/increase/internal/type/array_of.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Type
# Array of items of a given type.
class ArrayOf
include Increase::Internal::Type::Converter
include Increase::Internal::Util::SorbetRuntimeSupport

private_class_method :new

Expand Down Expand Up @@ -110,6 +111,13 @@ def dump(value, state:)
end
end

# @api private
#
# @return [Object]
def to_sorbet_type
T::Array[Increase::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(item_type)]
end

# @api private
#
# @return [generic<Elem>]
Expand Down
7 changes: 7 additions & 0 deletions lib/increase/internal/type/base_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ def dump(value, state:)

acc
end

# @api private
#
# @return [Object]
def to_sorbet_type
self
end
end

class << self
Expand Down
8 changes: 8 additions & 0 deletions lib/increase/internal/type/boolean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Type
# Ruby has no Boolean class; this is something for models to refer to.
class Boolean
extend Increase::Internal::Type::Converter
extend Increase::Internal::Util::SorbetRuntimeSupport

private_class_method :new

Expand Down Expand Up @@ -56,6 +57,13 @@ def coerce(value, state:)
# @option state [Boolean] :can_retry
#
# @return [Boolean, Object]

# @api private
#
# @return [Object]
def to_sorbet_type
T::Boolean
end
end
end
end
Expand Down
12 changes: 12 additions & 0 deletions lib/increase/internal/type/enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ def coerce(value, state:)
#
# @return [Symbol, Object]

# @api private
#
# @return [Object]
def to_sorbet_type
case values
in []
T.noreturn
in [value, *_]
T.all(Increase::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(value), self)
end
end

# @api private
#
# @param depth [Integer]
Expand Down
7 changes: 7 additions & 0 deletions lib/increase/internal/type/file_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ def dump(value, state:)

value
end

# @api private
#
# @return [Object]
def to_sorbet_type
T.any(Pathname, StringIO, IO, String, Increase::FilePart)
end
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions lib/increase/internal/type/hash_of.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Type
# Hash of items of a given type.
class HashOf
include Increase::Internal::Type::Converter
include Increase::Internal::Util::SorbetRuntimeSupport

private_class_method :new

Expand Down Expand Up @@ -130,6 +131,13 @@ def dump(value, state:)
end
end

# @api private
#
# @return [Object]
def to_sorbet_type
T::Hash[Increase::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(item_type)]
end

# @api private
#
# @return [generic<Elem>]
Expand Down
12 changes: 12 additions & 0 deletions lib/increase/internal/type/union.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@ def dump(value, state:)
super
end

# @api private
#
# @return [Object]
def to_sorbet_type
case (v = variants)
in []
T.noreturn
else
T.any(*v.map { Increase::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) })
end
end

# rubocop:enable Style/CaseEquality
# rubocop:enable Style/HashEachMethods

Expand Down
8 changes: 8 additions & 0 deletions lib/increase/internal/type/unknown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Type
# When we don't know what to expect for the value.
class Unknown
extend Increase::Internal::Type::Converter
extend Increase::Internal::Util::SorbetRuntimeSupport

# rubocop:disable Lint/UnusedMethodArgument

Expand Down Expand Up @@ -58,6 +59,13 @@ def coerce(value, state:)
# @option state [Boolean] :can_retry
#
# @return [Object]

# @api private
#
# @return [Object]
def to_sorbet_type
T.anything
end
end

# rubocop:enable Lint/UnusedMethodArgument
Expand Down
45 changes: 45 additions & 0 deletions lib/increase/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ module Util
# @return [Float]
def self.monotonic_secs = Process.clock_gettime(Process::CLOCK_MONOTONIC)

# @api private
#
# @param ns [Module, Class]
#
# @return [Enumerable<Module, Class>]
def self.walk_namespaces(ns)
ns.constants(false).lazy.flat_map do
case (c = ns.const_get(_1, false))
in Module | Class
walk_namespaces(c)
else
[]
end
end
.chain([ns])
end

class << self
# @api private
#
Expand Down Expand Up @@ -826,11 +843,39 @@ def const_missing(name)
sorbet_runtime_constants.fetch(name).call
end

# @api private
#
# @param name [Symbol]
#
# @return [Boolean]
def sorbet_constant_defined?(name) = sorbet_runtime_constants.key?(name)

# @api private
#
# @param name [Symbol]
# @param blk [Proc]
def define_sorbet_constant!(name, &blk) = sorbet_runtime_constants.store(name, blk)

# @api private
#
# @return [Object]
def to_sorbet_type = raise NotImplementedError

class << self
# @api private
#
# @param type [Increase::Internal::Util::SorbetRuntimeSupport, Object]
#
# @return [Object]
def to_sorbet_type(type)
case type
in Increase::Internal::Util::SorbetRuntimeSupport
type.to_sorbet_type
else
type
end
end
end
end

extend Increase::Internal::Util::SorbetRuntimeSupport
Expand Down
49 changes: 30 additions & 19 deletions lib/increase/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,40 @@ module Increase
cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, Increase::Internal::AnyHash) } }
end

[
*Increase::Internal::Type::Enum.included_modules,
*Increase::Internal::Type::Union.included_modules
].each do |cls|
cls.constants.each do |name|
case cls.const_get(name)
in true | false
cls.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, cls) } }
cls.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
in Integer
cls.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, cls) } }
cls.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
in Float
cls.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, cls) } }
cls.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
in Symbol
cls.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, cls) } }
cls.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
else
Increase::Internal::Util.walk_namespaces(Increase::Models).each do |mod|
case mod
in Increase::Internal::Type::Enum | Increase::Internal::Type::Union
mod.constants.each do |name|
case mod.const_get(name)
in true | false
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, mod) } }
mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
in Integer
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, mod) } }
mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
in Float
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, mod) } }
mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
in Symbol
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, mod) } }
mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
else
end
end
else
end
end

Increase::Internal::Util.walk_namespaces(Increase::Models)
.lazy
.grep(Increase::Internal::Type::Union)
.each do |mod|
const = :Variants
next if mod.sorbet_constant_defined?(const)

mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
end

Account = Increase::Models::Account

AccountBalanceParams = Increase::Models::AccountBalanceParams
Expand Down
6 changes: 6 additions & 0 deletions lib/increase/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ module Category
# Occurs whenever an OAuth Connection is deactivated.
OAUTH_CONNECTION_DEACTIVATED = :"oauth_connection.deactivated"

# Occurs whenever an Outbound Card Push Transfer is created.
OUTBOUND_CARD_PUSH_TRANSFER_CREATED = :"outbound_card_push_transfer.created"

# Occurs whenever an Outbound Card Push Transfer is updated.
OUTBOUND_CARD_PUSH_TRANSFER_UPDATED = :"outbound_card_push_transfer.updated"

# Occurs whenever a Pending Transaction is created.
PENDING_TRANSACTION_CREATED = :"pending_transaction.created"

Expand Down
6 changes: 6 additions & 0 deletions lib/increase/models/event_list_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ module In
# Occurs whenever an OAuth Connection is deactivated.
OAUTH_CONNECTION_DEACTIVATED = :"oauth_connection.deactivated"

# Occurs whenever an Outbound Card Push Transfer is created.
OUTBOUND_CARD_PUSH_TRANSFER_CREATED = :"outbound_card_push_transfer.created"

# Occurs whenever an Outbound Card Push Transfer is updated.
OUTBOUND_CARD_PUSH_TRANSFER_UPDATED = :"outbound_card_push_transfer.updated"

# Occurs whenever a Pending Transaction is created.
PENDING_TRANSACTION_CREATED = :"pending_transaction.created"

Expand Down
6 changes: 6 additions & 0 deletions lib/increase/models/event_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ module SelectedEventCategory
# Occurs whenever an OAuth Connection is deactivated.
OAUTH_CONNECTION_DEACTIVATED = :"oauth_connection.deactivated"

# Occurs whenever an Outbound Card Push Transfer is created.
OUTBOUND_CARD_PUSH_TRANSFER_CREATED = :"outbound_card_push_transfer.created"

# Occurs whenever an Outbound Card Push Transfer is updated.
OUTBOUND_CARD_PUSH_TRANSFER_UPDATED = :"outbound_card_push_transfer.updated"

# Occurs whenever a Pending Transaction is created.
PENDING_TRANSACTION_CREATED = :"pending_transaction.created"

Expand Down
6 changes: 6 additions & 0 deletions lib/increase/models/event_subscription_create_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ module SelectedEventCategory
# Occurs whenever an OAuth Connection is deactivated.
OAUTH_CONNECTION_DEACTIVATED = :"oauth_connection.deactivated"

# Occurs whenever an Outbound Card Push Transfer is created.
OUTBOUND_CARD_PUSH_TRANSFER_CREATED = :"outbound_card_push_transfer.created"

# Occurs whenever an Outbound Card Push Transfer is updated.
OUTBOUND_CARD_PUSH_TRANSFER_UPDATED = :"outbound_card_push_transfer.updated"

# Occurs whenever a Pending Transaction is created.
PENDING_TRANSACTION_CREATED = :"pending_transaction.created"

Expand Down
Loading
Loading