Daytona Ruby SDK
The official Ruby SDK for Daytona - a platform for secure, isolated sandbox environments.
Installation
Add this line to your application's Gemfile:
gem 'daytona'
And then execute:
bundle install
Or install it yourself as:
gem install daytona
Quick Start
require 'daytona'
# Initialize the client (uses DAYTONA_API_KEY environment variable)
daytona = Daytona::Daytona.new
# Or with explicit configuration
config = Daytona::Config.new(
api_key: 'your-api-key',
target: 'us'
)
daytona = Daytona::Daytona.new(config)
# Create a sandbox
sandbox = daytona.create
# Execute code
response = sandbox.process.code_run(code: 'print("Hello, World!")')
puts response.result
# Clean up
daytona.delete(sandbox)
Configuration
The SDK can be configured using environment variables:
| Variable | Description |
|---|---|
DAYTONA_API_KEY |
API key for authentication |
DAYTONA_API_URL |
URL of the Daytona API (defaults to https://app.daytona.io/api) |
DAYTONA_TARGET |
Target location for Sandboxes |
Documentation
Examples
See the examples/ruby directory for more usage examples:
Development
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt.
Publishing a New Version
From the repository root:
# Set your RubyGems API key and version
export RUBYGEMS_API_KEY="your-rubygems-api-key"
export RUBYGEMS_PKG_VERSION="X.Y.Z" # pre-release format example: "X.Y.Z.alpha.1"
# Publish (builds and publishes all Ruby gems)
yarn nx publish sdk-ruby
This will automatically:
- Set the version for all Ruby gems (api-client, toolbox-api-client, sdk)
- Build all gems in the correct dependency order
- Publish to RubyGems
For more details, see PUBLISHING.md.
Requirements
- Ruby >= 3.2.0
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/daytonaio/daytona.
Code of Conduct
Everyone interacting in the Daytona SDK project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
License
See LICENSE for details.