Skip to content

Support multi-signer multipart send_document requests - #1

Merged
holtbp merged 2 commits into
EscrowSafe:mainfrom
holtbp:support-multi-signer-multipart
Jul 27, 2026
Merged

Support multi-signer multipart send_document requests#1
holtbp merged 2 commits into
EscrowSafe:mainfrom
holtbp:support-multi-signer-multipart

Conversation

@holtbp

@holtbp holtbp commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

send_document's multipart path (used whenever files: is passed, i.e. uploading a fresh PDF rather than referencing an existing template) only ever unwrapped the single-signer/single-file case — a second signer in signers: raised NotImplementedError. This adds support for sending 2+ signers (e.g. a sequential-order envelope) alongside an uploaded file.

Confirmed against BoldSign's own docs that the correct multipart encoding for a multi-valued field is one part per element, all sharing the same field name (e.g. two Signers= parts) — not a single field whose value is a JSON array, and not the bracket-suffixed Signers[]= form Faraday's multipart middleware emits by default for Array values (which BoldSign rejects, same as the existing Files[] gotcha this gem already works around).

What changed

  • Client#connection now passes flat_encode: true to Faraday::Multipart::Middleware, which is what makes an Array value emit as repeated same-named parts instead of key[]=.
  • Resources::Document#encode_multipart_value now maps every element of an Array value to its own JSON-encoded part, instead of special-casing (and raising past) the single-element case. Functionally identical output for today's single-signer callers — flat_encode + a one-element Array produces the exact same single part as the old unwrap-and-raise-if-more logic (covered by the existing "sends a multipart request when files: is provided" spec, unchanged and still passing).
  • Multi-file uploads are a separate concern and still raise NotImplementedError — out of scope here.

Testing

  • Existing suite passes unchanged (100% line/branch coverage maintained).
  • Replaced the old "raises for multi-element arrays" assertion with a new spec sending 2 signers + signerOrder + enableSigningOrder: true alongside a file upload, asserting exactly 2 signers parts with no [] suffix and no wrapping JSON array.
  • Kept a narrower multi-file-specific raise test (unaffected by this change).

Context

We're building a sequential 2-signer BoldSign envelope (an uploaded PDF, not a template) at EscrowSafe and hit this exact NotImplementedError. Happy to adjust the approach if you'd prefer a different API shape (e.g. an explicit signers: array vs. relying on flat_encode globally for all multipart Array values — I don't see another multipart caller in the gem today where that would change behavior, but flagging in case future callers expect bracket-style array semantics for something else).

BoldSign's /v1/document/send accepts a signer per repeated same-named
multipart part (confirmed against their docs), not a JSON array in one
field and not Faraday's default bracket-suffixed array encoding. The
gem previously only unwrapped the single-signer case and raised past
one element. Sets flat_encode: true on the multipart connection and
generalizes encode_multipart_value to map every array element to its
own part instead of special-casing size == 1.

Multi-file uploads are unrelated and still unsupported.
Version bump for the multi-signer send_document support in this PR.
Repo transferred from kleinjm/boldsign-ruby to the EscrowSafe org --
updates the gemspec homepage, README badges/links, and CHANGELOG
compare links to match. Adds .github/CODEOWNERS mirroring web's.
@holtbp
holtbp merged commit 2998e8a into EscrowSafe:main Jul 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants