Module: FileConvert

Extended by:
Configure
Defined in:
lib/file_convert.rb,
lib/file_convert/file.rb,
lib/file_convert/client.rb,
lib/file_convert/upload.rb,
lib/file_convert/version.rb,
lib/file_convert/configure.rb,
lib/file_convert/exception.rb,
lib/file_convert/conversion.rb

Defined Under Namespace

Modules: Configure, Exception, Version Classes: Client, Conversion, File, Upload

Class Method Summary collapse

Methods included from Configure

config, config, config_present?, configure

Class Method Details

.clientObject

Initialize a new FileConvert::Client



28
29
30
31
# File 'lib/file_convert.rb', line 28

def self.client
  fail Exception::MissingConfig unless config_present?
  @client ||= FileConvert::Client.new
end

.convert(file_path, source_mime_type, target_mime_type) ⇒ FileConvert::Conversion

Parameters:

  • file_path (String)

    Source file for conversions

  • Source (String)

    file mime-type

  • Target (String)

    file mime-type (converion target)

Returns:



21
22
23
24
# File 'lib/file_convert.rb', line 21

def self.convert(file_path, source_mime_type, target_mime_type)
  upload = FileConvert::Upload.new(client, file_path, source_mime_type)
  FileConvert::Conversion.new(client, upload.file, target_mime_type)
end