Skip to content
Open
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"
".": "0.2.0"
}
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ Metrics/BlockLength:
Metrics/ClassLength:
Enabled: false

Metrics/CollectionLiteralLength:
Exclude:
- "test/**/*"

Metrics/CyclomaticComplexity:
Enabled: false

Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## 0.2.0 (2025-11-21)

Full Changelog: [v0.1.0...v0.2.0](https://github.com/legalesign/legalesign-rest-ruby/compare/v0.1.0...v0.2.0)

### Features

* handle thread interrupts in the core HTTP client ([09fce02](https://github.com/legalesign/legalesign-rest-ruby/commit/09fce02cd46c70e62aaebe3ce5db31265ac07b57))


### Bug Fixes

* absolutely qualified uris should always override the default ([accbe51](https://github.com/legalesign/legalesign-rest-ruby/commit/accbe517d8b7e34580c59f0abca767efb910d9af))
* always send `filename=...` for multipart requests where a file is expected ([5813768](https://github.com/legalesign/legalesign-rest-ruby/commit/5813768c3908da5e30ea445a436b1717fadc0f5b))
* better thread safety via early initializing SSL store during HTTP client creation ([ed77883](https://github.com/legalesign/legalesign-rest-ruby/commit/ed77883cea949f67ab390ef3dac4c73bc0681d60))
* coroutine leaks from connection pool ([6c3463f](https://github.com/legalesign/legalesign-rest-ruby/commit/6c3463f441d4b806ef649968c6e6c8b21b2536cd))
* shorten multipart boundary sep to less than RFC specificed max length ([40b68db](https://github.com/legalesign/legalesign-rest-ruby/commit/40b68dbad30504b67d6b0414f0e3a6db5b744d5f))
* should not reuse buffers for `IO.copy_stream` interop ([a55c302](https://github.com/legalesign/legalesign-rest-ruby/commit/a55c302e8c10ecf93cea0fa83947a5aba26ec2b3))


### Performance Improvements

* faster code formatting ([965c16e](https://github.com/legalesign/legalesign-rest-ruby/commit/965c16efdfe71903a187923892a24a1ace2cede5))


### Chores

* allow fast-format to use bsd sed as well ([7761d66](https://github.com/legalesign/legalesign-rest-ruby/commit/7761d660ef68e49ac02068f322747682ba295fc2))
* bump dependency version and update sorbet types ([fd8d531](https://github.com/legalesign/legalesign-rest-ruby/commit/fd8d5314d47b22b912990c757931a1a4fda8da35))
* explicitly require "base64" gem ([ea768a1](https://github.com/legalesign/legalesign-rest-ruby/commit/ea768a157f48c9fc9ea665555d25371e07d7a6ed))
* ignore linter error for tests having large collections ([6680ab3](https://github.com/legalesign/legalesign-rest-ruby/commit/6680ab334e2a95d5b6b8d14fb1e98d5af4961da4))
* **internal:** codegen related update ([67df45b](https://github.com/legalesign/legalesign-rest-ruby/commit/67df45b7c847eb909ea593e9dd0832efdfdb1923))

## 0.1.0 (2025-09-23)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/legalesign/legalesign-rest-ruby/compare/v0.0.1...v0.1.0)
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ group :development do
gem "sorbet"
gem "steep"
gem "syntax_tree"
# TODO: using a fork for now, the prettier below has a bug
gem "syntax_tree-rbs", github: "stainless-api/syntax_tree-rbs", branch: "main"
gem "syntax_tree-rbs", github: "ruby-syntax-tree/syntax_tree-rbs", branch: "main"
gem "tapioca"
end

Expand Down
84 changes: 42 additions & 42 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/stainless-api/syntax_tree-rbs.git
revision: c30b50219918be7cfe3ef803a00b59d1e77fcada
remote: https://github.com/ruby-syntax-tree/syntax_tree-rbs.git
revision: f94bc3060682ffbd126e4d5086ffedc89073d626
branch: main
specs:
syntax_tree-rbs (1.0.0)
Expand All @@ -11,20 +11,20 @@ GIT
PATH
remote: .
specs:
legalesign-sdk (0.1.0)
legalesign-sdk (0.2.0)
connection_pool

GEM
remote: https://rubygems.org/
specs:
activesupport (8.0.2.1)
activesupport (8.1.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
Expand All @@ -33,22 +33,22 @@ GEM
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.3)
async (2.27.3)
async (2.34.0)
console (~> 1.29)
fiber-annotation
io-event (~> 1.11)
metrics (~> 0.12)
traces (~> 0.15)
traces (~> 0.18)
base64 (0.3.0)
benchmark (0.4.1)
bigdecimal (3.2.2)
benchmark (0.5.0)
bigdecimal (3.3.1)
concurrent-ruby (1.3.5)
connection_pool (2.5.3)
console (1.33.0)
connection_pool (2.5.4)
console (1.34.2)
fiber-annotation
fiber-local (~> 1.1)
json
crack (1.0.0)
crack (1.0.1)
bigdecimal
rexml
csv (3.3.5)
Expand All @@ -64,20 +64,20 @@ GEM
fiber-local (1.1.0)
fiber-storage
fiber-storage (1.0.1)
fileutils (1.7.3)
hashdiff (1.2.0)
fileutils (1.8.0)
hashdiff (1.2.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-event (1.11.2)
json (2.13.2)
json (2.15.2)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
metrics (0.13.0)
minitest (5.25.5)
metrics (0.15.0)
minitest (5.26.0)
minitest-focus (1.4.0)
minitest (>= 4, < 6)
minitest-hooks (1.5.2)
Expand All @@ -89,51 +89,51 @@ GEM
mutex_m (0.3.0)
netrc (0.11.0)
parallel (1.27.0)
parser (3.3.9.0)
parser (3.3.10.0)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
prism (1.4.0)
prism (1.6.0)
public_suffix (6.0.2)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.0)
rake (13.3.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rbi (0.3.6)
rbi (0.3.7)
prism (~> 1.0)
rbs (>= 3.4.4)
rbs (3.9.4)
rbs (3.9.5)
logger
redcarpet (3.6.1)
regexp_parser (2.11.2)
rexml (3.4.1)
rubocop (1.79.2)
regexp_parser (2.11.3)
rexml (3.4.4)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.46.0, < 2.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.46.0)
rubocop-ast (1.47.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
sorbet (0.5.12424)
sorbet-static (= 0.5.12424)
sorbet-runtime (0.5.12424)
sorbet-static (0.5.12424-aarch64-linux)
sorbet-static (0.5.12424-universal-darwin)
sorbet-static (0.5.12424-x86_64-linux)
sorbet-static-and-runtime (0.5.12424)
sorbet (= 0.5.12424)
sorbet-runtime (= 0.5.12424)
sorbet (0.6.12690)
sorbet-static (= 0.6.12690)
sorbet-runtime (0.6.12690)
sorbet-static (0.6.12690-aarch64-linux)
sorbet-static (0.6.12690-universal-darwin)
sorbet-static (0.6.12690-x86_64-linux)
sorbet-static-and-runtime (0.6.12690)
sorbet (= 0.6.12690)
sorbet-runtime (= 0.6.12690)
spoom (1.6.3)
erubi (>= 1.10.0)
prism (>= 0.28.0)
Expand Down Expand Up @@ -174,14 +174,14 @@ GEM
terminal-table (4.0.0)
unicode-display_width (>= 1.1.1, < 4)
thor (1.4.0)
traces (0.17.0)
traces (0.18.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (3.1.5)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
webmock (3.25.1)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
uri (1.1.0)
webmock (3.26.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down
2 changes: 1 addition & 1 deletion 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 "legalesign-sdk", "~> 0.1.0"
gem "legalesign-sdk", "~> 0.2.0"
```

<!-- x-release-please-end -->
Expand Down
28 changes: 20 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ tapioca = "sorbet/tapioca"
examples = "examples"
ignore_file = ".ignore"

FILES_ENV = "FORMAT_FILE"

CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc/], *FileList["*.gem"], ignore_file)

CLOBBER.push(*%w[sorbet/rbi/annotations/ sorbet/rbi/gems/], tapioca)
Expand All @@ -38,6 +40,14 @@ end
xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")}

filtered = ->(ext, dirs) do
if ENV.key?(FILES_ENV)
%w[sed -E -n -e] << "/\\.#{ext}$/p" << "--" << ENV.fetch(FILES_ENV)
else
(%w[find] + dirs + %w[-type f -and -name]) << "*.#{ext}" << "-print0"
end
end

desc("Lint `*.rb(i)`")
multitask(:"lint:rubocop") do
find = %w[find ./lib ./test ./rbi ./examples -type f -and ( -name *.rb -or -name *.rbi ) -print0]
Expand All @@ -52,24 +62,26 @@ multitask(:"lint:rubocop") do
sh("#{find.shelljoin} | #{lint.shelljoin}")
end

norm_lines = %w[tr -- \n \0].shelljoin

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 ./examples -type f -and -name *.rb -print0]
files = filtered["rb", %w[./lib ./test ./examples]]
fmt = xargs + %w[rubocop --fail-level F --autocorrect --format simple --]
sh("#{find.shelljoin} | #{fmt.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}")
end

desc("Format `*.rbi`")
multitask(:"format:rbi") do
find = %w[find ./rbi -type f -and -name *.rbi -print0]
files = filtered["rbi", %w[./rbi]]
fmt = xargs + %w[stree write --]
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}")
sh(ruby_opt, "#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}")
end

desc("Format `*.rbs`")
multitask(:"format:rbs") do
find = %w[find ./sig -type f -name *.rbs -print0]
files = filtered["rbs", %w[./sig]]
inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? ["-i", ""] : %w[-i]
uuid = SecureRandom.uuid

Expand Down Expand Up @@ -98,13 +110,13 @@ multitask(:"format:rbs") do
success = false

# transform class aliases to type aliases, which syntax tree has no trouble with
sh("#{find.shelljoin} | #{pre.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{pre.shelljoin}")
# run syntax tree to format `*.rbs` files
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}") do
sh(ruby_opt, "#{files.shelljoin} | #{norm_lines} | #{fmt.shelljoin}") do
success = _1
end
# transform type aliases back to class aliases
sh("#{find.shelljoin} | #{pst.shelljoin}")
sh("#{files.shelljoin} | #{norm_lines} | #{pst.shelljoin}")

# always run post-processing to remove comment marker
fail unless success
Expand Down
2 changes: 2 additions & 0 deletions lib/legalesign_sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
# Standard libraries.
# rubocop:disable Lint/RedundantRequireStatement
require "English"
require "base64"
require "cgi"
require "date"
require "erb"
require "etc"
require "json"
require "net/http"
require "openssl"
require "pathname"
require "rbconfig"
require "securerandom"
Expand Down
17 changes: 10 additions & 7 deletions lib/legalesign_sdk/file_part.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ def to_json(*a) = read.to_json(*a)
def to_yaml(*a) = read.to_yaml(*a)

# @param content [Pathname, StringIO, IO, String]
# @param filename [String, nil]
# @param filename [Pathname, String, nil]
# @param content_type [String, nil]
def initialize(content, filename: nil, content_type: nil)
@content = content
@content_type = content_type
@filename =
case content
in Pathname
filename.nil? ? content.basename.to_path : ::File.basename(filename)
case [filename, (@content = content)]
in [String | Pathname, _]
::File.basename(filename)
in [nil, Pathname]
content.basename.to_path
in [nil, IO]
content.to_path
else
filename.nil? ? nil : ::File.basename(filename)
filename
end
@content_type = content_type
end
end
end
8 changes: 7 additions & 1 deletion lib/legalesign_sdk/internal/transport/base_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ def initialize(
self.class::PLATFORM_HEADERS,
{
"accept" => "application/json",
"content-type" => "application/json"
"content-type" => "application/json",
"user-agent" => user_agent
},
headers
)
Expand All @@ -219,6 +220,11 @@ def initialize(
# @return [Hash{String=>String}]
private def auth_headers = {}

# @api private
#
# @return [String]
private def user_agent = "#{self.class.name}/Ruby #{LegalesignSDK::VERSION}"

# @api private
#
# @return [String]
Expand Down
Loading
Loading