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.52"
".": "0.1.0-alpha.53"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 170
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-b1839661d8405911184d5cb7230f16e626a616e5b744634bd7f0bb4e730bf899.yml
openapi_spec_hash: c1c2c5a5c2a4067a714b35f873e3846f
config_hash: 98214f2eab6804b5c0048331e32c08e3
configured_endpoints: 169
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-6432801dcf017d9234739b9f6153a8cfecd91255af4765f24ba5209f3e320b5c.yml
openapi_spec_hash: c2cfee2f044ba15d15b5bfdbd37280c0
config_hash: 8ac73ccdb428816c89c84802c794a3f8
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.1.0-alpha.53 (2025-10-23)

Full Changelog: [v0.1.0-alpha.52...v0.1.0-alpha.53](https://github.com/lithic-com/lithic-ruby/compare/v0.1.0-alpha.52...v0.1.0-alpha.53)

### Features

* **api:** updates to Auth Rules and Card provisioning ([fe22047](https://github.com/lithic-com/lithic-ruby/commit/fe22047b0689b63872eb7454cb4fc733aabe81cc))
* handle thread interrupts in the core HTTP client ([1f9867e](https://github.com/lithic-com/lithic-ruby/commit/1f9867e2708d86c52e212e11a55d04ef03410b5d))

## 0.1.0-alpha.52 (2025-10-15)

Full Changelog: [v0.1.0-alpha.51...v0.1.0-alpha.52](https://github.com/lithic-com/lithic-ruby/compare/v0.1.0-alpha.51...v0.1.0-alpha.52)
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:
lithic (0.1.0.pre.alpha.52)
lithic (0.1.0.pre.alpha.53)
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 "lithic", "~> 0.1.0.pre.alpha.52"
gem "lithic", "~> 0.1.0.pre.alpha.53"
```

<!-- x-release-please-end -->
Expand Down
3 changes: 1 addition & 2 deletions lib/lithic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@
require_relative "lithic/models/auth_rules/v2_list_response"
require_relative "lithic/models/auth_rules/v2_promote_params"
require_relative "lithic/models/auth_rules/v2_promote_response"
require_relative "lithic/models/auth_rules/v2_report_params"
require_relative "lithic/models/auth_rules/v2_report_response"
require_relative "lithic/models/auth_rules/v2_retrieve_features_params"
require_relative "lithic/models/auth_rules/v2_retrieve_features_response"
require_relative "lithic/models/auth_rules/v2_retrieve_params"
Expand Down Expand Up @@ -285,6 +283,7 @@
require_relative "lithic/models/payment_simulate_release_response"
require_relative "lithic/models/payment_simulate_return_params"
require_relative "lithic/models/payment_simulate_return_response"
require_relative "lithic/models/provision_response"
require_relative "lithic/models/reports/settlement/network_total_list_params"
require_relative "lithic/models/reports/settlement/network_total_list_response"
require_relative "lithic/models/reports/settlement/network_total_retrieve_params"
Expand Down
54 changes: 30 additions & 24 deletions lib/lithic/internal/transport/pooled_net_requester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,40 +128,48 @@ def execute(request)
url, deadline = request.fetch_values(:url, :deadline)

req = nil
eof = false
finished = false
closing = nil

# rubocop:disable Metrics/BlockLength
enum = Enumerator.new do |y|
next if finished

with_pool(url, deadline: deadline) do |conn|
req, closing = self.class.build_request(request) do
self.class.calibrate_socket_timeout(conn, deadline)
end

self.class.calibrate_socket_timeout(conn, deadline)
unless conn.started?
conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
conn.start
end
eof = false
closing = nil
::Thread.handle_interrupt(Object => :never) do
::Thread.handle_interrupt(Object => :immediate) do
req, closing = self.class.build_request(request) do
self.class.calibrate_socket_timeout(conn, deadline)
end

self.class.calibrate_socket_timeout(conn, deadline)
conn.request(req) do |rsp|
y << [req, rsp]
break if finished

rsp.read_body do |bytes|
y << bytes.force_encoding(Encoding::BINARY)
break if finished
self.class.calibrate_socket_timeout(conn, deadline)
unless conn.started?
conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
conn.start
end

self.class.calibrate_socket_timeout(conn, deadline)
conn.request(req) do |rsp|
y << [req, rsp]
break if finished

rsp.read_body do |bytes|
y << bytes.force_encoding(Encoding::BINARY)
break if finished

self.class.calibrate_socket_timeout(conn, deadline)
end
eof = true
end
end
ensure
begin
conn.finish if !eof && conn&.started?
ensure
closing&.call
end
eof = true
end
ensure
conn.finish if !eof && conn&.started?
end
rescue Timeout::Error
raise Lithic::Errors::APITimeoutError.new(url: url, request: req)
Expand All @@ -174,8 +182,6 @@ def execute(request)
body = Lithic::Internal::Util.fused_enum(enum, external: true) do
finished = true
loop { enum.next }
ensure
closing&.call
end
[Integer(response.code), response, body]
end
Expand Down
18 changes: 15 additions & 3 deletions lib/lithic/internal/type/union.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,27 @@ module Type
# @example
# # `account_activity_list_response` is a `Lithic::Models::AccountActivityListResponse`
# case account_activity_list_response
# when Lithic::Models::AccountActivityListResponse::FinancialTransaction
# when Lithic::Models::AccountActivityListResponse::Internal
# puts(account_activity_list_response.token)
# when Lithic::Models::AccountActivityListResponse::BookTransferTransaction
# when Lithic::BookTransferResponse
# puts(account_activity_list_response.category)
# when Lithic::Models::AccountActivityListResponse::CardTransaction
# when Lithic::Models::AccountActivityListResponse::Card
# # ...
# else
# puts(account_activity_list_response)
# end
#
# @example
# case account_activity_list_response
# in {family: :INTERNAL, token: token, category: category, created: created}
# puts(token)
# in {family: :TRANSFER, token: token, category: category, created: created}
# puts(category)
# in {family: :PAYMENT, token: token, category: category, created: created}
# puts(created)
# else
# puts(account_activity_list_response)
# end
module Union
include Lithic::Internal::Type::Converter
include Lithic::Internal::Util::SorbetRuntimeSupport
Expand Down
2 changes: 2 additions & 0 deletions lib/lithic/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ module Lithic

PaymentSimulateReturnParams = Lithic::Models::PaymentSimulateReturnParams

ProvisionResponse = Lithic::Models::ProvisionResponse

Reports = Lithic::Models::Reports

RequiredDocument = Lithic::Models::RequiredDocument
Expand Down
Loading