poli_page-rails 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -1
- data/README.md +24 -8
- data/lib/poli_page/rails/configuration.rb +2 -5
- data/lib/poli_page/rails/deprecator.rb +17 -0
- data/lib/poli_page/rails/railtie.rb +7 -0
- data/lib/poli_page/rails/version.rb +1 -1
- data/sig/poli_page/rails/configuration.rbs +2 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19e494a0a761fd0c982506d2b1f82beb8f411439dc79b38f77b0e1413826e05c
|
|
4
|
+
data.tar.gz: abf6a6f8c2f89bf2a6e6b189b2ae6cf56691e0d801626982c55c41637c543b50
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1e9944dbb28eaa3e32a506cdb29469bacfa78a79e7598e13a9d5ef45e5f2d049041f61fc70cb3789a0c149d895f597ffe37a965eed0bdddac56c6c74ca8c3361
|
|
7
|
+
data.tar.gz: 2cd39dfa4f9c7433815586409e7fbb1154c88994218cc859cd08088c7a47e359a82773e5383772f3ee3104489c68535f2c3a73fadaef916f06241fd5e64d311e
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,36 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.15.0] - 2026-11-17
|
|
10
|
+
|
|
11
|
+
Requires the `poli-page` SDK 0.15 (`~> 0.15.0`, that is `>= 0.15.0, < 0.16`)
|
|
12
|
+
and passes the Poli Page API contract v0.15.0. There is no 0.14 release of the
|
|
13
|
+
gem.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Requires the `poli-page` SDK 0.15 (`~> 0.15.0`; was `~> 0.13.0`).
|
|
18
|
+
- The API contract cases run against contract v0.15.0 (contract format 2).
|
|
19
|
+
The `impl` cases the gem runs are unchanged from v0.13.0.
|
|
20
|
+
|
|
21
|
+
### Removed
|
|
22
|
+
|
|
23
|
+
- **Breaking:** `config.poli_page.user_agent`, deprecated in 0.13.1. It never
|
|
24
|
+
had an effect: the `poli-page` SDK sends its own `User-Agent` and takes no
|
|
25
|
+
option for it. An initializer that still sets it now fails at boot with
|
|
26
|
+
`NoMethodError`; delete the line.
|
|
27
|
+
|
|
28
|
+
## [0.13.1] - 2026-11-05
|
|
29
|
+
|
|
30
|
+
### Deprecated
|
|
31
|
+
|
|
32
|
+
- `config.poli_page.user_agent`. It never had an effect: the `poli-page` SDK
|
|
33
|
+
sends its own `User-Agent` and takes no option for it, so the value was
|
|
34
|
+
never passed on. Setting it now emits a deprecation warning (through
|
|
35
|
+
`PoliPage::Rails.deprecator`, registered in `Rails.application.deprecators`
|
|
36
|
+
on Rails 7.1+) and still does nothing. It will be removed in a later minor
|
|
37
|
+
release.
|
|
38
|
+
|
|
9
39
|
## [0.13.0] - 2026-11-04
|
|
10
40
|
|
|
11
41
|
First release on RubyGems. It requires the `poli-page` SDK 0.13
|
|
@@ -135,5 +165,7 @@ changes made during those lines.
|
|
|
135
165
|
- Example app: the demo page's status row no longer shows the first 8
|
|
136
166
|
characters of `POLI_PAGE_API_KEY`; no part of the key is shown.
|
|
137
167
|
|
|
138
|
-
[Unreleased]: https://github.com/poli-page/rubyonrails/compare/v0.
|
|
168
|
+
[Unreleased]: https://github.com/poli-page/rubyonrails/compare/v0.15.0...HEAD
|
|
169
|
+
[0.15.0]: https://github.com/poli-page/rubyonrails/compare/v0.13.1...v0.15.0
|
|
170
|
+
[0.13.1]: https://github.com/poli-page/rubyonrails/compare/v0.13.0...v0.13.1
|
|
139
171
|
[0.13.0]: https://github.com/poli-page/rubyonrails/releases/tag/v0.13.0
|
data/README.md
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
# poli_page-rails
|
|
2
2
|
|
|
3
|
+
[](https://rubygems.org/gems/poli_page-rails)
|
|
4
|
+
[](https://rubygems.org/gems/poli_page-rails)
|
|
5
|
+
[](https://github.com/poli-page/rubyonrails/actions/workflows/ci.yml)
|
|
6
|
+
[](https://github.com/poli-page/rubyonrails/actions/workflows/codeql.yml)
|
|
7
|
+
[](https://codecov.io/gh/poli-page/rubyonrails)
|
|
8
|
+
[](https://github.com/poli-page/rubyonrails/blob/main/.github/workflows/ci.yml)
|
|
9
|
+
[](https://rubyonrails.org/)
|
|
10
|
+
[](https://github.com/poli-page/rubyonrails/tree/main/sig)
|
|
11
|
+
[](https://github.com/rubocop/rubocop)
|
|
12
|
+
[](https://github.com/poli-page/rubyonrails/network/dependencies)
|
|
13
|
+
[](https://poli-page.github.io/rubyonrails/)
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
|
|
3
16
|
> Render Poli Page documents from Rails controllers.
|
|
4
17
|
|
|
18
|
+
→ **Documentation**: https://poli-page.github.io/rubyonrails/
|
|
19
|
+
|
|
5
20
|
## About
|
|
6
21
|
|
|
7
22
|
This gem wires the official [`poli-page`](https://rubygems.org/gems/poli-page) Ruby SDK into a Rails app as an Engine. A Railtie installs a `Configuration` object on `Rails.application.config.poli_page`, `PoliPage.client` returns a lazy-memoised SDK client, and a `Renderable` controller concern turns SDK responses into PDF, HTML, or 302 responses with RFC 5987 `Content-Disposition` headers. Retry and terminal-error hooks on the SDK bridge into `ActiveSupport::Notifications` so subscribers like `lograge`, `appsignal`, or `scout_apm` pick them up without extra wiring.
|
|
@@ -21,7 +36,7 @@ This gem wires the official [`poli-page`](https://rubygems.org/gems/poli-page) R
|
|
|
21
36
|
|
|
22
37
|
- Ruby 3.2 or newer
|
|
23
38
|
- Rails 7.0, 7.1, 7.2, or 8.0
|
|
24
|
-
- `poli-page` SDK 0.
|
|
39
|
+
- `poli-page` SDK 0.15.x (`~> 0.15.0`); Bundler installs it with the gem
|
|
25
40
|
|
|
26
41
|
## Install
|
|
27
42
|
|
|
@@ -29,7 +44,7 @@ Add the gem to your `Gemfile`:
|
|
|
29
44
|
|
|
30
45
|
```ruby
|
|
31
46
|
# Gemfile
|
|
32
|
-
gem "poli_page-rails", "~> 0.
|
|
47
|
+
gem "poli_page-rails", "~> 0.15.0"
|
|
33
48
|
```
|
|
34
49
|
|
|
35
50
|
Then run:
|
|
@@ -87,7 +102,7 @@ Every key is optional except `api_key`. The SDK's own defaults apply when a valu
|
|
|
87
102
|
|---|---|---|
|
|
88
103
|
| `api_key` | — | Required. A key for one environment: `pp_sandbox_…`, `pp_live_…`, or `pp_{environment}_…` (see [API keys](#api-keys)). |
|
|
89
104
|
| `base_url` | `https://api.poli.page` | Override for the develop environment or a private proxy. |
|
|
90
|
-
| `timeout` | SDK default | Request timeout in seconds.
|
|
105
|
+
| `timeout` | SDK default | Request timeout in seconds. A positive number, at most `600`. |
|
|
91
106
|
| `max_retries` | SDK default | Retry attempts on retryable failures. Must be in `0..10`. |
|
|
92
107
|
| `retry_delay` | SDK default | Base backoff delay in seconds. Must be in `0..30`. |
|
|
93
108
|
| `logger` | `Rails.logger` | Any `Logger`-compatible instance. |
|
|
@@ -124,7 +139,7 @@ Configuration is validated lazily on the first `PoliPage.client` call, so `asset
|
|
|
124
139
|
| `"poli_page.error"` | `ActiveSupport::Notifications` event fired on terminal SDK failure. |
|
|
125
140
|
| `rails generate poli_page:install` | Writes `config/initializers/poli_page.rb`. |
|
|
126
141
|
|
|
127
|
-
Full reference: [
|
|
142
|
+
Full reference: [API reference](https://poli-page.github.io/rubyonrails/reference/api/).
|
|
128
143
|
|
|
129
144
|
## Errors
|
|
130
145
|
|
|
@@ -206,15 +221,16 @@ bin/rails server
|
|
|
206
221
|
|
|
207
222
|
## Going further
|
|
208
223
|
|
|
209
|
-
- ActiveSupport::Notifications — subscribe to `poli_page.retry` and `poli_page.error` for logging, metrics, and alerting (
|
|
210
|
-
- Filename encoding — how `PoliPage::Rails::FilenameEncoder` produces RFC 5987 `Content-Disposition` values for non-ASCII names (
|
|
211
|
-
- Background rendering — running renders through Active Job for slow templates (
|
|
212
|
-
- Testing helpers — stubbing `PoliPage.client` in request specs and system tests (
|
|
224
|
+
- ActiveSupport::Notifications — subscribe to `poli_page.retry` and `poli_page.error` for logging, metrics, and alerting ([Observability](https://poli-page.github.io/rubyonrails/production/observability/)).
|
|
225
|
+
- Filename encoding — how `PoliPage::Rails::FilenameEncoder` produces RFC 5987 `Content-Disposition` values for non-ASCII names ([Responses](https://poli-page.github.io/rubyonrails/concepts/responses/)).
|
|
226
|
+
- Background rendering — running renders through Active Job for slow templates ([Client access](https://poli-page.github.io/rubyonrails/concepts/client-access/) has a job example).
|
|
227
|
+
- Testing helpers — stubbing `PoliPage.client` in request specs and system tests ([Testing](https://poli-page.github.io/rubyonrails/production/testing/)).
|
|
213
228
|
|
|
214
229
|
## Compatibility
|
|
215
230
|
|
|
216
231
|
| Gem | `poli-page` SDK | Rails | Ruby |
|
|
217
232
|
|---|---|---|---|
|
|
233
|
+
| 0.15.x | 0.15.x | 7.0 / 7.1 / 7.2 / 8.0 | 3.2 – 3.4 |
|
|
218
234
|
| 0.13.x | 0.13.x | 7.0 / 7.1 / 7.2 / 8.0 | 3.2 – 3.4 |
|
|
219
235
|
|
|
220
236
|
The gem shares its major.minor with the Poli Page API and requires the SDK of the same minor (see [RELEASING.md](RELEASING.md#versions)).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module PoliPage
|
|
4
4
|
module Rails
|
|
5
5
|
class Configuration
|
|
6
|
-
attr_accessor :api_key, :base_url, :timeout,
|
|
6
|
+
attr_accessor :api_key, :base_url, :timeout,
|
|
7
7
|
:max_retries, :retry_delay,
|
|
8
8
|
:logger, :on_retry, :on_error,
|
|
9
9
|
:proxy, :ca_file, :ca_path,
|
|
@@ -13,7 +13,6 @@ module PoliPage
|
|
|
13
13
|
@api_key = nil
|
|
14
14
|
@base_url = nil
|
|
15
15
|
@timeout = nil
|
|
16
|
-
@user_agent = nil
|
|
17
16
|
@max_retries = nil
|
|
18
17
|
@retry_delay = nil
|
|
19
18
|
@logger = nil
|
|
@@ -27,9 +26,7 @@ module PoliPage
|
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
# Single source of truth for SDK kwargs. Compact drops every nil entry,
|
|
30
|
-
# so the SDK's own defaults take over for every unset key.
|
|
31
|
-
# is intentionally NOT included — PoliPage::Client#initialize does not
|
|
32
|
-
# accept it (poli-page 0.11).
|
|
29
|
+
# so the SDK's own defaults take over for every unset key.
|
|
33
30
|
def to_client_kwargs
|
|
34
31
|
{
|
|
35
32
|
api_key: api_key,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "active_support"
|
|
4
|
+
require "active_support/deprecation"
|
|
5
|
+
|
|
6
|
+
require_relative "version"
|
|
7
|
+
|
|
8
|
+
module PoliPage
|
|
9
|
+
module Rails
|
|
10
|
+
# The gem's deprecation warnings. The Railtie registers it in
|
|
11
|
+
# Rails.application.deprecators (Rails 7.1+), so the app's
|
|
12
|
+
# config.active_support.deprecation setting applies to it.
|
|
13
|
+
def self.deprecator
|
|
14
|
+
@deprecator ||= ActiveSupport::Deprecation.new("0.16", "poli_page-rails")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -3,12 +3,19 @@
|
|
|
3
3
|
require "rails/railtie"
|
|
4
4
|
|
|
5
5
|
require_relative "configuration_validator"
|
|
6
|
+
require_relative "deprecator"
|
|
6
7
|
require_relative "error_handler"
|
|
7
8
|
require_relative "notifications"
|
|
8
9
|
|
|
9
10
|
module PoliPage
|
|
10
11
|
module Rails
|
|
11
12
|
class Railtie < ::Rails::Railtie
|
|
13
|
+
# Before config/initializers/*.rb, so a deprecation hit there follows
|
|
14
|
+
# the app's config.active_support.deprecation setting (Rails 7.1+).
|
|
15
|
+
initializer "poli_page.deprecator", before: :load_config_initializers do |app|
|
|
16
|
+
app.deprecators[:poli_page] = PoliPage::Rails.deprecator if app.respond_to?(:deprecators)
|
|
17
|
+
end
|
|
18
|
+
|
|
12
19
|
initializer "poli_page.configure", before: :load_config_initializers do |app|
|
|
13
20
|
# Why: Rails::Application::Configuration#method_missing raises
|
|
14
21
|
# NoMethodError on read when the key has never been set, so the
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
module PoliPage
|
|
2
2
|
module Rails
|
|
3
|
+
def self.deprecator: () -> ActiveSupport::Deprecation
|
|
4
|
+
|
|
3
5
|
class Configuration
|
|
4
6
|
attr_accessor api_key: String?
|
|
5
7
|
attr_accessor base_url: String?
|
|
6
8
|
attr_accessor timeout: Numeric?
|
|
7
|
-
attr_accessor user_agent: String?
|
|
8
9
|
attr_accessor max_retries: Integer?
|
|
9
10
|
attr_accessor retry_delay: Numeric?
|
|
10
11
|
attr_accessor logger: untyped
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: poli_page-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Poli Page
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.15.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.15.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: railties
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -101,6 +101,7 @@ files:
|
|
|
101
101
|
- lib/poli_page/rails/client.rb
|
|
102
102
|
- lib/poli_page/rails/configuration.rb
|
|
103
103
|
- lib/poli_page/rails/configuration_validator.rb
|
|
104
|
+
- lib/poli_page/rails/deprecator.rb
|
|
104
105
|
- lib/poli_page/rails/engine.rb
|
|
105
106
|
- lib/poli_page/rails/error_handler.rb
|
|
106
107
|
- lib/poli_page/rails/errors.rb
|
|
@@ -126,6 +127,7 @@ metadata:
|
|
|
126
127
|
homepage_uri: https://poli.page
|
|
127
128
|
source_code_uri: https://github.com/poli-page/rubyonrails
|
|
128
129
|
changelog_uri: https://github.com/poli-page/rubyonrails/blob/main/CHANGELOG.md
|
|
130
|
+
documentation_uri: https://poli-page.github.io/rubyonrails/
|
|
129
131
|
bug_tracker_uri: https://github.com/poli-page/rubyonrails/issues
|
|
130
132
|
rubygems_mfa_required: 'true'
|
|
131
133
|
rdoc_options: []
|
|
@@ -142,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
142
144
|
- !ruby/object:Gem::Version
|
|
143
145
|
version: '0'
|
|
144
146
|
requirements: []
|
|
145
|
-
rubygems_version: 3.6.
|
|
147
|
+
rubygems_version: 3.6.9
|
|
146
148
|
specification_version: 4
|
|
147
149
|
summary: Rails engine for the Poli Page PDF rendering API
|
|
148
150
|
test_files: []
|