Class: PdfServices::DocumentGeneration::External
- Inherits:
-
Operation
- Object
- Base::Operation
- InternalExternalOperation::Operation
- Operation
- PdfServices::DocumentGeneration::External
- Defined in:
- lib/pdfservices/operations/document_generation/external.rb
Constant Summary collapse
- EXTERNAL_OPTIONS =
%i[input output params download_from_external].freeze
- INPUT_KEYS =
%i[uri storage].freeze
- OUTPUT_KEYS =
%i[uri storage].freeze
- PARAMS_KEYS =
%i[output_format json_data_for_merge fragments].freeze
- STORAGE_OPTIONS =
%i[S3 SHAREPOINT DROPBOX BLOB].freeze
Constants inherited from Operation
Constants inherited from Base::Operation
Base::Operation::ASSETS_ENDPOINT, Base::Operation::BASE_ENDPOINT, Base::Operation::STATUS
Instance Method Summary collapse
- #execute(template_path, options = {}) ⇒ Object
-
#initialize(api) ⇒ External
constructor
A new instance of External.
Methods inherited from Operation
#external_class, #internal_class, #request_headers
Methods inherited from Base::Operation
#handle_response, #poll_document_result, #upload_asset
Constructor Details
#initialize(api) ⇒ External
Returns a new instance of External.
12 13 14 15 16 |
# File 'lib/pdfservices/operations/document_generation/external.rb', line 12 def initialize(api) super @download_from_external = false @download_uri = nil end |
Instance Method Details
#execute(template_path, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pdfservices/operations/document_generation/external.rb', line 18 def execute(template_path, = {}) () asset = upload_asset(template_path) @download_from_external = [:download_from_external] || false @download_uri = [:output][:uri] if @download_from_external response = @api.post(OPERATION_ENDPOINT, body: request_body(asset.id, ), headers: request_headers) handle_response(response, asset.id) end |