RB

Application integration

# 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.

1. Install the transloadit gem and create a Transloadit Template.
2. Set TRANSLOADIT\_KEY, TRANSLOADIT\_SECRET, and TRANSLOADIT\_TEMPLATE\_ID.
3. Run ruby process\_media.rb path/to/file.mp4.

### Install

```
gem install transloadit
```

### process\_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 response
```

## Authentication

* 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.

## Related Robots

* [/upload/handle](/docs/robots/upload-handle.md)\
  Handle uploads
* [/video/encode](/docs/robots/video-encode.md)\
  Encode video
* [/s3/store](/docs/robots/s3-store.md)\
  Store results in S3

## Documentation

* [Transloadit Ruby SDK documentation](/docs/sdks/ruby-sdk.md)
* [Transloadit Templates documentation](/docs/topics/templates.md)
* [Ruby documentation⁠](https://www.ruby-lang.org/en/documentation/)
* [Transloadit Ruby SDK source⁠](https://github.com/transloadit/ruby-sdk)
  [Create a Template](/c/templates/new/)

More integrations

## Continue building your stack

NX

### [Next.js](/integrations/nextjs.md)

Signed Uppy uploads for the Next.js App Router.

LV

### [Laravel](/integrations/laravel.md)

Create Assemblies from Laravel with the official PHP SDK.

PY

### [Python](/integrations/python.md)

Run signed Assembly jobs with the maintained Python SDK.
