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 @@
{
".": "1.79.0"
".": "1.80.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 217
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-61210b27ac135ed841515ad3c3dfedaf42dc1398b0a3ed63bbd6c154d1b31a6a.yml
openapi_spec_hash: b0d2957f6269776252f0ddaa6489772a
config_hash: e1885b38eded054b77308a024c5d80cc
configured_endpoints: 213
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-fc17d091731928c882b2272ea5de831cafcbf237a7887652a5f133c29cb1bbc4.yml
openapi_spec_hash: aad429d087b7557be4103d1309cd81a0
config_hash: e1e8bc2138a13f290956ae6687f099cd
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.80.0 (2025-09-17)

Full Changelog: [v1.79.0...v1.80.0](https://github.com/Increase/increase-ruby/compare/v1.79.0...v1.80.0)

### Features

* **api:** api update ([d16cb6a](https://github.com/Increase/increase-ruby/commit/d16cb6abc1e6f4ca71d86374cde091360d657602))
* expose response headers for both streams and errors ([17ddacf](https://github.com/Increase/increase-ruby/commit/17ddacf1c78a6f3e52a2f007d8efebab892db46e))

## 1.79.0 (2025-09-17)

Full Changelog: [v1.78.0...v1.79.0](https://github.com/Increase/increase-ruby/compare/v1.78.0...v1.79.0)
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 (1.79.0)
increase (1.80.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 "increase", "~> 1.79.0"
gem "increase", "~> 1.80.0"
```

<!-- x-release-please-end -->
Expand Down
7 changes: 0 additions & 7 deletions lib/increase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@
require_relative "increase/models/card_create_params"
require_relative "increase/models/card_details"
require_relative "increase/models/card_details_params"
require_relative "increase/models/card_dispute"
require_relative "increase/models/card_dispute_create_params"
require_relative "increase/models/card_dispute_list_params"
require_relative "increase/models/card_dispute_retrieve_params"
require_relative "increase/models/card_iframe_url"
require_relative "increase/models/card_list_params"
require_relative "increase/models/card_payment"
Expand Down Expand Up @@ -284,7 +280,6 @@
require_relative "increase/models/simulations/card_authorization_create_params"
require_relative "increase/models/simulations/card_authorization_create_response"
require_relative "increase/models/simulations/card_authorization_expiration_create_params"
require_relative "increase/models/simulations/card_dispute_action_params"
require_relative "increase/models/simulations/card_fuel_confirmation_create_params"
require_relative "increase/models/simulations/card_increment_create_params"
require_relative "increase/models/simulations/card_refund_create_params"
Expand Down Expand Up @@ -339,7 +334,6 @@
require_relative "increase/resources/bookkeeping_accounts"
require_relative "increase/resources/bookkeeping_entries"
require_relative "increase/resources/bookkeeping_entry_sets"
require_relative "increase/resources/card_disputes"
require_relative "increase/resources/card_payments"
require_relative "increase/resources/card_purchase_supplements"
require_relative "increase/resources/card_push_transfers"
Expand Down Expand Up @@ -386,7 +380,6 @@
require_relative "increase/resources/simulations/ach_transfers"
require_relative "increase/resources/simulations/card_authorization_expirations"
require_relative "increase/resources/simulations/card_authorizations"
require_relative "increase/resources/simulations/card_disputes"
require_relative "increase/resources/simulations/card_fuel_confirmations"
require_relative "increase/resources/simulations/card_increments"
require_relative "increase/resources/simulations/card_refunds"
Expand Down
4 changes: 0 additions & 4 deletions lib/increase/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class Client < Increase::Internal::Transport::BaseClient
# @return [Increase::Resources::CardPurchaseSupplements]
attr_reader :card_purchase_supplements

# @return [Increase::Resources::CardDisputes]
attr_reader :card_disputes

# @return [Increase::Resources::PhysicalCards]
attr_reader :physical_cards

Expand Down Expand Up @@ -256,7 +253,6 @@ def initialize(
@cards = Increase::Resources::Cards.new(client: self)
@card_payments = Increase::Resources::CardPayments.new(client: self)
@card_purchase_supplements = Increase::Resources::CardPurchaseSupplements.new(client: self)
@card_disputes = Increase::Resources::CardDisputes.new(client: self)
@physical_cards = Increase::Resources::PhysicalCards.new(client: self)
@digital_card_profiles = Increase::Resources::DigitalCardProfiles.new(client: self)
@physical_card_profiles = Increase::Resources::PhysicalCardProfiles.new(client: self)
Expand Down
36 changes: 25 additions & 11 deletions lib/increase/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,25 @@ class APIError < Increase::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 < Increase::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 < Increase::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 < Increase::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 = Increase::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, Increase::Errors::InvalidParametersError::TYPE]
Expand Down Expand Up @@ -185,15 +197,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
2 changes: 1 addition & 1 deletion lib/increase/internal/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def auto_paging_each(&blk)
#
# @param client [Increase::Internal::Transport::BaseClient]
# @param req [Hash{Symbol=>Object}]
# @param headers [Hash{String=>String}, Net::HTTPHeader]
# @param headers [Hash{String=>String}]
# @param page_data [Hash{Symbol=>Object}]
def initialize(client:, req:, headers:, page_data:)
super
Expand Down
18 changes: 11 additions & 7 deletions lib/increase/internal/transport/base_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def validate!(req)
# @api private
#
# @param status [Integer]
# @param headers [Hash{String=>String}, Net::HTTPHeader]
# @param headers [Hash{String=>String}]
#
# @return [Boolean]
def should_retry?(status, headers:)
Expand Down Expand Up @@ -85,7 +85,7 @@ def should_retry?(status, headers:)
#
# @param status [Integer]
#
# @param response_headers [Hash{String=>String}, Net::HTTPHeader]
# @param response_headers [Hash{String=>String}]
#
# @return [Hash{Symbol=>Object}]
def follow_redirect(request, status:, response_headers:)
Expand Down Expand Up @@ -378,6 +378,7 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:)
rescue Increase::Errors::APIConnectionError => e
status = e
end
headers = Increase::Internal::Util.normalized_headers(response&.each_header&.to_h)

case status
in ..299
Expand All @@ -390,7 +391,7 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:)
in 300..399
self.class.reap_connection!(status, stream: stream)

request = self.class.follow_redirect(request, status: status, response_headers: response)
request = self.class.follow_redirect(request, status: status, response_headers: headers)
send_request(
request,
redirect_count: redirect_count + 1,
Expand All @@ -399,16 +400,17 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:)
)
in Increase::Errors::APIConnectionError if retry_count >= max_retries
raise status
in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: response)
in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: headers)
decoded = Kernel.then do
Increase::Internal::Util.decode_content(response, stream: stream, suppress_error: true)
Increase::Internal::Util.decode_content(headers, stream: stream, suppress_error: true)
ensure
self.class.reap_connection!(status, stream: stream)
end

raise Increase::Errors::APIStatusError.for(
url: url,
status: status,
headers: headers,
body: decoded,
request: nil,
response: response
Expand Down Expand Up @@ -485,19 +487,21 @@ def request(req)
send_retry_header: send_retry_header
)

decoded = Increase::Internal::Util.decode_content(response, stream: stream)
headers = Increase::Internal::Util.normalized_headers(response.each_header.to_h)
decoded = Increase::Internal::Util.decode_content(headers, stream: stream)
case req
in {stream: Class => st}
st.new(
model: model,
url: url,
status: status,
headers: headers,
response: response,
unwrap: unwrap,
stream: decoded
)
in {page: Class => page}
page.new(client: self, req: req, headers: response, page_data: decoded)
page.new(client: self, req: req, headers: headers, page_data: decoded)
else
unwrapped = Increase::Internal::Util.dig(decoded, unwrap)
Increase::Internal::Type::Converter.coerce(model, unwrapped)
Expand Down
2 changes: 1 addition & 1 deletion lib/increase/internal/type/base_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def to_enum = super(:auto_paging_each)
#
# @param client [Increase::Internal::Transport::BaseClient]
# @param req [Hash{Symbol=>Object}]
# @param headers [Hash{String=>String}, Net::HTTPHeader]
# @param headers [Hash{String=>String}]
# @param page_data [Object]
def initialize(client:, req:, headers:, page_data:)
@client = client
Expand Down
2 changes: 1 addition & 1 deletion lib/increase/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def force_charset!(content_type, text:)
#
# Assumes each chunk in stream has `Encoding::BINARY`.
#
# @param headers [Hash{String=>String}, Net::HTTPHeader]
# @param headers [Hash{String=>String}]
# @param stream [Enumerable<String>]
# @param suppress_error [Boolean]
#
Expand Down
8 changes: 0 additions & 8 deletions lib/increase/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,6 @@ module Increase

CardDetailsParams = Increase::Models::CardDetailsParams

CardDispute = Increase::Models::CardDispute

CardDisputeCreateParams = Increase::Models::CardDisputeCreateParams

CardDisputeListParams = Increase::Models::CardDisputeListParams

CardDisputeRetrieveParams = Increase::Models::CardDisputeRetrieveParams

CardIframeURL = Increase::Models::CardIframeURL

CardListParams = Increase::Models::CardListParams
Expand Down
Loading