Skip to content

Client

PoliPage::Client.new(api_key:, base_url: ..., max_retries: 2, retry_delay: 0.5, timeout: 60, logger: nil, on_retry: nil, on_error: nil, proxy: nil, ca_file: nil, ca_path: nil)

Main entry point — orchestrates retries, fires hooks, and delegates HTTP execution to PoliPage::Internal::Transport. The render and documents resource namespaces hold a reference to this client and delegate request execution back through it.

The constructor takes a required api_key: plus a set of optional keyword arguments — see Configuration for every field, or PoliPage::Client for the typed reference. The same client is safe to share across threads; build one at boot and reuse it.

The client exposes two resource namespaces:

  • client.render — render PDFs (in memory, streaming, or as a stored document).
  • client.documents — fetch, preview, thumbnail, or delete stored documents.

The standalone helper client.render_to_file is defined directly on PoliPage::Client.