Class: PoliPage::DocumentDescriptor
- Inherits:
-
Data
- Object
- Data
- PoliPage::DocumentDescriptor
- Defined in:
- lib/poli_page/models/document_descriptor.rb
Overview
The stored-document descriptor returned by ‘client.render.document` and the `client.documents.*` methods. Carries every wire field plus an SDK-attached `_client` back-reference used by `#download_pdf`.
The ‘_client` field is hidden from `#to_h` and `#inspect` so it doesn’t leak into logs or marshalled representations (sdk-ruby-plan.md §3.4).
Instance Attribute Summary collapse
-
#_client ⇒ Object
readonly
Returns the value of attribute _client.
-
#api_key_id ⇒ Object
readonly
Returns the value of attribute api_key_id.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#document_id ⇒ Object
readonly
Returns the value of attribute document_id.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#organization_id ⇒ Object
readonly
Returns the value of attribute organization_id.
-
#orientation ⇒ Object
readonly
Returns the value of attribute orientation.
-
#page_count ⇒ Object
readonly
Returns the value of attribute page_count.
-
#presigned_pdf_url ⇒ Object
readonly
Returns the value of attribute presigned_pdf_url.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#project_slug ⇒ Object
readonly
Returns the value of attribute project_slug.
-
#size_bytes ⇒ Object
readonly
Returns the value of attribute size_bytes.
-
#template_id ⇒ Object
readonly
Returns the value of attribute template_id.
-
#template_slug ⇒ Object
readonly
Returns the value of attribute template_slug.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#download_pdf ⇒ String
Fetch the PDF bytes from ‘presigned_pdf_url`.
- #inspect ⇒ Object
- #to_h ⇒ Object
Instance Attribute Details
#_client ⇒ Object (readonly)
Returns the value of attribute _client
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def _client @_client end |
#api_key_id ⇒ Object (readonly)
Returns the value of attribute api_key_id
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def api_key_id @api_key_id end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def created_at @created_at end |
#document_id ⇒ Object (readonly)
Returns the value of attribute document_id
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def document_id @document_id end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def environment @environment end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def expires_at @expires_at end |
#format ⇒ Object (readonly)
Returns the value of attribute format
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def format @format end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def locale @locale end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def @metadata end |
#organization_id ⇒ Object (readonly)
Returns the value of attribute organization_id
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def organization_id @organization_id end |
#orientation ⇒ Object (readonly)
Returns the value of attribute orientation
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def orientation @orientation end |
#page_count ⇒ Object (readonly)
Returns the value of attribute page_count
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def page_count @page_count end |
#presigned_pdf_url ⇒ Object (readonly)
Returns the value of attribute presigned_pdf_url
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def presigned_pdf_url @presigned_pdf_url end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def project_id @project_id end |
#project_slug ⇒ Object (readonly)
Returns the value of attribute project_slug
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def project_slug @project_slug end |
#size_bytes ⇒ Object (readonly)
Returns the value of attribute size_bytes
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def size_bytes @size_bytes end |
#template_id ⇒ Object (readonly)
Returns the value of attribute template_id
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def template_id @template_id end |
#template_slug ⇒ Object (readonly)
Returns the value of attribute template_slug
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def template_slug @template_slug end |
#version ⇒ Object (readonly)
Returns the value of attribute version
10 11 12 |
# File 'lib/poli_page/models/document_descriptor.rb', line 10 def version @version end |
Instance Method Details
#download_pdf ⇒ String
Fetch the PDF bytes from ‘presigned_pdf_url`. The URL has a ~15-minute TTL — if it expired, call `client.documents.get(document_id)` to refresh and retry.
38 39 40 41 42 |
# File 'lib/poli_page/models/document_descriptor.rb', line 38 def download_pdf raise PoliPage::InternalError, "DocumentDescriptor missing client back-reference" if _client.nil? _client.fetch_bytes(presigned_pdf_url) end |
#inspect ⇒ Object
48 49 50 |
# File 'lib/poli_page/models/document_descriptor.rb', line 48 def inspect "#<PoliPage::DocumentDescriptor document_id=#{document_id.inspect} ...>" end |
#to_h ⇒ Object
44 45 46 |
# File 'lib/poli_page/models/document_descriptor.rb', line 44 def to_h super.except(:_client) end |