Skip to content

Commit ae0ba3c

Browse files
add support for public url
1 parent f2e30f5 commit ae0ba3c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/mindee/client.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ def enqueue_and_parse(
203203
# @param full_text [Boolean] Whether to include the full OCR text response in compatible APIs.
204204
# This performs a full OCR operation on the server and may increase response time.
205205
#
206+
# @param public_url [String, nil] A unique, encrypted URL for accessing the document validation interface without
207+
# requiring authentication.
206208
# @param page_options [Hash, nil] Page cutting/merge options:
207209
#
208210
# * `:page_indexes` Zero-based list of page indexes.
@@ -219,14 +221,16 @@ def execute_workflow(
219221
document_alias: nil,
220222
priority: nil,
221223
full_text: false,
224+
public_url: nil,
222225
page_options: nil
223226
)
224227
if input_source.is_a?(Mindee::Input::Source::LocalInputSource) && !page_options.nil? && input_source.pdf?
225228
input_source.process_pdf(page_options)
226229
end
227230

228231
workflow_endpoint = Mindee::HTTP::WorkflowEndpoint.new(workflow_id, api_key: @api_key)
229-
prediction, raw_http = workflow_endpoint.execute_workflow(input_source, full_text, document_alias, priority)
232+
prediction, raw_http = workflow_endpoint.execute_workflow(input_source, full_text, document_alias, priority,
233+
public_url)
230234
Mindee::Parsing::Common::WorkflowResponse.new(Product::Generated::GeneratedV1,
231235
prediction, raw_http)
232236
end

lib/mindee/http/workflow_endpoint.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ def initialize(workflow_id, api_key: '')
2727
# @param document_alias [String, nil] Alias to give to the document.
2828
# @param priority [Symbol, nil] Priority to give to the document.
2929
# @param full_text [Boolean] Whether to include the full OCR text response in compatible APIs.
30+
# @param public_url [String, nil] A unique, encrypted URL for accessing the document validation interface without
31+
# requiring authentication.
3032
# @return [Array]
31-
def execute_workflow(input_source, full_text, document_alias, priority)
33+
def execute_workflow(input_source, full_text, document_alias, priority, public_url)
3234
check_api_key
33-
response = workflow_execution_req_post(input_source, document_alias, priority, full_text)
35+
response = workflow_execution_req_post(input_source, document_alias, priority, full_text, public_url)
3436
hashed_response = JSON.parse(response.body, object_class: Hash)
3537
return [hashed_response, response.body] if ResponseValidation.valid_async_response?(response)
3638

@@ -43,8 +45,10 @@ def execute_workflow(input_source, full_text, document_alias, priority)
4345
# @param document_alias [String, nil] Alias to give to the document.
4446
# @param priority [Symbol, nil] Priority to give to the document.
4547
# @param full_text [Boolean] Whether to include the full OCR text response in compatible APIs.
48+
# @param public_url [String, nil] A unique, encrypted URL for accessing the document validation interface without
49+
# requiring authentication.
4650
# @return [Net::HTTPResponse, nil]
47-
def workflow_execution_req_post(input_source, document_alias, priority, full_text)
51+
def workflow_execution_req_post(input_source, document_alias, priority, full_text, public_url)
4852
uri = URI(@url)
4953
params = {}
5054
params[:full_text_ocr] = 'true' if full_text
@@ -61,6 +65,7 @@ def workflow_execution_req_post(input_source, document_alias, priority, full_tex
6165
[input_source.read_document]
6266
end
6367
form_data.push ['alias', document_alias] if document_alias
68+
form_data.push ['public_url', public_url] if public_url
6469
form_data.push ['priority', priority.to_s] if priority
6570

6671
req.set_form(form_data, 'multipart/form-data')

0 commit comments

Comments
 (0)