diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 31d823888..b8af36c3a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.28.0" + ".": "1.29.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 318e5b772..4b3aa93d3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 202 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-244805b184601a0639e868cb601337a5ebe0f259576a7e22d46c881ee22e17d3.yml -openapi_spec_hash: a667a8fca7bc57f82f22ddc2a9829e19 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-65d55098340df71e6f5c251c62e6853ad5184102c603d9f74622e8b33581c800.yml +openapi_spec_hash: 9f772e02b53a65c6e8ada7ac684117fb config_hash: a185e9a72778cc4658ea73fb3a7f1354 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b56ec2ca..9284de1c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 1.29.0 (2025-08-11) + +Full Changelog: [v1.28.0...v1.29.0](https://github.com/Increase/increase-ruby/compare/v1.28.0...v1.29.0) + +### Features + +* **api:** api update ([8067d85](https://github.com/Increase/increase-ruby/commit/8067d8591d4f0a2f5a33b796a3f50fe6b5fb6c48)) + + +### Chores + +* collect metadata from type DSL ([175f631](https://github.com/Increase/increase-ruby/commit/175f6319788a5ddb8576871ce2e7db5f87474c57)) +* **internal:** update comment in script ([a4ab2aa](https://github.com/Increase/increase-ruby/commit/a4ab2aa028a24748cde9280d83e4457e966b6aac)) +* update @stainless-api/prism-cli to v5.15.0 ([663a03e](https://github.com/Increase/increase-ruby/commit/663a03e20f29203afbb2b8ff06aa63a0391b3afc)) + ## 1.28.0 (2025-08-07) Full Changelog: [v1.27.0...v1.28.0](https://github.com/Increase/increase-ruby/compare/v1.27.0...v1.28.0) diff --git a/Gemfile.lock b/Gemfile.lock index c39ee1d91..712c3113a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - increase (1.28.0) + increase (1.29.0) connection_pool GEM diff --git a/README.md b/README.md index 4a9d3b9de..2208b45a6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "increase", "~> 1.28.0" +gem "increase", "~> 1.29.0" ``` diff --git a/lib/increase/internal/type/array_of.rb b/lib/increase/internal/type/array_of.rb index 0e73dee91..5281b2e02 100644 --- a/lib/increase/internal/type/array_of.rb +++ b/lib/increase/internal/type/array_of.rb @@ -148,6 +148,7 @@ def to_sorbet_type # @option spec [Boolean] :"nil?" def initialize(type_info, spec = {}) @item_type_fn = Increase::Internal::Type::Converter.type_info(type_info || spec) + @meta = Increase::Internal::Type::Converter.meta_info(type_info, spec) @nilable = spec.fetch(:nil?, false) end diff --git a/lib/increase/internal/type/base_model.rb b/lib/increase/internal/type/base_model.rb index b44e0fb8b..b559ec975 100644 --- a/lib/increase/internal/type/base_model.rb +++ b/lib/increase/internal/type/base_model.rb @@ -52,6 +52,7 @@ def fields # # @option spec [Boolean] :"nil?" private def add_field(name_sym, required:, type_info:, spec:) + meta = Increase::Internal::Type::Converter.meta_info(type_info, spec) type_fn, info = case type_info in Proc | Increase::Internal::Type::Converter | Class @@ -81,7 +82,8 @@ def fields required: required, nilable: nilable, const: const, - type_fn: type_fn + type_fn: type_fn, + meta: meta } define_method(setter) do |value| diff --git a/lib/increase/internal/type/converter.rb b/lib/increase/internal/type/converter.rb index ab52c3c11..f14101b71 100644 --- a/lib/increase/internal/type/converter.rb +++ b/lib/increase/internal/type/converter.rb @@ -98,6 +98,33 @@ def type_info(spec) end end + # @api private + # + # @param type_info [Hash{Symbol=>Object}, Proc, Increase::Internal::Type::Converter, Class] . + # + # @option type_info [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option type_info [Proc] :enum + # + # @option type_info [Proc] :union + # + # @option type_info [Boolean] :"nil?" + # + # @param spec [Hash{Symbol=>Object}, Proc, Increase::Internal::Type::Converter, Class] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [Hash{Symbol=>Object}] + def meta_info(type_info, spec) + [spec, type_info].grep(Hash).first.to_h.except(:const, :enum, :union, :nil?) + end + # @api private # # @param translate_names [Boolean] diff --git a/lib/increase/internal/type/hash_of.rb b/lib/increase/internal/type/hash_of.rb index e44cca977..099ebfa22 100644 --- a/lib/increase/internal/type/hash_of.rb +++ b/lib/increase/internal/type/hash_of.rb @@ -168,6 +168,7 @@ def to_sorbet_type # @option spec [Boolean] :"nil?" def initialize(type_info, spec = {}) @item_type_fn = Increase::Internal::Type::Converter.type_info(type_info || spec) + @meta = Increase::Internal::Type::Converter.meta_info(type_info, spec) @nilable = spec.fetch(:nil?, false) end diff --git a/lib/increase/internal/type/union.rb b/lib/increase/internal/type/union.rb index 1c23bae58..3dfbef70b 100644 --- a/lib/increase/internal/type/union.rb +++ b/lib/increase/internal/type/union.rb @@ -12,20 +12,20 @@ module Union # # All of the specified variant info for this union. # - # @return [Array] + # @return [ArrayObject})>] private def known_variants = (@known_variants ||= []) # @api private # - # @return [Array] + # @return [ArrayObject})>] protected def derefed_variants - known_variants.map { |key, variant_fn| [key, variant_fn.call] } + known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] } end # All of the specified variants for this union. # # @return [Array] - def variants = derefed_variants.map(&:last) + def variants = derefed_variants.map { _2 } # @api private # @@ -51,12 +51,13 @@ def variants = derefed_variants.map(&:last) # # @option spec [Boolean] :"nil?" private def variant(key, spec = nil) + meta = Increase::Internal::Type::Converter.meta_info(nil, spec) variant_info = case key in Symbol - [key, Increase::Internal::Type::Converter.type_info(spec)] + [key, Increase::Internal::Type::Converter.type_info(spec), meta] in Proc | Increase::Internal::Type::Converter | Class | Hash - [nil, Increase::Internal::Type::Converter.type_info(key)] + [nil, Increase::Internal::Type::Converter.type_info(key), meta] end known_variants << variant_info @@ -79,7 +80,8 @@ def variants = derefed_variants.map(&:last) return nil if key == Increase::Internal::OMIT key = key.to_sym if key.is_a?(String) - known_variants.find { |k,| k == key }&.last&.call + _, found = known_variants.find { |k,| k == key } + found&.call else nil end diff --git a/lib/increase/models/inbound_wire_transfer.rb b/lib/increase/models/inbound_wire_transfer.rb index bc32d12a4..36f922fad 100644 --- a/lib/increase/models/inbound_wire_transfer.rb +++ b/lib/increase/models/inbound_wire_transfer.rb @@ -166,7 +166,13 @@ class InboundWireTransfer < Increase::Internal::Type::BaseModel # @return [Symbol, Increase::Models::InboundWireTransfer::Type] required :type, enum: -> { Increase::InboundWireTransfer::Type } - # @!method initialize(id:, account_id:, account_number_id:, amount:, beneficiary_address_line1:, beneficiary_address_line2:, beneficiary_address_line3:, beneficiary_name:, beneficiary_reference:, created_at:, description:, input_message_accountability_data:, originator_address_line1:, originator_address_line2:, originator_address_line3:, originator_name:, originator_routing_number:, originator_to_beneficiary_information:, originator_to_beneficiary_information_line1:, originator_to_beneficiary_information_line2:, originator_to_beneficiary_information_line3:, originator_to_beneficiary_information_line4:, reversal:, sender_reference:, status:, type:) + # @!attribute wire_drawdown_request_id + # The wire drawdown request the inbound wire transfer is fulfilling. + # + # @return [String, nil] + required :wire_drawdown_request_id, String, nil?: true + + # @!method initialize(id:, account_id:, account_number_id:, amount:, beneficiary_address_line1:, beneficiary_address_line2:, beneficiary_address_line3:, beneficiary_name:, beneficiary_reference:, created_at:, description:, input_message_accountability_data:, originator_address_line1:, originator_address_line2:, originator_address_line3:, originator_name:, originator_routing_number:, originator_to_beneficiary_information:, originator_to_beneficiary_information_line1:, originator_to_beneficiary_information_line2:, originator_to_beneficiary_information_line3:, originator_to_beneficiary_information_line4:, reversal:, sender_reference:, status:, type:, wire_drawdown_request_id:) # Some parameter documentations has been truncated, see # {Increase::Models::InboundWireTransfer} for more details. # @@ -224,6 +230,8 @@ class InboundWireTransfer < Increase::Internal::Type::BaseModel # @param status [Symbol, Increase::Models::InboundWireTransfer::Status] The status of the transfer. # # @param type [Symbol, Increase::Models::InboundWireTransfer::Type] A constant representing the object's type. For this resource it will always be ` + # + # @param wire_drawdown_request_id [String, nil] The wire drawdown request the inbound wire transfer is fulfilling. # @see Increase::Models::InboundWireTransfer#reversal class Reversal < Increase::Internal::Type::BaseModel diff --git a/lib/increase/version.rb b/lib/increase/version.rb index 9fa17ea72..a027a47b2 100644 --- a/lib/increase/version.rb +++ b/lib/increase/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Increase - VERSION = "1.28.0" + VERSION = "1.29.0" end diff --git a/rbi/increase/internal/type/converter.rbi b/rbi/increase/internal/type/converter.rbi index b2f2d9a93..c16a4982f 100644 --- a/rbi/increase/internal/type/converter.rbi +++ b/rbi/increase/internal/type/converter.rbi @@ -90,6 +90,60 @@ module Increase def self.type_info(spec) end + # @api private + sig do + params( + type_info: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns( + Increase::Internal::Type::Converter::Input + ) + ), + union: + T.nilable( + T.proc.returns( + Increase::Internal::Type::Converter::Input + ) + ) + }, + T.proc.returns(Increase::Internal::Type::Converter::Input), + Increase::Internal::Type::Converter::Input + ), + spec: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns( + Increase::Internal::Type::Converter::Input + ) + ), + union: + T.nilable( + T.proc.returns( + Increase::Internal::Type::Converter::Input + ) + ) + }, + T.proc.returns(Increase::Internal::Type::Converter::Input), + Increase::Internal::Type::Converter::Input + ) + ).returns(Increase::Internal::AnyHash) + end + def self.meta_info(type_info, spec) + end + # @api private sig do params(translate_names: T::Boolean).returns( diff --git a/rbi/increase/internal/type/union.rbi b/rbi/increase/internal/type/union.rbi index 03d91aee5..eb44e2db7 100644 --- a/rbi/increase/internal/type/union.rbi +++ b/rbi/increase/internal/type/union.rbi @@ -16,7 +16,8 @@ module Increase T::Array[ [ T.nilable(Symbol), - T.proc.returns(Increase::Internal::Type::Converter::Input) + T.proc.returns(Increase::Internal::Type::Converter::Input), + Increase::Internal::AnyHash ] ] ) @@ -25,7 +26,13 @@ module Increase end # @api private - sig { returns(T::Array[[T.nilable(Symbol), T.anything]]) } + sig do + returns( + T::Array[ + [T.nilable(Symbol), T.anything, Increase::Internal::AnyHash] + ] + ) + end protected def derefed_variants end diff --git a/rbi/increase/models/inbound_wire_transfer.rbi b/rbi/increase/models/inbound_wire_transfer.rbi index aa12ebbc9..65efeea99 100644 --- a/rbi/increase/models/inbound_wire_transfer.rbi +++ b/rbi/increase/models/inbound_wire_transfer.rbi @@ -125,6 +125,10 @@ module Increase sig { returns(Increase::InboundWireTransfer::Type::TaggedSymbol) } attr_accessor :type + # The wire drawdown request the inbound wire transfer is fulfilling. + sig { returns(T.nilable(String)) } + attr_accessor :wire_drawdown_request_id + # An Inbound Wire Transfer is a wire transfer initiated outside of Increase to # your account. sig do @@ -154,7 +158,8 @@ module Increase reversal: T.nilable(Increase::InboundWireTransfer::Reversal::OrHash), sender_reference: T.nilable(String), status: Increase::InboundWireTransfer::Status::OrSymbol, - type: Increase::InboundWireTransfer::Type::OrSymbol + type: Increase::InboundWireTransfer::Type::OrSymbol, + wire_drawdown_request_id: T.nilable(String) ).returns(T.attached_class) end def self.new( @@ -215,7 +220,9 @@ module Increase status:, # A constant representing the object's type. For this resource it will always be # `inbound_wire_transfer`. - type: + type:, + # The wire drawdown request the inbound wire transfer is fulfilling. + wire_drawdown_request_id: ) end @@ -247,7 +254,8 @@ module Increase reversal: T.nilable(Increase::InboundWireTransfer::Reversal), sender_reference: T.nilable(String), status: Increase::InboundWireTransfer::Status::TaggedSymbol, - type: Increase::InboundWireTransfer::Type::TaggedSymbol + type: Increase::InboundWireTransfer::Type::TaggedSymbol, + wire_drawdown_request_id: T.nilable(String) } ) end diff --git a/scripts/mock b/scripts/mock index d2814ae6a..0b28f6ea2 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" fi diff --git a/scripts/test b/scripts/test index 8e5d35cdf..e0dc13741 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! prism_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the prism command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" echo exit 1 diff --git a/sig/increase/internal/type/converter.rbs b/sig/increase/internal/type/converter.rbs index 1823ba30d..f330851c2 100644 --- a/sig/increase/internal/type/converter.rbs +++ b/sig/increase/internal/type/converter.rbs @@ -39,6 +39,23 @@ module Increase | Increase::Internal::Type::Converter::input spec ) -> (^-> top) + def self.meta_info: ( + { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Increase::Internal::Type::Converter::input?, + union: ^-> Increase::Internal::Type::Converter::input? + } + | ^-> Increase::Internal::Type::Converter::input + | Increase::Internal::Type::Converter::input type_info, + { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Increase::Internal::Type::Converter::input?, + union: ^-> Increase::Internal::Type::Converter::input? + } + | ^-> Increase::Internal::Type::Converter::input + | Increase::Internal::Type::Converter::input spec + ) -> ::Hash[Symbol, top] + def self.new_coerce_state: ( ?translate_names: bool ) -> Increase::Internal::Type::Converter::coerce_state diff --git a/sig/increase/internal/type/union.rbs b/sig/increase/internal/type/union.rbs index 164c5f93e..b5c902c8e 100644 --- a/sig/increase/internal/type/union.rbs +++ b/sig/increase/internal/type/union.rbs @@ -5,9 +5,9 @@ module Increase include Increase::Internal::Type::Converter include Increase::Internal::Util::SorbetRuntimeSupport - private def self.known_variants: -> ::Array[[Symbol?, (^-> Increase::Internal::Type::Converter::input)]] + private def self.known_variants: -> ::Array[[Symbol?, (^-> Increase::Internal::Type::Converter::input), ::Hash[Symbol, top]]] - def self.derefed_variants: -> ::Array[[Symbol?, top]] + def self.derefed_variants: -> ::Array[[Symbol?, top, ::Hash[Symbol, top]]] def self.variants: -> ::Array[top] diff --git a/sig/increase/models/inbound_wire_transfer.rbs b/sig/increase/models/inbound_wire_transfer.rbs index 26694b23d..18a811f50 100644 --- a/sig/increase/models/inbound_wire_transfer.rbs +++ b/sig/increase/models/inbound_wire_transfer.rbs @@ -27,7 +27,8 @@ module Increase reversal: Increase::InboundWireTransfer::Reversal?, sender_reference: String?, status: Increase::Models::InboundWireTransfer::status, - type: Increase::Models::InboundWireTransfer::type_ + type: Increase::Models::InboundWireTransfer::type_, + wire_drawdown_request_id: String? } class InboundWireTransfer < Increase::Internal::Type::BaseModel @@ -83,6 +84,8 @@ module Increase attr_accessor type: Increase::Models::InboundWireTransfer::type_ + attr_accessor wire_drawdown_request_id: String? + def initialize: ( id: String, account_id: String, @@ -109,7 +112,8 @@ module Increase reversal: Increase::InboundWireTransfer::Reversal?, sender_reference: String?, status: Increase::Models::InboundWireTransfer::status, - type: Increase::Models::InboundWireTransfer::type_ + type: Increase::Models::InboundWireTransfer::type_, + wire_drawdown_request_id: String? ) -> void def to_hash: -> { @@ -138,7 +142,8 @@ module Increase reversal: Increase::InboundWireTransfer::Reversal?, sender_reference: String?, status: Increase::Models::InboundWireTransfer::status, - type: Increase::Models::InboundWireTransfer::type_ + type: Increase::Models::InboundWireTransfer::type_, + wire_drawdown_request_id: String? } type reversal = diff --git a/test/increase/internal/type/base_model_test.rb b/test/increase/internal/type/base_model_test.rb index bbb861a06..e165f78e2 100644 --- a/test/increase/internal/type/base_model_test.rb +++ b/test/increase/internal/type/base_model_test.rb @@ -687,3 +687,35 @@ def test_equality end end end + +class Increase::Test::MetaInfoTest < Minitest::Test + A1 = Increase::Internal::Type::ArrayOf[Integer, nil?: true, doc: "dog"] + H1 = Increase::Internal::Type::HashOf[-> { String }, nil?: true, doc: "dawg"] + + class M1 < Increase::Internal::Type::BaseModel + required :a, Integer, doc: "dog" + optional :b, -> { String }, nil?: true, doc: "dawg" + end + + module U1 + extend Increase::Internal::Type::Union + + variant -> { Integer }, const: 2, doc: "dog" + variant -> { String }, doc: "dawg" + end + + def test_meta_retrieval + m1 = A1.instance_variable_get(:@meta) + m2 = H1.instance_variable_get(:@meta) + assert_equal({doc: "dog"}, m1) + assert_equal({doc: "dawg"}, m2) + + ma, mb = M1.fields.fetch_values(:a, :b) + assert_equal({doc: "dog"}, ma.fetch(:meta)) + assert_equal({doc: "dawg"}, mb.fetch(:meta)) + + ua, ub = U1.send(:known_variants).map(&:last) + assert_equal({doc: "dog"}, ua) + assert_equal({doc: "dawg"}, ub) + end +end diff --git a/test/increase/resources/inbound_wire_transfers_test.rb b/test/increase/resources/inbound_wire_transfers_test.rb index 4843252cc..a2a01352c 100644 --- a/test/increase/resources/inbound_wire_transfers_test.rb +++ b/test/increase/resources/inbound_wire_transfers_test.rb @@ -37,7 +37,8 @@ def test_retrieve reversal: Increase::InboundWireTransfer::Reversal | nil, sender_reference: String | nil, status: Increase::InboundWireTransfer::Status, - type: Increase::InboundWireTransfer::Type + type: Increase::InboundWireTransfer::Type, + wire_drawdown_request_id: String | nil } end end @@ -83,7 +84,8 @@ def test_list reversal: Increase::InboundWireTransfer::Reversal | nil, sender_reference: String | nil, status: Increase::InboundWireTransfer::Status, - type: Increase::InboundWireTransfer::Type + type: Increase::InboundWireTransfer::Type, + wire_drawdown_request_id: String | nil } end end @@ -123,7 +125,8 @@ def test_reverse_required_params reversal: Increase::InboundWireTransfer::Reversal | nil, sender_reference: String | nil, status: Increase::InboundWireTransfer::Status, - type: Increase::InboundWireTransfer::Type + type: Increase::InboundWireTransfer::Type, + wire_drawdown_request_id: String | nil } end end diff --git a/test/increase/resources/simulations/inbound_wire_transfers_test.rb b/test/increase/resources/simulations/inbound_wire_transfers_test.rb index f4eb8bef9..9551a16d1 100644 --- a/test/increase/resources/simulations/inbound_wire_transfers_test.rb +++ b/test/increase/resources/simulations/inbound_wire_transfers_test.rb @@ -41,7 +41,8 @@ def test_create_required_params reversal: Increase::InboundWireTransfer::Reversal | nil, sender_reference: String | nil, status: Increase::InboundWireTransfer::Status, - type: Increase::InboundWireTransfer::Type + type: Increase::InboundWireTransfer::Type, + wire_drawdown_request_id: String | nil } end end