Method: EasyPdfCloud::Workflow#convert_data

Defined in:
lib/easy_pdf_cloud.rb

#convert_data(filename, data, source_extension, dest_extension) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
# File 'lib/easy_pdf_cloud.rb', line 137

def convert_data(filename, data, source_extension, dest_extension)
  job_id = create_job_from_file(filename, data)
  wait_for_completion(job_id)
  output_file = filename.sub(".#{source_extension}", ".#{dest_extension}")
  response = retrieve_file(job_id, output_file)
  # The job stays around after execution. We can either delete or keep a history some where.
  # delete_job(job_id)
  # Delete the output file so it doesn't take up storage space.
  delete_output_file(job_id, output_file)
  response.body
end