Method: Mindee::Client#execute_workflow
- Defined in:
- lib/mindee/client.rb
#execute_workflow(input_source, workflow_id, options: {}) ⇒ Mindee::Parsing::Common::WorkflowResponse
Sends a document to a workflow.
Accepts options either as a Hash or as a WorkflowOptions struct.
requiring authentication.
page_options[Hash, nil] Page cutting/merge options::page_indexesZero-based list of page indexes.:operationOperation to apply on the document, given the `page_indexes specified::KEEP_ONLY- keep only the specified pages, and remove all others.:REMOVE- remove the specified pages, and keep all others.
:on_min_pagesApply the operation only if document has at least this many pages.
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/mindee/client.rb', line 304 def execute_workflow(input_source, workflow_id, options: {}) opts = .is_a?(WorkflowOptions) ? : WorkflowOptions.new(params: ) if opts.respond_to?(:page_options) && input_source.is_a?(Input::Source::LocalInputSource) process_pdf_if_required(input_source, opts) end workflow_endpoint = Mindee::HTTP::WorkflowEndpoint.new(workflow_id, api_key: @api_key.to_s) logger.debug("Sending document to workflow '#{workflow_id}'") prediction, raw_http = workflow_endpoint.execute_workflow( input_source, opts ) Mindee::Parsing::Common::WorkflowResponse.new(Product::Universal::Universal, prediction, raw_http) end |