feat(domains): add forge activation methods

LU
21h ago
+150-4

Summary

Adds Forge activation, matching the folded API surface (the standalone forge verify and update endpoints no longer exist). Ports resend/resend-node#1193 to Ruby; the API surface is defined in resend/resend-openapi#144.

  • Resend::Domains::Forge.enable(id:, return_path:) → POST /domains/:id/forge. Returns the full domain response. return_path is optional; when omitted, the API picks a label that is free in the domain's DNS, and only return_path is ever sent in the body. Idempotent on the API side.
  • Resend::Domains.verify(domain_id, scope: ["forge"]) → POST /domains/:id/verify with {"scope":["forge"]}. Scoped, only the Forge record is re-checked, so the records that are already verified are not re-proven. The existing verify(domain_id) call still sends {} exactly as before.
  • Resend::Domains.update({ id: ..., forge_return_path: ... }) → PATCH /domains/:id. forge_return_path passes through like every other update field: moves the Forge return path while the Forge record is still verifying, does not start verification, and once the record verifies the API refuses with 422 return_path_unavailable.

Bumps the version to 1.20.0.

Validation

  • bundle exec rubocop: 52 files inspected, no offenses detected.
  • bundle exec rake spec: 484 examples, 0 failures (Ruby 3.3).
  • Specs assert the wire shapes: enable with and without return_path (empty body asserted), the scoped verify body, and the forge_return_path PATCH body.

Notes for reviewers

  • verify keeps its positional domain_id and takes the scope as a trailing params hash, so existing callers are untouched.
  • Forge.enable sends only return_path (params.slice(:return_path)), so the id used to build the path never leaks into the payload.

Part of DEV-2474.

The Forge enable endpoint is live in production; the scoped verify and forge_return_path land with the API reshape, which deploys before this ships. Ships with the next resend-ruby release.