Class: PdfServices::Ocr::External
- Inherits:
-
Operation
- Object
- Base::Operation
- InternalExternalOperation::Operation
- Operation
- PdfServices::Ocr::External
- Defined in:
- lib/pdfservices/operations/ocr/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[ocr_lang ocr_type].freeze
- STORAGE_OPTIONS =
%i[S3 SHAREPOINT DROPBOX BLOB].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
- #execute(url, options = {}) ⇒ Object
-
#initialize(api) ⇒ External
constructor
A new instance of External.
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/ocr/external.rb', line 12 def initialize(api) super @download_from_external = false @download_uri = nil end |
Instance Method Details
#execute(url, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pdfservices/operations/ocr/external.rb', line 18 def execute(url, = {}) @download_from_external = [:download_from_external] || false [:input][:uri] = [:input][:uri] || url () @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 |