poli_page-rails 0.13.0 → 0.13.1
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 +13 -1
- data/README.md +21 -6
- data/lib/poli_page/rails/configuration.rb +19 -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 +6 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5836ac5581ecc314412433273d5bb80830b89939d6b12df75f40b5305aa37d6
|
|
4
|
+
data.tar.gz: 97dce16b697a6320f5920efacf4d68cea07f4e6e9c270fa89c0d840248baea0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7162744d4d4e48be70520ba696298f99c8ab3f1129d591cf79da105be6d69f9b445a8f91d20233dbbf39d62b2607b1f3e67f6eb0b121ceef8679f1ad368f4e84
|
|
7
|
+
data.tar.gz: 171cfee4011ebd261660e1a0646a884a790c36e0e638c53cb716279400f424cd832bb83e457884fe586266d2b70b7e2f8f457c6d416840d7f36f26b18ef3b47a
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,17 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.13.1] - 2026-11-05
|
|
10
|
+
|
|
11
|
+
### Deprecated
|
|
12
|
+
|
|
13
|
+
- `config.poli_page.user_agent`. It never had an effect: the `poli-page` SDK
|
|
14
|
+
sends its own `User-Agent` and takes no option for it, so the value was
|
|
15
|
+
never passed on. Setting it now emits a deprecation warning (through
|
|
16
|
+
`PoliPage::Rails.deprecator`, registered in `Rails.application.deprecators`
|
|
17
|
+
on Rails 7.1+) and still does nothing. It will be removed in a later minor
|
|
18
|
+
release.
|
|
19
|
+
|
|
9
20
|
## [0.13.0] - 2026-11-04
|
|
10
21
|
|
|
11
22
|
First release on RubyGems. It requires the `poli-page` SDK 0.13
|
|
@@ -135,5 +146,6 @@ changes made during those lines.
|
|
|
135
146
|
- Example app: the demo page's status row no longer shows the first 8
|
|
136
147
|
characters of `POLI_PAGE_API_KEY`; no part of the key is shown.
|
|
137
148
|
|
|
138
|
-
[Unreleased]: https://github.com/poli-page/rubyonrails/compare/v0.13.
|
|
149
|
+
[Unreleased]: https://github.com/poli-page/rubyonrails/compare/v0.13.1...HEAD
|
|
150
|
+
[0.13.1]: https://github.com/poli-page/rubyonrails/compare/v0.13.0...v0.13.1
|
|
139
151
|
[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.
|
|
@@ -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,10 +221,10 @@ 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
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "deprecator"
|
|
4
|
+
|
|
3
5
|
module PoliPage
|
|
4
6
|
module Rails
|
|
5
7
|
class Configuration
|
|
6
|
-
attr_accessor :api_key, :base_url, :timeout,
|
|
8
|
+
attr_accessor :api_key, :base_url, :timeout,
|
|
7
9
|
:max_retries, :retry_delay,
|
|
8
10
|
:logger, :on_retry, :on_error,
|
|
9
11
|
:proxy, :ca_file, :ca_path,
|
|
@@ -13,7 +15,6 @@ module PoliPage
|
|
|
13
15
|
@api_key = nil
|
|
14
16
|
@base_url = nil
|
|
15
17
|
@timeout = nil
|
|
16
|
-
@user_agent = nil
|
|
17
18
|
@max_retries = nil
|
|
18
19
|
@retry_delay = nil
|
|
19
20
|
@logger = nil
|
|
@@ -26,10 +27,23 @@ module PoliPage
|
|
|
26
27
|
@error_handler = true
|
|
27
28
|
end
|
|
28
29
|
|
|
30
|
+
USER_AGENT_DEPRECATION = "config.poli_page.user_agent has no effect, the Poli Page SDK sends " \
|
|
31
|
+
"its own User-Agent; remove it. It will be removed in a later minor release."
|
|
32
|
+
|
|
33
|
+
# Deprecated no-op: the SDK takes no User-Agent option, so the value was
|
|
34
|
+
# never passed on. Kept so that an initializer that sets it still boots.
|
|
35
|
+
def user_agent=(_value)
|
|
36
|
+
PoliPage::Rails.deprecator.warn(USER_AGENT_DEPRECATION)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Deprecated no-op, see #user_agent=. Always nil.
|
|
40
|
+
def user_agent
|
|
41
|
+
PoliPage::Rails.deprecator.warn(USER_AGENT_DEPRECATION)
|
|
42
|
+
nil
|
|
43
|
+
end
|
|
44
|
+
|
|
29
45
|
# 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).
|
|
46
|
+
# so the SDK's own defaults take over for every unset key.
|
|
33
47
|
def to_client_kwargs
|
|
34
48
|
{
|
|
35
49
|
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.14", "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,13 @@
|
|
|
1
1
|
module PoliPage
|
|
2
2
|
module Rails
|
|
3
|
+
def self.deprecator: () -> ActiveSupport::Deprecation
|
|
4
|
+
|
|
3
5
|
class Configuration
|
|
6
|
+
USER_AGENT_DEPRECATION: String
|
|
7
|
+
|
|
4
8
|
attr_accessor api_key: String?
|
|
5
9
|
attr_accessor base_url: String?
|
|
6
10
|
attr_accessor timeout: Numeric?
|
|
7
|
-
attr_accessor user_agent: String?
|
|
8
11
|
attr_accessor max_retries: Integer?
|
|
9
12
|
attr_accessor retry_delay: Numeric?
|
|
10
13
|
attr_accessor logger: untyped
|
|
@@ -17,6 +20,8 @@ module PoliPage
|
|
|
17
20
|
attr_accessor error_handler: bool
|
|
18
21
|
|
|
19
22
|
def initialize: () -> void
|
|
23
|
+
def user_agent=: (untyped) -> void
|
|
24
|
+
def user_agent: () -> nil
|
|
20
25
|
def to_client_kwargs: () -> Hash[Symbol, untyped]
|
|
21
26
|
end
|
|
22
27
|
|
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.13.
|
|
4
|
+
version: 0.13.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Poli Page
|
|
@@ -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: []
|