Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
configured_endpoints: 238
openapi_spec_hash: fa67b808ca579e929aea7dd917b18cf9
config_hash: 2ae0d8aaecf01b38cbf9f9e112822c23
configured_endpoints: 239
openapi_spec_hash: 202e0c39463e4ad1b25a72b0da68a6ce
config_hash: 1ca082e374ef7000e2a5971e8da740e0
1 change: 1 addition & 0 deletions lib/increase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
require_relative "increase/models/fednow_transfer_list_params"
require_relative "increase/models/fednow_transfer_retrieve_params"
require_relative "increase/models/file"
require_relative "increase/models/file_contents_params"
require_relative "increase/models/file_create_params"
require_relative "increase/models/file_link"
require_relative "increase/models/file_link_create_params"
Expand Down
41 changes: 5 additions & 36 deletions lib/increase/internal/transport/base_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ class BaseClient
# from whatwg fetch spec
MAX_REDIRECTS = 20

# rubocop:disable Style/MutableConstant
PLATFORM_HEADERS =
{
"x-stainless-arch" => Increase::Internal::Util.arch,
"x-stainless-lang" => "ruby",
"x-stainless-os" => Increase::Internal::Util.os,
"x-stainless-package-version" => Increase::VERSION,
"x-stainless-runtime" => ::RUBY_ENGINE,
"x-stainless-runtime-version" => ::RUBY_ENGINE_VERSION
}
# rubocop:enable Style/MutableConstant

