Class: PdfServices::Ocr::Internal

Inherits:
Operation show all
Defined in:
lib/pdfservices/operations/ocr/internal.rb

Constant Summary collapse

INTERNAL_OPTIONS =
%i[ocr_lang ocr_type notifiers].freeze

Constants inherited from Operation

Operation::OCR_LANGS, Operation::OCR_TYPES, Operation::OPERATION_ENDPOINT

Constants inherited from Base::Operation

Base::Operation::ASSETS_ENDPOINT, Base::Operation::BASE_ENDPOINT, Base::Operation::STATUS

Instance Method Summary collapse

Methods inherited from Base::Operation

#handle_response, #initialize, #poll_document_result, #upload_asset

Constructor Details

This class inherits a constructor from PdfServices::Base::Operation

Instance Method Details

#execute(source_pdf, options = {}, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/pdfservices/operations/ocr/internal.rb', line 8

def execute(source_pdf, options = {}, &block)
  validate_options(options)
  asset = upload_asset(source_pdf)

  response = @api.post(OPERATION_ENDPOINT,
                       body: request_body(asset.id, options), headers: { 'Content-Type' => 'application/json' })

  handle_response(response, asset, &block)
end