Class: Uploadcare::Entity::Conversion::BaseConverter

Inherits:
Entity
  • Object
show all
Defined in:
lib/uploadcare/entity/conversion/base_converter.rb

Overview

This serializer lets a user convert uploaded documents

Direct Known Subclasses

DocumentConverter, VideoConverter

Class Method Summary collapse

Class Method Details

.convert(params, options = {}) ⇒ Object

Converts files

Parameters:

  • params (Array)

    of hashes with params or [Hash]

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :store (Boolean)

    whether to store file on servers.



14
15
16
17
# File 'lib/uploadcare/entity/conversion/base_converter.rb', line 14

def convert(params, options = {})
  files_params = params.is_a?(Hash) ? [params] : params
  conversion_client.new.convert_many(files_params, options)
end

.info(uuid) ⇒ Object

Returns the document format and possible conversion formats.

Parameters:

  • uuid (String)

    UUID of the document



29
30
31
# File 'lib/uploadcare/entity/conversion/base_converter.rb', line 29

def info(uuid)
  conversion_client.new.document_info(uuid)
end

.status(token) ⇒ Object

Returns a status of a conversion job

Parameters:

  • token (Integer, String)

    token obtained from a server in convert method



22
23
24
# File 'lib/uploadcare/entity/conversion/base_converter.rb', line 22

def status(token)
  conversion_client.new.get_conversion_status(token)
end