class << self
# @api private
#
Expand Down Expand Up @@ -198,7 +186,6 @@ def initialize(
)
@requester = Increase::Internal::Transport::PooledNetRequester.new
@headers = Increase::Internal::Util.normalized_headers(
self.class::PLATFORM_HEADERS,
{
"accept" => "application/json",
"content-type" => "application/json",
Expand Down Expand Up @@ -287,14 +274,7 @@ def initialize(
headers[@idempotency_header] = opts.fetch(:idempotency_key) { generate_idempotency_key }
end

unless headers.key?("x-stainless-retry-count")
headers["x-stainless-retry-count"] = "0"
end

timeout = opts.fetch(:timeout, @timeout).to_f.clamp(0..)
unless headers.key?("x-stainless-timeout") || timeout.zero?
headers["x-stainless-timeout"] = timeout.to_s
end

headers.reject! { |_, v| v.to_s.empty? }

Expand Down Expand Up @@ -369,18 +349,12 @@ def initialize(
#
# @param retry_count [Integer]
#
# @param send_retry_header [Boolean]
#
# @raise [Increase::Errors::APIError]
# @return [Array(Integer, Net::HTTPResponse, Enumerable<String>)]
def send_request(request, redirect_count:, retry_count:, send_retry_header:)
url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout)
def send_request(request, redirect_count:, retry_count:)
url, max_retries, timeout = request.fetch_values(:url, :max_retries, :timeout)
input = {**request.except(:timeout), deadline: Increase::Internal::Util.monotonic_secs + timeout}

if send_retry_header
headers["x-stainless-retry-count"] = retry_count.to_s
end

begin
status, response, stream = @requester.execute(input)
rescue Increase::Errors::APIConnectionError => e
Expand All @@ -403,8 +377,7 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:)
send_request(
request,
redirect_count: redirect_count + 1,
retry_count: retry_count,
send_retry_header: send_retry_header
retry_count: retry_count
)
in Increase::Errors::APIConnectionError if retry_count >= max_retries
raise status
Expand Down Expand Up @@ -432,8 +405,7 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:)
send_request(
request,
redirect_count: redirect_count,
retry_count: retry_count + 1,
send_retry_header: send_retry_header
retry_count: retry_count + 1
)
end
end
Expand Down Expand Up @@ -486,13 +458,10 @@ def request(req)
request = build_request(req.except(:options), opts)
url = request.fetch(:url)

# Don't send the current retry count in the headers if the caller modified the header defaults.
send_retry_header = request.fetch(:headers)["x-stainless-retry-count"] == "0"
status, response, stream = send_request(
request,
redirect_count: 0,
retry_count: 0,
send_retry_header: send_retry_header
retry_count: 0
)

headers = Increase::Internal::Util.normalized_headers(response.each_header.to_h)
Expand Down
2 changes: 2 additions & 0 deletions lib/increase/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ module Increase

File = Increase::Models::File

FileContentsParams = Increase::Models::FileContentsParams

FileCreateParams = Increase::Models::FileCreateParams

FileLink = Increase::Models::FileLink
Expand Down
21 changes: 9 additions & 12 deletions lib/increase/models/beneficial_owner_create_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,18 @@ class Address < Increase::Internal::Type::BaseModel
# @return [String]
required :city, String

# @!attribute country
# The two-letter ISO 3166-1 alpha-2 code for the country of the address.
#
# @return [String]
required :country, String

# @!attribute line1
# The first line of the address. This is usually the street number and street.
#
# @return [String]
required :line1, String

# @!attribute country
# The two-letter ISO 3166-1 alpha-2 code for the country of the address. Defaults
# to `US`.
#
# @return [String, nil]
optional :country, String

# @!attribute line2
# The second line of the address. This might be the floor or room number.
#
Expand All @@ -147,17 +146,15 @@ class Address < Increase::Internal::Type::BaseModel
# @return [String, nil]
optional :zip, String

# @!method initialize(city:, line1:, country: nil, line2: nil, state: nil, zip: nil)
# @!method initialize(city:, country:, line1:, line2: nil, state: nil, zip: nil)
# The individual's physical address. Mail receiving locations like PO Boxes and
# PMB's are disallowed.
#
# @param city [String] The city, district, town, or village of the address.
#
# @param line1 [String] The first line of the address. This is usually the street number and street.
# @param country [String] The two-letter ISO 3166-1 alpha-2 code for the country of the address.
#
# @param country [String]
# The two-letter ISO 3166-1 alpha-2 code for the country of the address. Defaults
# to `US`.
# @param line1 [String] The first line of the address. This is usually the street number and street.
#
# @param line2 [String] The second line of the address. This might be the floor or room number.
#
Expand Down
21 changes: 9 additions & 12 deletions lib/increase/models/beneficial_owner_update_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,18 @@ class Address < Increase::Internal::Type::BaseModel
# @return [String]
required :city, String

# @!attribute country
# The two-letter ISO 3166-1 alpha-2 code for the country of the address.
#
# @return [String]
required :country, String

# @!attribute line1
# The first line of the address. This is usually the street number and street.
#
# @return [String]
required :line1, String

# @!attribute country
# The two-letter ISO 3166-1 alpha-2 code for the country of the address. Defaults
# to `US`.
#
# @return [String, nil]
optional :country, String

# @!attribute line2
# The second line of the address. This might be the floor or room number.
#
Expand All @@ -116,17 +115,15 @@ class Address < Increase::Internal::Type::BaseModel
# @return [String, nil]
optional :zip, String

# @!method initialize(city:, line1:, country: nil, line2: nil, state: nil, zip: nil)
# @!method initialize(city:, country:, line1:, line2: nil, state: nil, zip: nil)
# The individual's physical address. Mail receiving locations like PO Boxes and
# PMB's are disallowed.
#
# @param city [String] The city, district, town, or village of the address.
#
# @param line1 [String] The first line of the address. This is usually the street number and street.
# @param country [String] The two-letter ISO 3166-1 alpha-2 code for the country of the address.
#
# @param country [String]
# The two-letter ISO 3166-1 alpha-2 code for the country of the address. Defaults
# to `US`.
# @param line1 [String] The first line of the address. This is usually the street number and street.
#
# @param line2 [String] The second line of the address. This might be the floor or room number.
#
Expand Down
Loading
Loading