Ruby + Transloadit
Create a signed Assembly from a Ruby process with the official transloadit gem and a fixed Template.
Executable recipe
Build the integration
The script submits one local file to a fixed Template, polls with a finite limit, and prints the final response.
- Install the transloadit gem and create a Transloadit Template.
- Set TRANSLOADIT_KEY, TRANSLOADIT_SECRET, and TRANSLOADIT_TEMPLATE_ID.
- Run ruby process_media.rb path/to/file.mp4.
Install
gem install transloaditprocess_media.rb
require 'transloadit'
transloadit = Transloadit.new(
key: ENV.fetch('TRANSLOADIT_KEY'),
secret: ENV.fetch('TRANSLOADIT_SECRET')
)
assembly = transloadit.assembly(
template_id: ENV.fetch('TRANSLOADIT_TEMPLATE_ID')
)
response = File.open(ARGV.fetch(0), 'rb') do |file|
assembly.create!(file)
end
response.reload_until_finished!(tries: 300)
puts responseAuthentication
- Read the Workspace Auth Key, Auth Secret, and fixed Template ID from server environment variables.
- The official Ruby gem signs API requests when initialized with the Auth Secret.
- Keep credentials out of browser-delivered Ruby environments and do not let untrusted callers select arbitrary Steps.
Limitations and operational notes
- create! returns after the Assembly is created and the upload is accepted, not necessarily after processing completes.
- reload_until_finished! polls. Background jobs should set a finite tries value and persist the Assembly ID for later reconciliation.
- For browser uploads in a Rails application, use Uppy or the Rails SDK instead of proxying large files through a controller.
More integrations