Last updated: Jun-04-2024
This quick start lets you get an end-to-end implementation up and running using the Ruby/Rails SDK in 5 minutes or less.
Prerequisites
1. Set up and configure the SDK
Install the SDK
In a terminal, in your Ruby environment, run:
Configure Cloudinary
In your project, create a new file called config.rb
with the code below. Make sure to update it to use your product environment's credentials:
Reference the configuration from a ruby script
In your project, create a new file called quickstart.rb
.
For the sake of this quick start, you'll put all the Cloudinary code other than the configuration in this single file and only run it at the end.
To reference your product environment configuration from this new file, add:
2. Upload files
To upload some remote files to Cloudinary, paste the following to the end of your quickstart.rb
file:
3. Get and use details of an image
Paste these two snippets to perform some management operations on the assets you previously uploaded:
Return details of an existing resource
Retrieve and update specific attributes of an asset
4. Transform images
Add this code to your file in order to generate a few different transformation URLs on the two assets you previously uploaded:
5. Run your code
In your Ruby IDE or in a terminal (from the /scripts
folder of your project), run your quickstart.rb
script and take a look at the output you get from each step of this quick start:
View the completed code
You can find the full code example for this quick start on GitHub.
Next steps
- Learn more about the Ruby/Rails SDK by visiting the other pages in this SDK guide.
- Get comprehensive details about Cloudinary features and capabilities:
- Upload guide: Provides details and examples of the upload options.
- Image transformations guide: Provides details and examples of the transformations you can apply to image assets.
- Video transformations guide: Provides details and examples of the transformations you can apply to video assets.
- Transformation URL API Reference: Provides details and examples of all available transformation parameters.
- Admin API guide: Provides details and examples of the methods available for managing and organizing your media assets.
Check out our Introduction to Cloudinary for Ruby Developers course in the Cloudinary Academy. This self-paced resource provides video-based lessons, sample scripts and other learning material to get you going with Ruby and Cloudinary today.