Skip to content

Migration

This page tracks breaking changes between releases of the poli-page gem. While the gem is on 0.x, a breaking change bumps the minor version. For the full per-release diff, see the changelog.

The SDK follows the Poli Page API contract v0.13.0 and now shares its major.minor with the Poli Page API, so there is no 0.12. The full guide is in MIGRATION.md in the repo.

  • Error#to_payload names its request id :requestId (was :request_id), so its JSON has the same keys in every Poli Page SDK. Read payload[:requestId], not payload[:request_id].
  • A 2xx whose body is not JSON raises PoliPage::InvalidResponseError (invalid_response) instead of InternalError (INTERNAL_ERROR).
  • render_to_file raises PoliPage::FileWriteError (io_error) when it cannot write the file, instead of InvalidOptionsError, and never leaves a partial file at the target.
  • The PDF download is bounded by timeout: (60 s by default); a download that outlasts it raises DownloadError with the message Failed to download PDF: timeout.

The SDK follows the Poli Page API contract v1.3.0. The full guide is in MIGRATION.md in the repo.

  • The keys inside data: and metadata: are sent exactly as written (no more camelizing), and doc.metadata comes back as stored, with String keys (doc.metadata["customerId"], not doc.metadata[:customer_id]). Send the keys your template and your metadata readers expect.
  • QUOTA_EXCEEDED, OVERAGE_CAP_EXCEEDED and STORAGE_ACCESS_DENIED are no longer retried, and retryable? is false for them. DOWNLOAD_FAILED is never retryable?.
  • The predicates read status and code: a DownloadError with a storage 403 is now auth_error?.
  • SDK messages are the specification’s exact texts: Network request failed, Request timed out after <ms>ms, Failed to download PDF: HTTP <status>, Failed to download PDF: network error, apiKey is required, and HTTP <status> for a non-JSON error body. Match on code, not message.
  • An unknown format: or orientation: is sent to the API, which answers PoliPage::ValidationError (400 VALIDATION_ERROR); the SDK no longer raises InvalidOptionsError for it. Check with PageFormat.valid? / Orientation.valid? if you want to refuse it first.
  • A nil or empty project: raises InvalidOptionsError (PROJECT_REQUIRED_FOR_DOCUMENT) before any request.

0.10.0 follows the environments contract: an API key belongs to one environment (pp_sandbox_…, pp_live_…, pp_staging_…) and a render uses the project’s copy published in that environment. Every removal ships at once, with no deprecation window. The full guide, with before/after code, is in MIGRATION.md in the repo.

  • Keys: the pp_test_ and pp_sa_ prefixes are gone. Create a key in the environment you render in; a sandbox key replaces a test key.
  • version: is removed from render.pdf, render.pdf_stream, render.document and render_to_file, and DocumentDescriptor#version is gone. Publish the project to the key’s environment instead of pinning a version.
  • render.preview and inline HTML are removed. Preview templates and inline HTML in the playground at play.poli.page. documents.preview(id) stays.
  • ProjectModeInput is renamed RenderInput; InlineModeInput is removed.
  • Error codes: GONE becomes DOCUMENT_GONE, PAYMENT_REQUIRED becomes ORGANIZATION_PAYMENT_GRACE, and the version codes are gone. See Errors.
  • documents.thumbnails no longer checks its options on the client: an out-of-bounds option raises PoliPage::ValidationError from the API instead of PoliPage::InvalidOptionsError.

The first release. Its surface is documented in MIGRATION.md in the repo.