Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2b40219
chore(internal): version bump
stainless-app[bot] May 17, 2025
16ff9b3
chore: whitespaces
stainless-app[bot] May 20, 2025
9a84b92
fix: correctly instantiate sorbet type aliases for enums and unions
stainless-app[bot] May 20, 2025
37cc1c2
chore: use sorbet union aliases where available
stainless-app[bot] May 20, 2025
e0eb636
chore: refine Yard and Sorbet types and ensure linting is turned on f…
stainless-app[bot] May 20, 2025
0c55f26
chore(docs): grammar improvements
stainless-app[bot] May 21, 2025
2f00817
chore: force utf-8 locale via `RUBYOPT` when formatting
stainless-app[bot] May 21, 2025
98866d5
chore: use fully qualified names for yard annotations and rbs aliases
stainless-app[bot] May 22, 2025
68d04c3
feat(api): api update
stainless-app[bot] May 22, 2025
6e46c62
feat(api): api update
stainless-app[bot] May 22, 2025
31a6af6
codegen metadata
stainless-app[bot] May 23, 2025
6301929
fix: prevent rubocop from mangling `===` to `is_a?` check
stainless-app[bot] May 23, 2025
04cb830
codegen metadata
stainless-app[bot] May 23, 2025
79c1aee
codegen metadata
stainless-app[bot] May 27, 2025
4aaba62
fix: sorbet types for enums, and make tapioca detection ignore `tapio…
stainless-app[bot] May 27, 2025
86a6b54
codegen metadata
stainless-app[bot] May 27, 2025
529b41e
chore(tests): skip endpoints with basic auth
stainless-app[bot] May 28, 2025
2819280
fix: `to_sorbet_type` should not return branded types
stainless-app[bot] Jun 2, 2025
bb0bb58
fix(client): fix PayStatementResponse body
stainless-app[bot] Jun 4, 2025
2288848
fix: default content-type for text in multi-part formdata uploads sho…
stainless-app[bot] Jun 4, 2025
3774286
fix(client): manual fix
stainless-app[bot] Jun 4, 2025
6479e22
chore(ci): link to correct github repo
stainless-app[bot] Jun 11, 2025
055b260
feat(api): api update
stainless-app[bot] Jun 11, 2025
6a3cc47
feat(api): api update
stainless-app[bot] Jun 11, 2025
77fdc63
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
c4c0158
fix: issue where we cannot mutate arrays on base model derivatives
stainless-app[bot] Jun 18, 2025
c8801fd
release: 0.1.0-alpha.20
stainless-app[bot] Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to rubygems.org in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/Finch-API/finch-api-python/actions/workflows/publish-gem.yml
# You can run this workflow by navigating to https://www.github.com/Finch-API/finch-api-ruby/actions/workflows/publish-gem.yml
name: Publish Gem
on:
workflow_dispatch:
Expand Down
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.19"
".": "0.1.0-alpha.20"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 46
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-944a0f9d35f3b8ec2ba62fa12e551cf89f0b845f8ed1e3c7f67a9fb80b32d96f.yml
openapi_spec_hash: 37c849e7b5dd941c011385b49467e077
config_hash: 53778a0b839c4f6ad34fbba051f5e8a6
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-f7e741bc6e0175fd96a9db5348092b90a77b0985154c0814bb681ad5dccdf19a.yml
openapi_spec_hash: b348a9ef407a8e91dd770fcb219d4ac5
config_hash: 5146b12344dae76238940989dac1e8a0
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Changelog

## 0.1.0-alpha.20 (2025-06-18)

Full Changelog: [v0.1.0-alpha.19...v0.1.0-alpha.20](https://github.com/Finch-API/finch-api-ruby/compare/v0.1.0-alpha.19...v0.1.0-alpha.20)

### Features

* **api:** api update ([6a3cc47](https://github.com/Finch-API/finch-api-ruby/commit/6a3cc47713d3f52d84da946c1f86c328692a71f1))
* **api:** api update ([055b260](https://github.com/Finch-API/finch-api-ruby/commit/055b260f9607ea1c408510bf19c86390ba515b48))
* **api:** api update ([6e46c62](https://github.com/Finch-API/finch-api-ruby/commit/6e46c62b78b34d3944136bea9decd9254b9d7b2c))
* **api:** api update ([68d04c3](https://github.com/Finch-API/finch-api-ruby/commit/68d04c3e38f076254375ef4e1ea24383d7ff7aa2))


### Bug Fixes

* `to_sorbet_type` should not return branded types ([2819280](https://github.com/Finch-API/finch-api-ruby/commit/281928010fa852dd399354a4561191120e85ad00))
* **client:** fix PayStatementResponse body ([bb0bb58](https://github.com/Finch-API/finch-api-ruby/commit/bb0bb581ffc994714895363e21f461e2ec82676e))
* **client:** manual fix ([3774286](https://github.com/Finch-API/finch-api-ruby/commit/3774286f68227085e6f54396290e3de7569bba0d))
* correctly instantiate sorbet type aliases for enums and unions ([9a84b92](https://github.com/Finch-API/finch-api-ruby/commit/9a84b92df48e001ee28989703cbe8bdd9f461528))
* default content-type for text in multi-part formdata uploads should be text/plain ([2288848](https://github.com/Finch-API/finch-api-ruby/commit/2288848990739f298069c86ad90d915c1bd88c60))
* issue where we cannot mutate arrays on base model derivatives ([c4c0158](https://github.com/Finch-API/finch-api-ruby/commit/c4c01587e16d76f1c6b3f5a48414000954dc4805))
* prevent rubocop from mangling `===` to `is_a?` check ([6301929](https://github.com/Finch-API/finch-api-ruby/commit/6301929d697ae1c006446a12e6c67046e83ef132))
* sorbet types for enums, and make tapioca detection ignore `tapioca dsl` ([4aaba62](https://github.com/Finch-API/finch-api-ruby/commit/4aaba6261e6c92833ab6e46acb2e2652da843be9))


### Chores

* **ci:** enable for pull requests ([77fdc63](https://github.com/Finch-API/finch-api-ruby/commit/77fdc63fa78dd6356baf44cc3770902bfb83311b))
* **ci:** link to correct github repo ([6479e22](https://github.com/Finch-API/finch-api-ruby/commit/6479e2217a712d55aac84da1041a88efcbd4f1f2))
* **docs:** grammar improvements ([0c55f26](https://github.com/Finch-API/finch-api-ruby/commit/0c55f26abe131663cfe8e739b95154172d967085))
* force utf-8 locale via `RUBYOPT` when formatting ([2f00817](https://github.com/Finch-API/finch-api-ruby/commit/2f008175f0a18dc01a0c2b900c2e692f77b3a0ac))
* **internal:** version bump ([2b40219](https://github.com/Finch-API/finch-api-ruby/commit/2b4021961b248f64cb9c5564b4199d0c840593fd))
* refine Yard and Sorbet types and ensure linting is turned on for examples ([e0eb636](https://github.com/Finch-API/finch-api-ruby/commit/e0eb63695b803e35dd9e35a57cd0769a60db7bc7))
* **tests:** skip endpoints with basic auth ([529b41e](https://github.com/Finch-API/finch-api-ruby/commit/529b41ea3cf67b553d85e36a256cc5d6c4b13800))
* use fully qualified names for yard annotations and rbs aliases ([98866d5](https://github.com/Finch-API/finch-api-ruby/commit/98866d5133c2afb76b141045f1361705f9bac94a))
* use sorbet union aliases where available ([37cc1c2](https://github.com/Finch-API/finch-api-ruby/commit/37cc1c27968a448e7bfef8527a0f3105b476de09))
* whitespaces ([16ff9b3](https://github.com/Finch-API/finch-api-ruby/commit/16ff9b32a68eecb17c5719b354de64fe788bedd4))

## 0.1.0-alpha.19 (2025-05-16)

Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/Finch-API/finch-api-ruby/compare/v0.1.0-alpha.18...v0.1.0-alpha.19)
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:
finch-api (0.1.0.pre.alpha.18)
finch-api (0.1.0.pre.alpha.19)
connection_pool

GEM
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "finch-api", "~> 0.1.0.pre.alpha.19"
gem "finch-api", "~> 0.1.0.pre.alpha.20"
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -170,7 +170,7 @@ puts(page[:my_undocumented_property])

#### Undocumented request params

If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request as seen in examples above.
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.

#### Undocumented endpoints

Expand All @@ -188,7 +188,7 @@ response = client.request(

### Concurrency & connection pooling

The `FinchAPI::Client` instances are threadsafe, but only are fork-safe when there are no in-flight HTTP requests.
The `FinchAPI::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.

Each instance of `FinchAPI::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.

Expand Down Expand Up @@ -238,7 +238,7 @@ finch.hris.benefits.create(
# …
)

# Literal values is also permissible:
# Literal values are also permissible:
finch.hris.benefits.create(
frequency: :one_time,
# …
Expand Down
19 changes: 11 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require "rake/clean"
require "rubocop/rake_task"

tapioca = "sorbet/tapioca"
examples = "examples"
ignore_file = ".ignore"

CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc/], *FileList["*.gem"], ignore_file)
Expand All @@ -35,11 +36,11 @@ multitask(:test) do
end

xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
locale = {"LC_ALL" => "C.UTF-8"}
ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")}

desc("Lint `*.rb(i)`")
multitask(:"lint:rubocop") do
find = %w[find ./lib ./test ./rbi -type f -and ( -name *.rb -or -name *.rbi ) -print0]
find = %w[find ./lib ./test ./rbi ./examples -type f -and ( -name *.rb -or -name *.rbi ) -print0]

rubocop = %w[rubocop]
rubocop += %w[--format github] if ENV.key?("CI")
Expand All @@ -54,7 +55,7 @@ end
desc("Format `*.rb`")
multitask(:"format:rb") do
# while `syntax_tree` is much faster than `rubocop`, `rubocop` is the only formatter with full syntax support
find = %w[find ./lib ./test -type f -and -name *.rb -print0]
find = %w[find ./lib ./test ./examples -type f -and -name *.rb -print0]
fmt = xargs + %w[rubocop --fail-level F --autocorrect --format simple --]
sh("#{find.shelljoin} | #{fmt.shelljoin}")
end
Expand All @@ -63,7 +64,7 @@ desc("Format `*.rbi`")
multitask(:"format:rbi") do
find = %w[find ./rbi -type f -and -name *.rbi -print0]
fmt = xargs + %w[stree write --]
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}")
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}")
end

desc("Format `*.rbs`")
Expand Down Expand Up @@ -99,7 +100,7 @@ multitask(:"format:rbs") do
# transform class aliases to type aliases, which syntax tree has no trouble with
sh("#{find.shelljoin} | #{pre.shelljoin}")
# run syntax tree to format `*.rbs` files
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}") do
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}") do
success = _1
end
# transform type aliases back to class aliases
Expand All @@ -117,12 +118,14 @@ multitask(:"typecheck:steep") do
sh(*%w[steep check])
end

directory(examples)

desc("Typecheck `*.rbi`")
multitask(:"typecheck:sorbet") do
sh(*%w[srb typecheck])
multitask("typecheck:sorbet": examples) do
sh(*%w[srb typecheck --dir], examples)
end

file(tapioca) do
directory(tapioca) do
sh(*%w[tapioca init])
end

Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Finch please follow the respective company's security reporting guidelines.
or products provided by Finch, please follow the respective company's security reporting guidelines.

### Finch Terms and Policies

Please contact founders@tryfinch.com for any questions or concerns regarding security of our services.
Please contact founders@tryfinch.com for any questions or concerns regarding the security of our services.

---

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
6 changes: 4 additions & 2 deletions lib/finch_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

# We already ship the preferred sorbet manifests in the package itself.
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
if Object.const_defined?(:Tapioca) && caller.chain([$PROGRAM_NAME]).chain(ARGV).grep(/tapioca/)
if Object.const_defined?(:Tapioca) &&
caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) &&
ARGV.none?(/dsl/)
return
end

Expand Down Expand Up @@ -74,7 +76,6 @@
require_relative "finch_api/models/hris/benefit_frequency"
require_relative "finch_api/models/hris/benefit_list_params"
require_relative "finch_api/models/hris/benefit_list_supported_benefits_params"
require_relative "finch_api/models/hris/benefit_list_supported_benefits_response"
require_relative "finch_api/models/hris/benefit_retrieve_params"
require_relative "finch_api/models/hris/benefits/enrolled_individual_benefit_response"
require_relative "finch_api/models/hris/benefits/individual_benefit"
Expand Down Expand Up @@ -119,6 +120,7 @@
require_relative "finch_api/models/hris/payment"
require_relative "finch_api/models/hris/payment_list_params"
require_relative "finch_api/models/hris/pay_statement"
require_relative "finch_api/models/hris/pay_statement_data_sync_in_progress"
require_relative "finch_api/models/hris/pay_statement_response"
require_relative "finch_api/models/hris/pay_statement_response_body"
require_relative "finch_api/models/hris/pay_statement_retrieve_many_params"
Expand Down
22 changes: 22 additions & 0 deletions lib/finch_api/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@ class Error < StandardError
end

class ConversionError < FinchAPI::Errors::Error
# @return [StandardError, nil]
def cause = @cause.nil? ? super : @cause

# @api private
#
# @param on [Class<StandardError>]
# @param method [Symbol]
# @param target [Object]
# @param value [Object]
# @param cause [StandardError, nil]
def initialize(on:, method:, target:, value:, cause: nil)
cls = on.name.split("::").last

message = [
"Failed to parse #{cls}.#{method} from #{value.class} to #{target.inspect}.",
"To get the unparsed API response, use #{cls}[#{method.inspect}].",
cause && "Cause: #{cause.message}"
].filter(&:itself).join(" ")

@cause = cause
super(message)
end
end

class APIError < FinchAPI::Errors::Error
Expand Down
3 changes: 3 additions & 0 deletions lib/finch_api/internal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ module Internal
define_sorbet_constant!(:AnyHash) do
T.type_alias { T::Hash[Symbol, T.anything] }
end
define_sorbet_constant!(:FileInput) do
T.type_alias { T.any(Pathname, StringIO, IO, String, FinchAPI::FilePart) }
end
end
end
2 changes: 1 addition & 1 deletion lib/finch_api/internal/individuals_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IndividualsPage
# @return [Array<generic<Elem>>, nil]
attr_accessor :individuals

# @return [FinchAPI::Paging]
# @return [FinchAPI::Models::Paging]
attr_accessor :paging

# @return [Boolean]
Expand Down
2 changes: 1 addition & 1 deletion lib/finch_api/internal/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Page
# @return [Array<generic<Elem>>, nil]
attr_accessor :data

# @return [FinchAPI::Paging]
# @return [FinchAPI::Models::Paging]
attr_accessor :paging

# @return [Boolean]
Expand Down
15 changes: 14 additions & 1 deletion lib/finch_api/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 FinchAPI::Internal::Type::Converter
include FinchAPI::Internal::Util::SorbetRuntimeSupport

private_class_method :new

Expand Down Expand Up @@ -61,10 +62,14 @@ def hash = [self.class, item_type].hash
#
# @param state [Hash{Symbol=>Object}] .
#
# @option state [Boolean, :strong] :strictness
# @option state [Boolean] :translate_names
#
# @option state [Boolean] :strictness
#
# @option state [Hash{Symbol=>Object}] :exactness
#
# @option state [Class<StandardError>] :error
#
# @option state [Integer] :branched
#
# @return [Array<Object>, Object]
Expand All @@ -73,6 +78,7 @@ def coerce(value, state:)

unless value.is_a?(Array)
exactness[:no] += 1
state[:error] = TypeError.new("#{value.class} can't be coerced into #{Array}")
return value
end

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

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

# @api private
#
# @return [generic<Elem>]
Expand Down
Loading